Intersect vcf file and bed file
1
0
Entering edit mode
7.3 years ago
darklings ▴ 580

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?

bedtools vcf bed • 4.5k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

I added a header but the same error raised

ADD REPLY
0
Entering edit mode
7.3 years ago
$ bedops --element-of 1 enhancers.bed <(vcf2bed < snps.vcf) > answer.bed
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 2301 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