Skip to content

Add positional weights to native gap-block batches - #8

Closed
mikessh wants to merge 2 commits into
feature/unit-histogram-fastpathfrom
feature/position-aware-gapblock
Closed

mikessh wants to merge 2 commits into
feature/unit-histogram-fastpathfrom
feature/position-aware-gapblock

Conversation

@mikessh

@mikessh mikessh commented Oct 10, 2026

Copy link
Copy Markdown
Member

Gap-block batch scoring currently accepts only one global substitution matrix. Add optional integer weights indexed by full sequence length, using the longer sequence as the symmetric positional frame. Equal-length scoring reduces to the original weighted substitution sum; omitted weights preserve existing behavior.

Matrix and count reducers share the same native cell. An exhaustive ball reducer returns all accepted reference rows without allocating a dense matrix. Exact exclusions, duplicate rows and reference order are preserved. Width, integer and overflow validation reject invalid tables. This does not introduce an indexed search or statistical calibration.

Validation: 121 installed-binary Python checks, 42 native oracle cells under UBSan, warning-free Sphinx build, independent review including negative-thread compatibility. Stacked on the histogram fast path; no release publication.

Co-Authored-By: Codex <noreply@openai.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Zero-weight tables can be falsely rejected as overflowing, and the canonical API reference is incomplete.

2 open findings
What changed in this PR

Adds positional weighting and exhaustive ball reduction to native gap-block scoring.

Changes:

  • Adds length-indexed positional weights to matrix and count scoring.
  • Adds ball_batch without dense matrix allocation.
  • Adds validation, documentation, and correctness tests.
File Description
src/​gapblock.cpp Implements weighted scoring and ball reduction.
src/​_bindings.cpp Exposes native APIs to Python.
python/​seqtree/​gapblock.py Adds validation and public wrappers.
include/​seqtree/​seqtree.hpp Declares the expanded C++ API.
docs/​gapblock.rst Documents weights and ball behavior.
tests/​python/​test_gapblock_position_weights.py Tests scoring, reducers, and validation.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/gapblock.cpp Outdated
gap_prior: GapPrior | None = None,
alphabet: str = "aa",
threads: int = 0,
position_weights_by_length=None,
Co-Authored-By: Codex <noreply@openai.com>
@mikessh

mikessh commented Oct 11, 2026

Copy link
Copy Markdown
Member Author

Superseded by the consolidated seqtree 1.1.0 release PR #13; its implementation and validation are retained there.

@mikessh mikessh closed this Oct 11, 2026
@mikessh
mikessh deleted the feature/position-aware-gapblock branch October 11, 2026 20:41
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.

2 participants