fix(sketch): wire piscem hit positions into sketch mappings#1022
Merged
Conversation
Sketch (pseudoalignment) mappings were constructed with ref_pos=0, fw_pos=-1,
rc_pos=-1, read_len=0 — discarding the positions piscem already computes in
SimpleHit (pos / mate_pos / fragment_length). Consequences:
- `--sketch --writeMappings` wrote POS=1 (i.e. ref_pos 0) for every record;
- `--sketch` with --seqBias/--gcBias collected bias context from position 0 of
every transcript (a positionally-degenerate, meaningless model);
- the orphan/single-end ambiguous-fragment FLD term could not fire in sketch
mode (it keys on fw_pos/rc_pos).
Populate ref_pos / fw_pos / rc_pos / read_len / r1_pos / r2_pos from the hit's
approximate positions, mirroring selective alignment's conventions: single-end
and orphans use the mate's leftmost (ref_pos = orientation-aware 5' end), and a
concordant pair uses the fragment 5' START / 3' END for the positional models.
These positions are approximate (k-mer-anchor: ref_pos - read_pos), which is
inherent to sketch mode.
Sketch quant.sf is unchanged on concordant data (positions don't alter eq-class
membership); SAM POS is now realistic (e.g. 17/149 with TLEN 183, 2298 distinct
positions vs 1 before); sketch+bias is now position-aware. Full workspace tests
+ clippy green; real-data sketch mapping rate stable.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B7JMur5DmDpECddErpi2JS
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B7JMur5DmDpECddErpi2JS
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.
Sketch mappings discarded the positions piscem already computes (SimpleHit.pos/mate_pos/fragment_length), so
--sketch --writeMappingswrote POS=1 for every record, sketch bias collected from position 0 (degenerate), and the orphan ambiguous-fragment FLD term couldn't fire.This wires ref_pos/fw_pos/rc_pos/read_len/r1_pos/r2_pos from the hit positions (approximate k-mer-anchor coords), mirroring selective-alignment conventions.
Validation: sketch quant.sf unchanged on concordant data (positions don't alter eq-classes); SAM POS now realistic (17/149, TLEN 183, 2298 distinct vs 1); sketch+bias now position-aware; full workspace tests + clippy green; real-data sketch mapping rate stable (~92.6%).
🤖 Generated with Claude Code