BUStools / bustools

Tools for working with BUS files
https://bustools.github.io/
BSD 2-Clause "Simplified" License
92 stars 23 forks source link

bustools sort dies without error message #24

Closed stela2502 closed 5 years ago

stela2502 commented 5 years ago

I have three samples, one that when analyzed looks approximately like the cellRanger output and two (processed exactly the same, both in the lab and during processing) fail to produce output.

I think I could identify the problematic step as being the 'bustools sort':

If I understand the bustools code right I would expect during a 'bustools sort -o sorted.bus output.bus' run these messages:

Read in BUS records All sorted

But every bus file I have created and sorted so far does not report the 'All sorted'. That is especially surprising as one of three actually produces the expected output. I have three samples, one that when processed looks approximately like the cellRanger output and two (processed exactly the same, both in the lab and during processing) fail to produce output.

Somewhere here the program needs to silently die: std::sort(b.begin(), b.end(), [&](const BUSData& a, const BUSData &b) { if (a.barcode == b.barcode) { if (a.UMI == b.UMI) { return a.ec < b.ec; } else { return a.UMI < b.UMI; } } else { return a.barcode < b.barcode; }});

Why could that happen and more importantly - why does the program not throw an error?

Thank you for your help.

stela2502 commented 5 years ago

I was looking in the wrong function! After adding the print statement into the correct function bustools_rort.cpp:218: std::cerr << "All sorted" << std::endl; both files actually sort fine...

So please never mind ;-)

pmelsted commented 5 years ago

That was quick :)

One thing you can do to check if the file is sorted is to use the text subcommand, which can turn the BUS file into a text file or output to stdout.

You can use sort -k1,1 -k2,2 -k3n,3 or with a -c flag to check that is is truly sorted