Question: Command to extract SNPs from VCF file using bcftool
0
gravatar for MAPK
21 months ago by
MAPK1.1k
United States
MAPK1.1k 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 • 1.6k views
ADD COMMENTlink modified 21 months ago by wfrederickw0 • written 21 months ago by MAPK1.1k
2

Doesn't bedtools intersect work with VCF files?

ADD REPLYlink written 21 months ago by Devon Ryan74k
1
gravatar for Jorge Amigo
21 months ago by
Jorge Amigo10k
Santiago de Compostela, Spain
Jorge Amigo10k 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 21 months ago • written 21 months ago by Jorge Amigo10k

get this error with bcftools:

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

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 21 months ago by Jorge Amigo10k
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: 1711 users visited in the last hour