Phase B4a — ReferenceView (self-contained reference access) - #18
Merged
Conversation
…w) design First sub-stage of B4 (wire consumers onto the persisted index). A borrowed zero-copy ReferenceView over the Reference2bit section (base_at + decode_window, on-demand decode, no full-reference Vec), via ReferenceIndex::reference_view(). The shared reference-access foundation B4b (aligner DP window) and B4c (variants ref_base/pileup) need. Gated by decode==original over an N-bearing multi-contig reference. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…s) plan Single TDD task: a borrowed zero-copy ReferenceView over Reference2bit (base_at + decode_window) + ReferenceIndex::reference_view() + re-exports, gated by decode==original over an N-bearing multi-contig index. Reuses view.rs section/align_to helpers. Derived from spec 913b993. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… from the index A borrowed ReferenceView over the persisted Reference2bit section (base_at + decode_window, on-demand 2-bit decode mirroring CompressedDNA::base_at, no full-reference Vec), via ReferenceIndex::reference_view(). Gated by base_at/decode_window == the original reference over an N-bearing multi-contig index. The shared reference-access foundation B4b (aligner DP window) and B4c (variants ref_base) consume. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
First sub-stage of B4 (wire the consumers onto the persisted multi-contig index). B3b stored the 2-bit forward reference into the index (the
Reference2bitsection) but gave it no read path; B4a adds one.ReferenceView<'a>— a borrowed, zero-copy view over theReference2bitsection.base_at(global) -> u8decodes one ASCII base on demand (ambiguity bit →N, else 2-bit code → A/C/G/T), mirroringCompressedDNA::base_at;decode_window(start, end, &mut Vec<u8>)fills a bounded caller buffer (endclamped tolen). Obtained viaReferenceIndex::reference_view()(checkedalign_to, little-endian host, section-extent validation — same discipline asFmIndexView).&[u64]slices + a length (40 bytes), decoding only the windows a consumer asks for — no O(reference)Vec, preserving the persisted index's bounded-query guarantee.ref_base/ pileup) consume — after B4a they read the reference from the.idxalone, no separate--referenceFASTA.Scope: the reader only. Deferred: wiring it into the aligner (B4b) and into
variants/pileup (B4c).Test plan
base_at(i)over the whole reference, anddecode_windowover several ranges (boundary-spanning, N-bearing, full, and an over-range clamp case), are byte-identical to the originalindex.reference()over anN-bearing multi-contig index.ReferenceViewis a small borrow (size_of <= 64), not an owned copy.base_atreviewed byte-equivalent toCompressedDNA::base_at(ambiguity word/bit + 2-bit word/shift + 0/1/2/3 → A/C/G/T).cargo test— full suite green (151 lib tests + integration), 0 warnings,cargo fmt --all -- --checkclean, MSRV 1.72 (nodiv_ceil).Design spec:
docs/superpowers/specs/2026-05-27-phase-b4a-reference-view-design.md. Plan:docs/superpowers/plans/2026-05-27-phase-b4a-reference-view.md.🤖 Generated with Claude Code