dohlee / metheor

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

Fix to handle deletions at end of read #7

Closed ggydush closed 1 year ago

ggydush commented 1 year ago

I found an edge case when running metheor tag when looking for trinucelotide bases with reads ending in a deletion. Adding a simple check to confirm length fixes the issue, but would be open to alternatives if you have any ideas!

Here is an example of a read that breaks metheor tag:

test        161     chr1    35576935        60      1M13D4M4D139M   =       35576985        193     CATACACAACCACAAAACCCCAACACCAACAAAACCCCAACACCAACAAAACCCCAACACCAACAAAACCCCAACACCAACAAAACCCCAACACCAACAAAACNATAACCCAATAAAACAAATAAAACACTCACAACCTAAACA ?????????????????????????????????????????????????????????????????????????????????????????????????????7?!7????????7?????????????????7??????7?????      RG:Z:test

Which returned the following error before the fix:

Parsing reference genome...
Done!
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/tag.rs:26:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ggydush commented 1 year ago

@dohlee Let me know if you have thoughts on this! Happy to provide an actual BAM for testing if easier!

dohlee commented 1 year ago

Looks great! Thank you for the suggestion.