在 snakemake 中合并 vcf 文件

Merge vcf files in snakemake

在 运行 变量调用之后,我只想合并特定的输出,如 d 所示。 这给了我一个 error of missing input files。如何解决?

d = {"bob": ["bob:0-10.view.filtered.vcf", "bob:10-20.view.filtered.vcf"]
     "ann": ["ann:0-20.view.filtered.vcf", "ann:20-30.view.filtered.vcf"]}

rule varcall:
    input:
        ref="reference.fasta",
        bam="bam_list"
    output:
        outf ="var/{chr}.view.filtered.vcf"
    shell:
        """
        freebayes -r {wildcards.chr} -f {input.ref} --bam-list {input.bam} -v {output.outf}
        """

wildcard_constraints:
    chromosome = "|".join(chromosomes)

rule merge:
    input:
        lambda w: d[w.chromosome]
    output:
        outf = "merged/{chromosome}.vcf"
    params:
        lambda w: "I=" + " I=".join(d[w.chromosome])
    shell:
        "java -jar picard.jar GatherVcfs {params[0]} O={output.outf}"

varcall的输出是

outf ="var/{chr}.view.filtered.vcf"

所以字典 d 可能应该包括目录 var:

d = {"bob": ["var/bob:0-10.view.filtered.vcf", "var/bob:10-20.view.filtered.vcf"]
     "ann": ["var/ann:0-20.view.filtered.vcf", "var/ann:20-30.view.filtered.vcf"]}