Skip to content

fix(sketch): wire piscem hit positions into sketch mappings#1022

Merged
rob-p merged 2 commits into
masterfrom
fix/sketch-positions
Jun 20, 2026
Merged

fix(sketch): wire piscem hit positions into sketch mappings#1022
rob-p merged 2 commits into
masterfrom
fix/sketch-positions

Conversation

@rob-p

@rob-p rob-p commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Sketch mappings discarded the positions piscem already computes (SimpleHit.pos/mate_pos/fragment_length), so --sketch --writeMappings wrote 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

rob-p and others added 2 commits June 19, 2026 20:09
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
@rob-p rob-p merged commit 15ee01b into master Jun 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant