Repository navigation
Corrected mode: valid X-drop CIGARs with steps > 1 (#21) - #54
Merged
Merged
Conversation
With steps_between_cutoffs > 1 a cutoff can trim a wavefront to empty. Compute then reads it as the null wavefront, but its stale offsets stay within the initialized range, so C's high-memory backtrace can take a source compute never used; a negative match run then overwrites earlier CIGAR operations. In Compat::Corrected, a wavefront trimmed empty (M, or I/D by equating) also gets an empty initialized range, so the backtrace reads what compute read. Scores are unchanged; Compat::C is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #21 behind
Compat::Corrected(#32). The defaultCompat::Cmode is unchanged.Problem
With
steps_between_cutoffs > 1, only every n-th wavefront is pruned, and a cutoff can trim a wavefront to empty (lo > hi,null). Compute then reads it as the null wavefront. Its offsets, though, are still inside the initialized range, and the high-memory backtrace checks only that range. So the backtrace can take a source that compute never used. If that source's offset is bigger than the current cell's, the match count goes negative, and the CIGAR write position moves forward over earlier operations.Example:
wfa.utest.seqpair 201, affine50,10. At score 506, k = 6, offset 547, the mismatch source M(502) was trimmed empty but still holds 548.C's
medmode records the real sources, so it was already valid.Fix
In corrected mode, when a cutoff trims M, or I/D through equating, to empty, its initialized range is emptied too (
Wavefront::clear_init_range). The backtrace then reads exactly what compute read. Scores are unchanged.Results
X-drop
50,10/100,5, affine / linear / affine2p,wfa.utest.seqandlong.seq: every non-empty CIGAR is valid in global, ends-free and extension, and score-only output is identical in both modes. In C mode, for example, affine100,5onlong.seqis 0/300 valid.Differential suite, C mode: only the 20 known Known issue (C bug): Z-drop in med/low backtraces from uninitialized cells (high vs med differ) #22 differences.
Differential suite, corrected mode (run with a wrapper that adds
--no-c-compat): every difference from C falls into one of three groups:medwith match < 0 (Known issue (C bug): Z-drop in med/low backtraces from uninitialized cells (high vs med differ) #22, also in C mode).Banded, adaptive and BiWFA are identical to C.
Behaviour notes (FIXED_BUGS 14d)
50,10: 5/305 pairs).long.seqpair 155, affine-3,5,3,2100,5).100,5) now gives-1 -, as C'smedmode does. C's high-memory CIGAR for it is invalid.Tests
tests/corrected_xdrop.rs(pair 201,tests/data/issue21_xdrop.seq, all three gap metrics):cargo test --releaseand the debug test run pass; clippy is clean.A follow-up could give
run.sha corrected mode with its own list of expected differences, so CI checks this.🤖 Generated with Claude Code