docs(star-align): ultra-detailed comments on the window model, extension and stitching - #16
docs(star-align): ultra-detailed comments on the window model, extension and stitching#16BenjaminDEMAILLE wants to merge 3 commits into
Conversation
…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>
863f197 to
fdb9580
Compare
|
Self-review of the stack turned up two wrong claims in this PR; both are fixed in the follow-up commit.
|
Stack 4/5, on top of #15. Comments only; no code, no behavior, no output bytes changed.
extendAlignas local alignment without a matrix, and the include/exclude tree institchWindowAlignswith its pruning.stitchAlignToTranscriptmakes: read gap vs genome gap is what the gap is.Gate green (
scripts/check.sh).