Repository navigation
Corrected mode (CLI): score-only prints -1 without an alignment (#23) - #57
Merged
Merged
Conversation
In score-only mode C always prints a score, even with no alignment (CIGAR mode prints -1): for an unreachable pair with a match reward, the classic score evaluated at the unset end position (a signed overflow); with match == 0, the negated score where the search gave up; and INT32_MIN for a failed BiWFA score search. The library already returns these with an unreachable status; only the CLI converts them, reproducing C. With --no-c-compat it now prints -1 when the alignment ended unreachable with no Z-drop cell, or BiWFA's score search failed. Z-drop results keep their score. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 17, 2026
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.
Refs #23, which stays open until upstream C resolves it. This change is behind
--no-c-compat; C mode is unchanged.Problem
In score-only mode, C prints a score even when there's no alignment. CIGAR mode prints
-1 -for the same pairs. What score-only prints depends on the case:k = INT_MAX,offset = OFFSET_NULL).v = offset - kis a signed overflow, which wraps so thatv + h == 1. Example:wfa.utest.seqpair 262 with affine-3,5,3,2and X-drop20,1prints-113. (The example in Known issue (C parity): score-only score for unreachable alignments evaluated at an unset end position #23, pair 101, is actually reachable; the pair number was off. I'll correct the issue.)match == 0: the negated score where the search gave up.INT32_MIN, left bycigar_clear.In Rust, the library already returns these results with an unreachable status, and its docs say the score is meaningless then. Only
align_benchmarkconverts them, reproducing C. So the fix is in the CLI.Fix
With
--no-c-compat, score-only prints-1, as CIGAR mode does, when:Z-drop results keep their score, because they come from a real cell.
Results
-1corresponds to a CIGAR-mode-1 -, except the cases listed below.Left as is (FIXED_BUGS 14h)
-1(C:INT32_MIN), even though CIGAR mode returns the partial alignment. Example: utest with affine-3,5,3,2and Z-drop100,5, 7/305 pairs. Reporting a partial score there would need new BiWFA score-only logic.-1can also be a real score (utest pair 281, 10 × 10 bp), as it can in C's CIGAR mode.Tests
unreachable_score_only_corrected_prints_minus_one(tests/cli_output.rs,tests/data/issue23_unreachable.seq) covers:-113vs corrected-1;INT32_MINvs corrected-1;match == 0.All tests pass; clippy is clean.
🤖 Generated with Claude Code