brentp / goleft

goleft is a collection of bioinformatics tools distributed under MIT license in a single static binary
MIT License
216 stars 25 forks source link

panic in crai.makeSizes #43

Closed kpalin closed 6 years ago

kpalin commented 6 years ago

Trying to run indexcov (v0.1.18 from bioconda) on long read WGS (fai and crai attached) but keep getting an obscure error message:

$ goleft indexcov  --excludepatt '[a-zA-VZ]'  --fai hs37d5_viral.fa.fai --directory test 9370NK.filtered.sorted.cram.crai  
2018/04/26 09:39:33 -19749 16384 {2355931 707216 13182576 1395 3515035} 2355931 2375680
panic: logic error

goroutine 16 [running]:
github.com/brentp/goleft/indexcov/crai.makeSizes(0xc420211500, 0x13c, 0x220, 0xc420686000, 0xd5e, 0xd5e)
        /home/brentp/go/src/github.com/brentp/goleft/indexcov/crai/crai.go:83 +0x958
github.com/brentp/goleft/indexcov/crai.(*Index).Sizes(0xc420184060, 0x7feb6fc45070, 0x450920, 0x7feb6fc9f000)
        /home/brentp/go/src/github.com/brentp/goleft/indexcov/crai/crai.go:48 +0xc4
github.com/brentp/goleft/indexcov.(*Index).init(0xc420260050)
        /home/brentp/go/src/github.com/brentp/goleft/indexcov/indexcov.go:81 +0x465
github.com/brentp/goleft/indexcov.readIndex(0x7ffc2b92815b, 0x2d, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/brentp/go/src/github.com/brentp/goleft/indexcov/indexcov.go:431 +0x5a9
github.com/brentp/goleft/indexcov.Main.func1(0xc420256000, 0xc4201641a0, 0x1, 0x1, 0xc42025a000, 0x1, 0x1, 0xc4204ac140)
        /home/brentp/go/src/github.com/brentp/goleft/indexcov/indexcov.go:365 +0x8a
created by github.com/brentp/goleft/indexcov.Main
        /home/brentp/go/src/github.com/brentp/goleft/indexcov/indexcov.go:363 +0x386

bug_fai_crai.zip

brentp commented 6 years ago

before I did in to this too much. would you re-index your cram with samtools 1.6 or greater and see if the problem persists?

kpalin commented 6 years ago

Indexed with:

Program: samtools (Tools for alignments in the SAM format) Version: 1.8 (using htslib 1.8)

and for the record, it's mapped with minimap2 version 2.10-r761 from bioconda (Sam output converted to cram with above samtools). igv seems appears to work with the cram/crai.

K

On 26 April 2018 at 18:00, Brent Pedersen notifications@github.com wrote:

before I did in to this too much. would you re-index your cram with samtools 1.6 or greater and see if the problem persists?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brentp/goleft/issues/43#issuecomment-384672583, or mute the thread https://github.com/notifications/unsubscribe-auth/AAhmCMCDc7uDgKoU6b7KZk0zGz9pS3qdks5tseD7gaJpZM4Tkxg- .

-- Kimmo Palin

brentp commented 6 years ago

Finally had a chance to look at this. I think I see the problem in my code. These must be long reads--which I should have guessed since you used minimap2. as this can only happen if the reads are longer than 16384 bases and overlap an cram tile. I'll make a fix shortly.

Do you mind if I add your data as a test-case?

brentp commented 6 years ago

I pushed a fix for this and made a new release here: https://github.com/brentp/goleft/releases/tag/v0.1.19

thanks for the test-case.