Question: Command to extract SNPs from VCF file using bcftool
0
gravatar for MAPK
2.6 years ago by
MAPK1.3k
United States
MAPK1.3k wrote:

I have a bed file called my.bed with CHROM, START, and END Position. Can someone please explain me how I can use the bcftool or command to extract the regions from myvcf.vcf file ?

snps bcftool vcf • 3.5k views
ADD COMMENTlink modified 2.6 years ago by wfrederickw0 • written 2.6 years ago by MAPK1.3k
2

Doesn't bedtools intersect work with VCF files?

ADD REPLYlink written 2.6 years ago by Devon Ryan86k
4
gravatar for Jorge Amigo
2.6 years ago by
Jorge Amigo11k
Santiago de Compostela, Spain
Jorge Amigo11k wrote:

my preferred option when dealing with vcf files is bcftools, which requires vcf indexing:

tabix -p vcf my.vcf
bcftools view -R my.bed my.vcf.gz

another perfectly valid alternative, as Devon has just pointed out, would be bedtools intersect:

bedtools intersect -a my.vcf -b my.bed
ADD COMMENTlink modified 2.6 years ago • written 2.6 years ago by Jorge Amigo11k

get this error with bcftools:

`view: invalid option -- 'R'
[bcf_sync] incorrect number of fields (0 != 5) at 0:0
ADD REPLYlink written 2.6 years ago by MAPK1.3k

that's strange. it looks like it's asking you for better formed bed file (chr, start, end, value, strand), but I constantly use the --regions-file option with single positions (chr, pos) or regions (chr, start, end) as explained here. maybe you could be using an old bcftools version? I'm using 1.3 (1.3.1 has just been released).

ADD REPLYlink written 2.6 years ago by Jorge Amigo11k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1077 users visited in the last hour