Question: bedtools 2.0 merge - "unable to open file or unable to determine types"
2
gravatar for Zev.Kronenberg
6.0 years ago by
United States
Zev.Kronenberg11k wrote:

I have a sorted bedfile comprised of three columns: seqid, start, and end.

 sort -k1,1 -k2,2n tmp2.bed > tmp3.bed
1    6589256    6589207
1    11627195    12127194
1    12616616    12116617
1    18283067    18273068
1    21826932    21926931
1    28787213    28788212
1    31195434    31195483
1    39374350    39364351
1    42307024    42357023
1    47379997    47374998

 

~/tools/bedtools2/bin/bedtools merge -i tmp3.bed
Error: unable to open file or unable to determine types for file tmp3.bed

 

Probably something silly, but I'm not seeing it.

 

EDIT:

The second column - start must be before the end coordinates.  It would be nice if bedtools threw an informative error as the user sucks.

 

bedtools • 7.7k views
ADD COMMENTlink modified 5.1 years ago by trutane40 • written 6.0 years ago by Zev.Kronenberg11k
1

bedtools do throw such error messages:

Error: malformed BED entry at line 1. Start was greater than end. Exiting.

I got this message using your example (bedtools v2.19.1).

ADD REPLYlink modified 6.0 years ago • written 6.0 years ago by PoGibas4.8k

That is weird because my version is above your version number and I didn't get that error. 

bedtools v2.21.0-2-g6a92b11

ADD REPLYlink written 6.0 years ago by Zev.Kronenberg11k

What version of bedtools?  Are you sure it is tab-delimited (check with cat -t)?

ADD REPLYlink written 6.0 years ago by Aaronquinlan11k
4
gravatar for trutane
5.1 years ago by
trutane40
United States
trutane40 wrote:

Another thing that will cause bedtools merge to produce this error is if the bed file contains an uncommented column header line such as:

chrom   start   end
1       243651534       243651752
1       243663020       243668636
1       243663020       243663088
1       243663038       243663088

Commenting the header with a leading # will make bedtools happy again:

#chrom   start   end
1       243651534       243651752
1       243663020       243668636
1       243663020       243663088
1       243663038       243663088

The bed file spec doesn't explicitly state anything about the legality of header lines or their expected format (e.g. should be preceded with '#'). Since the columns are proscribed for bed format, a header is not really necessary but can be convenient. Glad that bedtools supports it -- just don't forget to comment it!

bedtools version: 2.22.1

ADD COMMENTlink modified 10 months ago by RamRS30k • written 5.1 years ago by trutane40
0
gravatar for Zev.Kronenberg
6.0 years ago by
United States
Zev.Kronenberg11k wrote:

Solved: Some of the ends are before the starts. Stupid mistake. 

ADD COMMENTlink written 6.0 years ago by Zev.Kronenberg11k
0
gravatar for mgadrianam
5.5 years ago by
mgadrianam20
Colombia
mgadrianam20 wrote:

I get the same error messages:

How did you solved. Could you please help me. I appreciated your help

sincerely,

Adriana

 

ADD COMMENTlink written 5.5 years ago by mgadrianam20
2
awk '{if ($2 > $3) print $1"\t"$3"\t"$2; else print $1"\t"$2"\t"$3}' old.bed > new.bed
ADD REPLYlink modified 5.5 years ago • written 5.5 years ago by Leandro Lima960

Thanks a lot

ADD REPLYlink written 5.0 years ago by Medhat8.7k
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: 1107 users visited in the last hour