fiberseq / fibertools-rs

Tools for fiberseq data written in rust.
https://fiberseq.github.io/fibertools/fibertools.html
42 stars 5 forks source link

Bug: Assertion error in supplemental or secondary reads #31

Closed mrvollger closed 8 months ago

mrvollger commented 1 year ago

Currently, there is a bug with handling ONT supplemental or secondary alignments in the ML/MM parser. I think it is due to hard clipping but need to investigate.

mrvollger commented 1 year ago

A temporary workaround is to filter your inputs to remove these types of alignments (samtools view -F 2304)

mrvollger commented 1 year ago

Errors look like:

[2023-10-31T18:43:32Z TRACE ft] TRACE logging enabled
[2023-10-31T18:43:32Z DEBUG ft] Using 30 threads.
[2023-10-31T18:43:32Z INFO  ft] Starting ft-center
[2023-10-31T18:43:32Z DEBUG bio_io] Compression: No
[2023-10-31T18:43:32Z TRACE fibertools_rs::fiber] cb380dce191d20804ee54cfe86c4173384172d61_dna_r10.4.1_e8.2_400bps_sup@v4.2.0-44EB653E
[2023-10-31T18:43:32Z TRACE fibertools_rs::fiber] cb380dce191d20804ee54cfe86c4173384172d61_dna_r10.4.1_e8.2_400bps_sup@v4.2.0-5FF52E97
[2023-10-31T18:43:32Z TRACE fibertools_rs::fiber] cb380dce191d20804ee54cfe86c4173384172d61_dna_r10.4.1_e8.2_400bps_sup@v4.2.0-44ED6DDD
thread 'thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
 left: `0`,
 right: `4319`', src/basemods/mod.rs<unnamed>' panicked at ':166:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
assertion failed: `(left == right)`
 left: `0`,
 right: `2530`', src/basemods/mod.rs:166:17
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
 left: `0`,
 right: `7916`', src/basemods/mod.rs:166:17
mrvollger commented 11 months ago

Correct handling of MM/ML tags in hard clipped alignments is still not settled in the SAM spec:

https://github.com/samtools/hts-specs/issues/646

So this will remain an issue until this conversation is resolved.

Please filter any hard clipped reads before using ft.