jteutenberg / downpore

Suite of tools for use in genome assembly and consensus. Work in progress.
MIT License
31 stars 0 forks source link

panic: runtime error: slice bounds out of range #6

Closed isugif closed 3 years ago

isugif commented 3 years ago

2021/03/22 12:36:07 Splitting read 576300 into: 0 - 1906 and 2134 - 2743 2021/03/22 12:36:07 TTGTTGATACTTCGCAAAGGCAGAAAGT 2021/03/22 12:36:07 Splitting read 580585 into: 0 - 5824 and 6052 - 17093 2021/03/22 12:36:07 ACCAGGTGCTGTTCTCGCAAAGGCAGAA 2021/03/22 12:36:07 Splitting read 585328 into: 0 - 379 and 607 - 522 2021/03/22 12:36:07 GTGCTGTTCTCGCAAAGGCGAAAGTAGT panic: runtime error: slice bounds out of range

I suspect this is a middle adaptor issue, The end of the split.bStart is greater than the seq.len

I suspect that if you wrap this code in your trim.go function with an if statement checking that split.bStart < seq.len() it would avoid this error. I have been just raising the -middle_threshold value from 85 up until 100 to remove middle trimming to avoid the error but this solution is not ideal.

        if split.aEnd > edgeSize {
            seqs.AddSequence(seq.SubSequence(0, split.aEnd), seqs.GetName(split.id)+"_(left)")
            report += fmt.Sprint(": 0 - ",split.aEnd," and ")
        } else {
            report += " ignored short left hand side and "
        }
        if seq.Len()-split.bStart > edgeSize {
            seqs.AddSequence(seq.SubSequence(split.bStart, seq.Len()), seqs.GetName(split.id)+"_(right)")
            report += fmt.Sprint(split.bStart," - ",seq.Len())
        } else {
            report += " ignored short right hand side"
        }
jteutenberg commented 3 years ago

Are you able to provide the sequence that causes the crash (and the adapters if different from the defaults)?

It's not clear how it outputs "607 - 522" for the right-hand side given the requirement that we have: seq.Len()-split.bStart > edgeSize (i.e. 522 - 607 > 150 ?) which should catch all such cases.

isugif commented 3 years ago

In case it is relevant, I am using this biocontainer singularity container.

quay.io/biocontainers/downpore:0.3.3--h375a9b1_0

On Mon, Mar 22, 2021 at 2:33 PM Jonathan Teutenberg < @.***> wrote:

Are you able to provide the sequence that causes the crash (and the adapters if different from the defaults)?

It's not clear how it outputs "607 - 522" for the right-hand side given the requirement that we have: seq.Len()-split.bStart > edgeSize (i.e. 522 - 607 > 150 ?) which should catch all such cases.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jteutenberg/downpore/issues/6#issuecomment-804338385, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQPC5GQS4RQXCTMURADFOLTE6LQXANCNFSM4ZTTFKLA .

-- Andrew Research Manager in Office of Biotechnology Adjunct Assistant Professor in Ecology, Evolution and Organismal Biology (EEOB) Genome Informatics Facility 451 Bessey Hall Iowa State University Ames, Iowa 50011 (515)-294-1320

jteutenberg commented 3 years ago

Ah, I see that the latest release doesn't have the patch with those checks in. I'll push a new release today which will include a pre-built binary.

isugif commented 3 years ago

The new version works. Thank you