biod / sambamba

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

sambamba depth region -L <(expression) bam segfaults #406

Open isthisthat opened 5 years ago

isthisthat commented 5 years ago

I'm trying to chain a region generator to sambamba depth but it fails or core dups using any of:

sambamba depth region -L <(expression) bam
expression | sambamba depth region -L /dev/stdin bam

but not

expression > tmp.bed; sambamba depth region -L tmp.bed bam

Thought I might report since it took ages to debug. Using the latest release (v7). Thanks

pjotrp commented 5 years ago

Oucht. Thanks for reporting. I'll try and replicate.

isthisthat commented 5 years ago

Might be related to this: sambamba depth base -L chr22_KI270731v1_random:0-150754 gives sambamba-depth: Conversion negative overflow but this works: sambamba depth base -L chr22_KI270731v1_random same for any contig, I just chose a small one

pjotrp commented 4 years ago

Can you try the latest release https://github.com/biod/sambamba/releases

pjotrp commented 4 years ago

closing this for lack of reply.

isthisthat commented 4 years ago

Hi @pjotrp , sorry for the lack of response! This is still an issue (on my hands at least) with 0.7.1:

sambamba depth base -L chr22_KI270731v1_random:0-150754 NA12878-xxx.bam sambamba 0.7.1 by Artem Tarasov and Pjotr Prins (C) 2012-2019 LDC 1.17.0 / DMD v2.087.1 / LLVM8.0.1 / bootstrap LDC - the LLVM D compiler (1.17.0) REF POS COV A C G T DEL REFSKIP SAMPLE sambamba-depth: Conversion negative overflow

pjotrp commented 4 years ago

OK, I'll reopen. If it happens with any BAM file it should be easy to reproduce.

pjotrp commented 3 years ago

Can you send me (a section of) that input file so I can easily replicate the issue?

isthisthat commented 3 years ago

Ok I've narrowed down the bug. It seems to occur when the start coordinate is zero, e.g.: sambamba-0.8.0-linux-amd64-static depth base -L chr1:0-10 any.bam same for region I'm guessing it uses 1-based coordinates for the chr:start-end definition (as it should). It seems like a minor thing then.

pjotrp commented 3 years ago

Great. I can reproduce the issue

./bin/sambamba-0.8.0 depth base -L chr1:0-10 test/issue_204.bam

sambamba 0.8.0
 by Artem Tarasov and Pjotr Prins (C) 2012-2020
    LDC 1.10.0 / DMD v2.080.1 / LLVM6.0.1 / bootstrap LDC - the LLVM D compiler (0.17.4)

REF     POS     COV     A       C       G       T       DEL     REFSKIP SAMPLE
sambamba-depth: Conversion negative overflow
pjotrp commented 3 years ago

I love reproducible bugs!