biod / sambamba

Tools for working with SAM/BAM data
http://thebird.nl/blog/D_Dragon.html
GNU General Public License v2.0
565 stars 105 forks source link

Assertion failure in `sambamba depth` #340

Closed hzpc-joostk closed 6 years ago

hzpc-joostk commented 6 years ago

Running the depth commands on BAM raise an Assertion failure:

(shell = Zsh)

sambamba 0.6.7

This version was built with:
    LDC 1.1.1
    using DMD v2.071.2
    using LLVM 3.8.1
    bootstrapped with LDC - the LLVM D compiler (0.17.4)
$ time sambamba depth window -w 50 --fix-mate-overlaps mysample.bam >/dev/null
Processing reference #4 (ST4.03ch01)
core.exception.AssertError@sambamba/depth.d(718): Assertion failure
----------------
sambamba depth window -w 50 --fix-mate-overlaps mysample.bam > /dev/null  0.76s user 0.01s system 99% cpu 0.769 total

$ time sambamba depth base --fix-mate-overlaps mysample.bam >/dev/null
Processing reference #4 (ST4.03ch01)
core.exception.AssertError@sambamba/depth.d(359): Assertion failure
----------------
sambamba depth base --fix-mate-overlaps mysample.bam > /dev/null  1.78s user 0.01s system 99% cpu 1.793 total

I found the read alignments that caused the trouble:

ST-E00288:114:H3NJ5ALXX:4:1207:21420:12683      99      ST4.03ch01      103111  60      151M    =       103233  225
ST-E00288:114:H3NJ5ALXX:4:1207:21420:12683      147     ST4.03ch01      103233  60      103M48S =       103111  -225
ST-E00288:114:H3NJ5ALXX:4:1207:21420:12683      2179    ST4.03ch01      103272  37      47M104H =       103111  -162

How can we solve this?

It seems that the third (supplementary) alignment, overlaps both primary mates. So I could workaround by -F 'not supplementary'. But is that really the way I should solve this?

pjotrp commented 6 years ago

The assertion at https://github.com/biod/sambamba/blob/master/sambamba/depth.d#L359 makes sure there is no conflict. For these rare cases we should actually emit a warning. If you run the latest release there should be no assertions compiled in, but I'll test for that.

hzpc-joostk commented 6 years ago

If you'd like data to test with, let me know. Cheers!