Question: Intersect vcf file and bed file
0
gravatar for darklings
3.0 years ago by
darklings90
darklings90 wrote:

Hi, I want to intersect my vcf files with the enhancer database bed file; so I used bedtools and print:

bedtools intersect -a enhancers.bed -b examples.vcf

then it showed

Error: Type checker found wrong number of fields while tokenizing data line.

Do the bed or vcf files contain too many fields? But I don't want to cut the columns, or maybe I should annotate my vcf file?

The vcf file looks like:

#CHROM POS ID REF ALT QUA FILTER AA ....... (so many columns)
(and datas below, actually there is no header in the vcf file)

And the bed file looks like:

chr1 839741 840250 chr1:839741-840250 24 . 839787 839788 0,0,0 2 20,436 0,73

Can anyone help me to solve the problem?

bed vcf bedtools • 2.8k views
ADD COMMENTlink modified 3.0 years ago • written 3.0 years ago by darklings90

there is no header in the vcf file this may well be the reason why bedtools doesn't recognise your vcf as such. Try adding a header to your vcf file.

ADD REPLYlink written 3.0 years ago by dariober11k

I added a header but the same error raised

ADD REPLYlink written 3.0 years ago by darklings90
0
gravatar for Alex Reynolds
3.0 years ago by
Alex Reynolds30k
Seattle, WA USA
Alex Reynolds30k wrote:
$ bedops --element-of 1 enhancers.bed <(vcf2bed < snps.vcf) > answer.bed
ADD COMMENTlink written 3.0 years ago by Alex Reynolds30k

I tried this command but it only created an empty bed file...

ADD REPLYlink written 3.0 years ago by darklings90

Maybe your input is unsorted. Try:

$ bedops -e 1 <(sort-bed enhancers.bed) <(vcf2bed < snps.vcf) > answer.bed

You could also run:

$ vcf2bed < snps.vcf | head

to check that conversion from VCF to BED is working.

Failing that, we'd probably need to see what your files actually look like.

ADD REPLYlink modified 3.0 years ago • written 3.0 years ago by Alex Reynolds30k
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: 840 users visited in the last hour