Bedtools intersect tab and bed files
1
0
Entering edit mode
9.7 years ago
smartsean • 0

How can you call Bedtools intersect on a tab and bed file? without getting the typical error shown below?

Differing number of BED fields encountered at line: #. Exiting...

My bed file has 15 columns and my tab file has 18

bedtools intersect tab bed • 6.0k views
ADD COMMENT
0
Entering edit mode

I don't think you can use bedtools intersect to intersect a BED file with a tab-delimited file that is not in BED format. Even though a BED file is essentially a tab-delimited file, it has a particular format. If you can convert your tab-file to BED format then maybe it will work.

ADD REPLY
0
Entering edit mode
9.7 years ago
Ram 43k

Expanding on komal.rathi's comment,

Create a BED file out of your tab file, follow the steps below:

  1. Add this line: #dummy header to a new empty file
  2. Use awk or cut to extract from your tab-delimited file the fields corresponding to the BED file you already have. Redirect and append (>>) the output of this command to the file created above.
  3. Use bedtools intersect on the BED files that you have now.
ADD COMMENT

Login before adding your answer.

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