Skip to content

[Bug]: Issues when running through wasm #6

@vrbouza

Description

@vrbouza

Orphos Version

0.1.0

Operating System

Linux

Rust Version

rustc 1.92.0 (ded5c06cf 2025-12-08)

Bug Description

Hi! First of all, thank you for this nice work of porting Prodigal to Rust and optimising it. We are working on some project for which we needed to run Prodigal on wasm, and this helped us avoid to compile to emscriptem or doing some port/adaptation to Rust ourselves!

So, the bug: I've been doing tests in wasm and I get some "random" errors. I've noticed they only appear when the file to process has contigs that are "small". I've heuristically found that if you set a threshold of 15 kbp this doesn't happen. The same file with the same records running in x86_64 through the cli doesn't give this error. In wasm the error I get (as they don't get propagated) is an "index out of bonds" error from the wasm code, coming from the "analyze_sequence_bytes" method.

My next step was going to debug this by cloning your code (now I'm using it as library) and add prints in it until I find the culprit, but given that is so generic before doing this I wanted to try asking in case you/any other person have seen this already.

Steps to Reproduce

  1. Create an OrphosAnalyzer object and analyse some small contigs with analyze_sequence_bytes.
  2. You get index out of bound errors

I attach a sample contig that gives error. Several other sequences are processed w/o any issue.

Expected Behavior

To analyse the sequence/contig w/o errors.

Actual Behavior

It gives an error of index out of bounds coming from the analyze_sequence_bytes method of the OrphosAnalyzer object.

Error Output

RuntimeError: index out of bounds

Sample Input Files

> Quicktest
TTCGCTCCAAGCTGGACTGTATGCACGAACCCCCCGTTCAGTCCGACTGCTGCGCCTTAT
CCGGTAACTATCGTCTTGAGTCCAACCCGGAAAGACATGCAAAAGCGCCACTGGCAGCAG
CCACTGGTAACTGATTTAGAGGAGATAGTCTTGAAGTTATGCGCCGGTTAAGGCTAAACT
AAACGAACAGTTTTGGTGACTGTGCTCCTCCAAGCCAGTTACCTCGGTTCAAAGAGTTGG
TAGCTCAGAGAACCTTCGAAAAAACCGCCCTGCAAGGCGGTTTTTTCGTTTACCGAGCAA
GAGATTACGATGCTACAGAAAGGATCTCAAGAGGATCCTGTACCATATACCTTCCCCTGA
AGGGAAACCAGCAACGCCAGTGAACTTACAGAAAAGCCAAACTATTTGATCTTATTACAA
AAATAAGTATAGAGTAAGATTGTGCACAATCACTCTATCTGGTCGAAAAAAAATGGATTT
CCTAATAATTTCATCTCTGTGGTGGGTAATGCTACCAACTTGCTGATTTAGTGTATGATG
GTGTTTTTGAGGTGCTCCAGTGGCTTCTGTTTCTATCAGCTGTCCCTCCTGTTC

Additional Context

No response

Checklist

  • I have searched existing issues to ensure this bug hasn't been reported before
  • I have tested with the latest version of Orphos
  • I have provided all the requested information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions