I want to use the gatk MakeVcfSampleNameMap tool to generate a tab-delimited file that maps sample names to the corresponding VCF files in a Snakemake workflow. These vcfs are in a the directory input/
output - > (sample_name_map.txt)
input/vcf1.vcf.gz control5-a
input/vcf2.vcf.gz control5-c
MakeVcfSampleNameMap accepts a single --INPUT argument at a time, so I have to submit multiple VCF files to it in the form:
--INPUT {input.vcfs[0]}--INPUT {input.vcfs[1]}, etc.
snakemake rule:
rule MakeVcfSampleNameMap:
input:
vcfs=["input/vcf1.vcf.gz", "input/vcf2.vcf.gz"],
output:
"sample_name_map.txt",
shell:
"gatk MakeVcfSampleNameMap \
--INPUT {input.vcfs[0]} \
--INPUT {input.vcfs[1]} \
--OUTPUT {output}"
This becomes cumbersome when there are many input files. How can use a loop in the Snakemake rule to access all the VCF files?
source https://stackoverflow.com/questions/75700654/how-to-use-a-for-loop-to-access-inputs-in-snakemake
Comments
Post a Comment