Repository navigation
fix(featurecounts): select and pair records like Subread - #206
Merged
ewels merged 1 commit intoNov 27, 2026
Merged
Conversation
Make featureCounts-style counting and the dupRadar paired-end counting follow Subread's readSummary.c and the Rsubread pairer instead of RustQC's own rules. Read selection: - supplementary (0x800) and QC-fail (0x200) records are counted: Subread has no filter on those flags, so neither did we need one; - records are paired by featureCounts' pairer key regardless of direction: the read name cut at '/', and an unmapped self or mate recorded as -1/0; unmapped reads placed next to their mate are included; - a fragment is evaluated as Rsubread's process_line_buffer does: the later record first, Unmapped only if it and its mate are both unmapped, and duplicate / multi-mapped if either record is. Cross-chromosome pairs are paired in BAM order, so the sequential and the parallel path (any --threads) give the same pairs and the same gene counts. Known gap, documented in the featureCounts page: for supplementary records ordered R2, other, R1, R1-supplementary Rsubread pairs by the previous record, so dupRadar's duplication matrix can differ by +-1 for that gene. Counts and summary are unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rhassaine
force-pushed
the
fix/featurecounts-read-selection-v3
branch
from
November 27, 2026 15:04
9352289 to
e6a0e01
Compare
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.
Makes featureCounts-style counting and dupRadar's paired-end counting select and pair records like Subread:
/, unmapped self or mate as -1/0), whatever their direction;--threads.Unit tests built from hand-written SAM records cover supplementary, QC-fail, secondary with NH, and split vs sequential pairing. No nf-core RNA test BAM has supplementary or QC-fail records, so there's no new test data (see the note in the test module).
Checked against featureCounts 2.1.1 and Rsubread 2.20.0 / dupRadar 1.38.0 on a copy of the chr6 test BAM with secondary, supplementary and QC-fail records added: 0 differences in counts and summary at
--threads1, 2 and 6. Outputs on 8 public datasets are unchanged.One known gap, documented on the featureCounts page: for a fragment whose records come in the order R2, other, R1, R1-supplementary, Rsubread pairs each record with the one just before it, so dupRadar's duplication matrix can shift by one for that fragment's gene. It doesn't occur in STAR output or the nf-core test data.
🤖 Generated with Claude Code