fix(stats): paired-end unmapped reads split between too short and other - #247
Open
BenjaminDEMAILLE wants to merge 1 commit into
Open
fix(stats): paired-end unmapped reads split between too short and other#247BenjaminDEMAILLE wants to merge 1 commit into
BenjaminDEMAILLE wants to merge 1 commit into
Conversation
STAR decides the bucket in ReadAlign_mappedFilter.cpp: nW == 0, meaning no good window at all, is unmappedOther; only a read that had a window whose best transcript failed the score or length thresholds is unmappedShort. The single-end path here already made that distinction. The paired-end path returned TooShort for every unmapped pair, so the "other" bucket in Log.final.out was permanently zero and "too short" carried both populations. Measured on the nf-core/rnaseq test data the issue reports (50 000 pairs, S. cerevisiae chrI + GFP transgene, --outFilterMultimapNmax 20): before too short 7374 other 0 after too short 3778 other 3596 STAR too short 3766 other 3609 The totals were already right (7374 against STAR's 7375), which is why this showed up as mis-categorisation rather than as a counting bug. tests/unmapped_buckets.rs plants all three populations: pairs that map, pairs that seed but cannot clear the score threshold, and pairs with no genomic seed at all. Checked against the control: without this change the paired-end test fails and the single-end one still passes, which is the shape the bug had. Closes #48.
This was referenced Aug 27, 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.
Closes #48, reproduced on the reporter's own fixture.
The rule
STAR decides the bucket in
ReadAlign_mappedFilter.cpp:So
othermeans no window was found at all, andtoo shortmeans a window existed and its best transcript failed the score or length thresholds.The single-end path here already made that distinction. The paired-end path returned
TooShortfor every unmapped pair, which is whyotherwas permanently zero.Measured on the reported fixture
nf-core/rnaseq test data: 50 000 pairs, S. cerevisiae chrI + GFP transgene,
--outFilterMultimapNmax 20, otherwise defaults.The totals already agreed (7374 against STAR's 7375), which is what made this a labelling bug rather than a counting one. The remaining 12-13 reads at the boundary are a separate question: they are reads where the two implementations disagree about whether a window exists at all, not about how to label one.
Tests
tests/unmapped_buckets.rsplants all three populations: pairs that map, pairs that seed but cannot clear the score threshold (a window exists, so "too short"), and pairs with no genomic seed at all ("other"). It also asserts the buckets sum to the input count.Checked against a control: with the fix reverted, the paired-end test fails and the single-end one still passes, which is exactly the shape the bug had.
cargo test,cargo clippy --all-targets -- -D warningson a cold cache, andcargo fmt --checkare green.Note on the reproduction
--readFilesCommand zcatproduces zero reads on macOS for both STAR and rustar-aligner, silently: the run succeeds andLog.final.outreports 0 input reads. I hit it before getting to the real comparison. Unrelated to this fix, but worth knowing when reproducing anything from a gzipped fixture on a Mac; #239 makes--readFilesCommand gunzip -cwork by running the command through a shell, which sidesteps it.🤖 Generated with Claude Code