dohlee / metheor

:comet: Ultrafast DNA methylation heterogeneity calculation from bisulfite alignments (Lee et al., PLOS Computational Biology. 2023)
GNU General Public License v3.0
41 stars 8 forks source link

When a read is aligned to the start of a contig #9

Closed litaifang closed 1 year ago

litaifang commented 1 year ago

When a read is aligned to the edge of a contig, e.g., chrUn_XYZ:1, the program fails at https://github.com/dohlee/metheor/blob/master/src/tag.rs#L118 because it cannot slice beyond the start or end. Wondering if you want to add support to handle those edge cases?

JianmeiZhong commented 1 year ago

The same problem happened to me when the bam file with record reference start less than 2: chrM:1 4S111M.

Parsing reference genome...
Done!
thread 'main' panicked at 'slice index starts at 18446744073709551614 but ends at 113', src/tag.rs:118:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@dohlee appreciate that if any support for this.

dohlee commented 1 year ago

I see. I will work to resolve it as soon as possible!

JianmeiZhong commented 1 year ago

I saw the update. Thank you for you quick response sincerely ! :)

JianmeiZhong commented 1 year ago

Sorry to bother you again. the slice also threw out an out-range error like abovementioned. Could you please fix it if it is convenient? Bug details as bellow.

Parsing reference genome...
Done!
thread 'main' panicked at 'range end index 16573 out of range for slice of length 16571', src/tag.rs:118:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
dohlee commented 1 year ago

Tried https://github.com/dohlee/metheor/commit/09ad72f8d93f77c54c5644e9b5881b8d820f39ca as a quick fix for those edge cases, but not yet comprehensively tested for your BAM files. Would you update Metheor to 0.1.6 and test it using your data?

If the error persists, let me know!

litaifang commented 1 year ago

No more issue with edge alignments now. Thanks!