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
• 5,776 views
•
link
2 answers
bcftools view --regions-file input.bed input.vcf.gz
• 0 views
•
link
I figured it out -
awk '{print "Chromosome\t"$1-1"\t"$1}' <positions_file>.txt | \
bcftools view -T - <vcf_file>.vcf.gz | ... etc
• 0 views
•
link
Log in to answer this question.