How to pull from a file of positions in bcftools view
2
0
Entering edit mode
4.6 years ago

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 • 5.0k views
ADD COMMENT
2
Entering edit mode
4.6 years ago
bcftools view --regions-file input.bed input.vcf.gz
ADD COMMENT
1
Entering edit mode
4.6 years ago

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

ADD COMMENT

Login before adding your answer.

Traffic: 2132 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6