Repository navigation
Add a mapping-only mode to the labeled aligner - #692
Merged
Merged
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Base automatically changed from
fix/annotation-buffer-dangling-refs
to
master
October 28, 2026 21:46
adamant-pwn
force-pushed
the
feat/align-map-only
branch
from
October 28, 2026 21:46
e64371a to
83df0ca
Compare
LabeledAligner::map_batch finds and label-filters seeds exactly as for alignment (including min_exact_match), but does not extend them. For each query it reports the labels whose seeds cover the most query characters on the better strand, with the number of covered characters and the query range they span. This is enough for accept/reject decisions on reads at a fraction of the cost of alignment. metagraph align --align-map-only (requires -a, TSV only) prints one line per query: header, strand, labels, covered characters, query begin and end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adamant-pwn
force-pushed
the
feat/align-map-only
branch
from
October 28, 2026 21:48
83df0ca to
2fc28b6
Compare
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.
Stacked on #690. Review only the top commit, "Add a mapping-only mode to the labeled aligner"; this PR will be retargeted to master after #690 merges.
What
LabeledAligner::map_batch:build_seeders/filter_seeds, includingmin_exact_match), but does not extend them;This supports read accept/reject decisions (e.g. adaptive sampling) that need the label, not a base-level alignment.
The CLI option
metagraph align --align-map-onlyis opt-in and off by default. It requires-aand supports TSV output only, one line per query:Nothing changes in the default
alignpath.Test
LabeledAlignerTest.MapWithoutExtension, typed over all 7 graph/annotation pairs, covers:7/7 pass locally (assertion-enabled build, filtered run only).
Numbers (benchmark harness
bench/align-harness, modemap; 24 bacterial genomes, k = 31, CANONICAL, labeled, seed 19)Single-threaded, per read, alignment vs.
map_batchon the same reads. The aligned and negative-accepted fractions are identical by construction (same seed filter).min_exact_match0min_exact_match0Multi-threaded CLI,
-p 8, 945 long reads (median wall, peak RSS):align, seed 19align --align-map-only, seed 19No regression in
align, this PR vs its base, interleaved repeats; output checksums are identical in all three configurations:The seed-19 spread is 42–49 s on both sides, plus one 68 s outlier on this PR's first repeat.
🤖 Generated with Claude Code
Summary by cubic
Adds a mapping-only mode to the labeled aligner that reports the best-supported label per query without extending seeds into alignments. This supports read accept/reject decisions (e.g., adaptive sampling) that need a label rather than a base-level alignment.
LabeledAligner::map_batchfinds and label-filters seeds exactly as alignment does — includingmin_exact_match— but does not extend them. For each query it reports the labels whose seeds cover the most query characters on the better strand, the number of covered characters, and the query range they span on the forward query. The newmetagraph align --align-map-onlyflag is off by default, requires-a, and rejects--jsonoutput; it emits one TSV line per query (header,strand,labels,covered_chars,query_begin,query_end), with unmapped queries reported asheader * * 0 * *. The defaultalignpath is unchanged.Tests
LabeledAlignerTest.MapWithoutExtensioncovers full coverage by one label, a split query where the larger coverage wins, and an unmapped query, across all graph/annotation pairs.Benchmarks
map_batchcuts per-read p50 latency by ~1.5–5× with top-1 label accuracy within ~1–3 percentage points of alignment.Written for commit 2fc28b6. Summary will update on new commits.