rule annotate_bam_single_fastq:
    input:
        bam="mapped/{sample}.bam",
        umi="umi/{sample}.fastq",
    output:
        "mapped/{sample}.annotated.bam",
    params:
        "",
    resources:
        # suggestion assuming unsorted input, so that memory should
        # be proportional to input size:
        # https://fulcrumgenomics.github.io/fgbio/tools/latest/AnnotateBamWithUmis.html
        mem_mb=lambda wildcards, input: max([input.size_mb * 1.3, 200]),
    log:
        "logs/fgbio/annotate_bam/{sample}.log",
    wrapper:
        "master/bio/fgbio/annotatebamwithumis"


rule annotate_bam_multiple_fastqs:
    input:
        bam="mapped/{sample}.bam",
        umi=[
            "umi/{sample}.fastq",
            "umi/{sample}.fastq",
        ],
    output:
        "mapped/{sample}-{sample}.annotated.bam",
    params:
        "",
    resources:
        # suggestion assuming unsorted input, so that memory should
        # be proportional to input size:
        # https://fulcrumgenomics.github.io/fgbio/tools/latest/AnnotateBamWithUmis.html
        mem_mb=lambda wildcards, input: max([input.size_mb * 1.3, 200]),
    log:
        "logs/fgbio/annotate_bam/{sample}-{sample}.log",
    wrapper:
        "master/bio/fgbio/annotatebamwithumis"
