This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to pull from a file of positions in bcftools view

I have some code to pull specific SNP positions from bcftools view , which I then annotate and apply bcftools query, like this:

bcftools view <vcf_file>.vcf.gz Chromosome:123456 | bcftools csq -f <ref_file>.fa -g <ref_file>.gff | bcftools query -f '%POS\t%REF\t%ALT\t%BCSQ\n'

How do I give the first bcftools view commands a list of positions in a file?

This does not work:

bcftools view <vcf_file>.vcf.gz Chromosome:<positions_file>.txt | ...etc

Thanks

bcftools subsetting

2 answers

bcftools view --regions-file input.bed input.vcf.gz

I figured it out - awk '{print "Chromosome\t"$1-1"\t"$1}' <positions_file>.txt | \ bcftools view -T - <vcf_file>.vcf.gz | ... etc

Log in to answer this question.