arq5x / bedtools

A powerful toolset for genome arithmetic.
http://code.google.com/p/bedtools/
GNU General Public License v2.0
139 stars 86 forks source link

unionbedg #114

Open flay opened 8 years ago

flay commented 8 years ago

I'm running bedtools v2.23 and trying to use unionbedg but keeps on running into this error:

bedtools unionbedg -i N25sort.bedgraph T25sort.bedgraph > merge_25.bedgraph bedtools: unionBedGraphs.cpp:99: CHRPOS UnionBedGraphs::ConsumeNextCoordinate(): Assertion `!queue.empty()' failed. Aborted (core dumped)

The bedgraphs input are sorted and only has 1,000,000 lines. I tried smaller files and ran into the same issue. Not sure why this is ---

arq5x commented 8 years ago

Could you make sure that both files are sorted correctly?

sort -c -k1,1 -k2,2n N25sort.bedgraph
sort -c -k1,1 -k2,2n T25sort.bedgraph
bwlang commented 1 year ago

@arq5x

I'm seeing segfaults on a conda build of 2.30 on linux x64

I've attached some example files... is there something strange about these? test_bedgraphs.tgz

these look sorted to me.

on mac (M1) I see

(seq) ➜  test_bedgraphs bedtools unionbedg -i test*.bedGraph
Assertion failed: (!queue.empty()), function ConsumeNextCoordinate, file src/unionBedGraphs/unionBedGraphs.cpp, line 99.
[1]    77227 abort      bedtools unionbedg -i test*.bedGraph
(seq) ➜  test_bedgraphs bedtools --version
bedtools v2.30.0
arq5x commented 1 year ago

unionbedg assumes (requires) 4 column format.

This works:

bedtools unionbedg -i <(cut -f 1-4 test1.bedGraph) <(cut -f 1-4 test2.bedGraph)

Unfortunately, the error raised is unhelpful.

bwlang commented 1 year ago

yeah - probably segfault is not the best UI ;)

arq5x commented 1 year ago

So that's not a segfault, it is trapping an error and raising that the error occurred. I will work to add a better message indicative of the potential cause.

bwlang commented 1 year ago

ah - i guess i have not seen a core dump outside of that situation... A segfault would certainly be a bug - sounds like this is just a missing feature/error handler.

It also drops a core file when you feed it empty files in case that's an easy addition at the same time..