Skip to content

docs(star-align): ultra-detailed comments on the window model, extension and stitching - #16

Open
BenjaminDEMAILLE wants to merge 3 commits into
docs/comments-indexfrom
docs/comments-align
Open

docs(star-align): ultra-detailed comments on the window model, extension and stitching#16
BenjaminDEMAILLE wants to merge 3 commits into
docs/comments-indexfrom
docs/comments-align

Conversation

@BenjaminDEMAILLE

@BenjaminDEMAILLE BenjaminDEMAILLE commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Stack 4/5, on top of #15. Comments only; no code, no behavior, no output bytes changed.

  • What a genomic window is and why grouping seeds before stitching is what makes the problem tractable (this is the structure whose loss caused D12).
  • Anchors vs repetitive seeds, the chromosome-boundary rule, the diagonal test in the overlap dedup, and why eviction drops the shortest non-anchor seeds.
  • extendAlign as local alignment without a matrix, and the include/exclude tree in stitchWindowAligns with its pruning.
  • The one decision stitchAlignToTranscript makes: read gap vs genome gap is what the gap is.

Gate green (scripts/check.sh).

@BenjaminDEMAILLE BenjaminDEMAILLE changed the title docs/comments align docs(star-align): ultra-detailed comments on the window model, extension and stitching Aug 5, 2026
BenjaminDEMAILLE and others added 3 commits August 5, 2026 12:23
…ndow model

Explain the part of the aligner that decides everything else: what a genomic
window is and why grouping seeds before stitching is what makes the problem
tractable (stitching is quadratic, so 50 seeds per window many times beats every
seed at once, which is what closed D12), why only low-multiplicity anchors may
open a window while repetitive seeds may only join one, why a window may never
straddle a chromosome boundary in the concatenated coordinate space, why the
flanks are padded, what the diagonal test in the overlap dedup actually means,
and why eviction drops the shortest non-anchor seeds rather than the oldest.

Also the Rust behind it: loop labels, enums as closed sets the compiler forces
you to handle, Drop as cleanup that cannot be forgotten on any exit path, and
why the tie-break comparison must never return Equal.

Comments only; no code, no behavior, no output bytes changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Explain the two operations every alignment is built from. extendAlign is local
alignment without a matrix: walk base by base, remember the best-scoring prefix,
which is what lets a mismatch be crossed when enough matches follow while a run
that never recovers is simply excluded; the mismatch budget grows with the
length already aligned and is capped in absolute terms.

stitchWindowAligns is a subset search over the window's seeds, explored as a
binary include/exclude tree, with a failed stitch returning a large negative
score so the whole subtree is pruned. That pruning plus seedPerWindowNmax is
what keeps an exponential search space affordable, and the fixed seed order is
what makes the winner among equals reproducible.

stitchAlignToTranscript makes one decision, spelled out: the relationship
between the read gap and the genome gap is what the gap is (mismatch, deletion,
intron with a motif check, insertion, or the unsequenced middle of a fragment).

Comments only; no code, no behavior, no output bytes changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The exclude-branch guard reads as if STAR's WA_Anchor==2 force-include were
live. It is not: WlastAnchor is an unsigned counter initialised to -1, so no
align is ever marked, as the note in stitch_pieces already records against an
instrumented STAR build. Say so where the guard is, and say why it is still
ported.

Window span said 'a few hundred kilobases'; with the default 64 kb bins, 9 bins
of anchor distance and 4 bins of flank each side it reaches ~1.1 Mb.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@BenjaminDEMAILLE

Copy link
Copy Markdown
Contributor Author

Self-review of the stack turned up two wrong claims in this PR; both are fixed in the follow-up commit.

  1. The exclude-branch guard in stitch_recurse was commented as if STAR's WA_Anchor==2 force-include were live. It is not, in STAR or here: WlastAnchor is an unsigned counter initialised to -1, so the update guard that would mark an align is unreachable and wa.anchor is only ever 0 or 1. stitch_pieces already records this, verified against an instrumented STAR build; the comment now says so where the guard is, and says why the condition is still ported.

  2. The window span said "a few hundred kilobases". With the defaults below it (64 kb bins, 9 bins of anchor distance, 4 bins of flank each side) a window reaches ~1.1 Mb, which is what the repo's own alignIntronMax note already says.

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