I am creating a bioinformatics pipeline using Snakemake doing everying from adapter trimming of raw sequencing data in .fq to mapping, SNP calling and SNP filtering.
The issue i am having is when i try to filter specific chromosomes of the bcf files, using the --regions. The rule i have created below works and does create a filtered bcf file.
rule bcftools_filter:
input:
bcf = "/dir/{sample}_aligned_call.bcf",
output:
"/dir/{sample}_aligned_call_filter.bcf"
threads: 20
shell:
"bcftools view -Ob --threads {threads} -m2 -M2 -v snps {input.bcf} -o {output}"
However i would like to add the --regions parameter to the bcftools command. I have tried the shell part of the rule to several things
bcftools view -Ob --threads {threads} -m2 -M2 -v snps {input.bcf} --regions <chr1,chr2> -o {output}
bcftools view -Ob --threads {threads} -m2 -M2 -v snps {input.bcf} --regions {chr1,chr2} -o {output}
bcftools view -Ob --threads {threads} -m2 -M2 -v snps {input.bcf} --regions {{chr1,chr2}} -o {output}
bcftools view -Ob --threads {threads} -m2 -M2 -v snps {input.bcf} --regions {{chr1} {chr2}}
{{chr2}} -o {output}
bcftools view -Ob --threads {threads} -m2 -M2 -v snps {input.bcf} --regions ['chr1','chr2'] -o {output}
But it doesn't work, and i am having trouble finding any suggestions to this specific issue.
I know it works if i just run bcftools filter in my command line, so using --regions should work.
Could anyone have any suggestions how to add --regions to the snakemake rule?
expand()
function? snakemake.readthedocs.io/en/stable/snakefiles/… $\endgroup$