Repository navigation
fix(sam): paired-end nM is the pair's mismatch total, as in STAR - #294
Closed
BenjaminDEMAILLE wants to merge 1 commit into
Closed
BenjaminDEMAILLE wants to merge 1 commit into
BenjaminDEMAILLE wants to merge 1 commit into
Conversation
STAR writes nM per pair, like AS: both mates carry the sum of their mismatches. rustar-aligner wrote each mate's own count (5 and 4 where STAR writes 9). NM stays per mate. On 2M ERR188021 pairs vs chr21, paired records with the same alignment as STAR 2.7.11b: 247,069 nM mismatches before, 356 after (all pairs whose other mate aligns differently). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 8, 2026
Collaborator
|
PE nM = pair total landed in #307 |
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.
Follow-up to #293, where this divergence came up.
Problem
For a pair, STAR writes
nMper pair, as it does forAS: both mates carry the sum of the two mates' mismatches. rustar-aligner wrote each mate's own count:Change
build_paired_mate_record(src/io/sam.rs) writestranscript.n_mismatch + mate_transcript.n_mismatchfornM. Nothing else changes:NMis still per mate. It is an edit distance computed from the mate's own CIGAR, and STAR computes it per mate as well.n_mismatchvalues on the transcripts are untouched, so the mismatch filters and fix(quant): filter TranscriptomeSAM pairs as a unit, like STAR (#292) #293's pair budget still see per-mate counts.Results
Same data as #293: the first 2M pairs of ERR188021 against chr21 + GENCODE v44 chr21, with a STAR 2.7.11b index. Each paired record is matched to STAR's on (read, mate, position, CIGAR, mate position), secondaries included:
nMequal to STARnMdiffersI checked a sample of the 356 that still differ. In each case the other mate aligns differently (for example, it is spliced in STAR and not in rustar), so the pair's mismatch count legitimately differs.
Tests
test_build_paired_mate_record_per_mate_tagsandtest_build_paired_mate_record_mate_fieldsasserted the old per-matenM; they now assert the pair total. Mate1 in the first test now has 1 mismatch so that the sum differs from either mate's own count.cargo test --releaseandcargo clippy --all-targetspass.🤖 Generated with Claude Code