Reject ambiguous overlapping repair placements - #708
Closed
SuhasSrinivasan wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
This completed fix is now consolidated into #711 with the related repair ordering and atomic-output corrections. The combined exact head was independently reviewed and passed the full serial workspace gate (204 passed, 14 ignored, 0 failed). Closing this duplicate review surface so the repair code can be reviewed in one PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #679.
Summary
Severity
Severity: Medium — scientific correctness
Rationale: For repetitive donor sequence, the current command can report successful repair and emit plausible MM/ML tags using the first of multiple biologically inequivalent placements. This can silently move modification probabilities to incorrect acceptor positions. Exposure is data-dependent and record-local.
Root cause
str::match_indicesreports non-overlapping occurrences. For donorACACACand acceptorACAC, it reports the occurrence at offset 0 but skips the overlapping occurrence at offset 2, so the code incorrectly treats the placement as unique.Implementation
The repair path uses the existing direct
memchrdependency:memmem::Finder.This uses two bounded linear, allocation-free searches and leaves the existing unique-placement projection unchanged.
Preserved behavior
Non-goals
repaircan reorder or omit records and hide fatal BAM failures #680.Behavior before and after
ACACAC, acceptorACACTACACG, acceptorACACMM:Z:A+a.,0;,ML:B:C,200,MN:i:4Testing
Test environment
2c4a880c7087302eed279f7ddca441e4d31253a89085e47e35517571724ae11ff1d2bd090b342fbf; clean after testingCargo.lockSHA-25649c08c4c51b6f4320726551146d971fa9ef2183d40c3f6c631b2005965e242c0;memchr2.8.3,rust-htslib0.46.0,hts-sys2.2.05cecc3fb3a9336068d9e3c68d5c08d678153dd2c; replay the focused forward/reverse overlapping fixturesACACAC/ACACplacement and the equivalent reverse overlap instead of rejecting themTMPDIR=/private/tmp/modkit-u58-test-tmp cargo test -p mod_kit repair_tags::tests -- --nocapture --test-threads=1test_repairtarget within the isolated workspace gateTMPDIR=/private/tmp/modkit-u58-test-tmp cargo test --workspace --all-targets --no-fail-fast -- --test-threads=1repeatrecord; fixed code emits zero repaired and one failed record and continues normally*sequences on exact headempty-read-sequence; noFinderaccess or panic, confirming empty sequences are rejected before substring searchrustfmt --edition 2021 --check modkit-core/src/repair_tags.rs;git diff --check upstream/master...HEADTests not performed
Scientific validation
Output and compatibility
Reviewer guide
match_indicesbehavior onACACAC/ACAC.Findercalls inrepair_record_pair.cargo test -p mod_kit repair_tags::tests -- --nocapture --test-threads=1.repaircan reorder or omit records and hide fatal BAM failures #680; then rebaserepaircan reorder or omit records and hide fatal BAM failures #680 so the separate ordering/lifecycle work retains this small scientific correction.Checklist