Skip to content

Speed up bar's base aligners: pecan, minipoa and abPOA - #2026

Merged
glennhickey merged 6 commits into
masterfrom
pecan-speedup
Oct 4, 2026
Merged

glennhickey merged 6 commits into
masterfrom
pecan-speedup

Conversation

@glennhickey

@glennhickey glennhickey commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Speeds up all three of bar's base aligners, makes minipoa as accurate as abPOA, and makes pecan practical again for progressive alignment. The default aligner does not change (<bar baseAligner="abpoa">), and abPOA's output is identical to before.

bar on 8 Mb of human/mouse, 8 threads evolver mammals (mafComparator)
abPOA (default) 59 s, 6.9 GB → 51 s, 5.5 GB 0.853 / 0.652, unchanged
minipoa 29 s, 3.1 GB → 12 s, 4 GB (new defaults) 0.846 / 0.646 → 0.854 / 0.652
pecan 26 s, 0.5 GB 0.859 / 0.654 → 0.869 / 0.666

pecan: cPecan master (55920ef, ComparativeGenomicsToolkit/cPecan#9)

  • Exact probability-space forward-backward, 5–11× faster per pairwise alignment. Large unanchored chunks are recomputed in blocks rather than held (3.9 GB → 116 MB for a 10 kb pair). Array-based progressive MSA: same output, 2× faster, half the memory.
  • In-process seed anchoring, now shipped as <pecan anchorMethod="seed">. The old MUM anchors accept "unique" matches of about a dozen bases; at 0.3 substitutions per site per branch, half of them are off the true alignment. That, not the HMM, is why pecan degraded on deep branches.
  • <bar deepAligner deepAlignerDivergence> can switch the deepest ancestors to pecan. It is off by default.
  • On evolver-like inputs pecan still spends about twice abPOA's CPU in bar.

minipoa: cactus-integration (d8050a1, ComparativeGenomicsToolkit/minipoa#2)

  • Speed, with identical output: vectorised horizontal-gap scan; DP scratch kept across windows (it was 49 M page faults); a better-centred band; gap states stored in 16 bits (vertical) and 2 bits (horizontal); matrices written with streaming stores.
  • Accuracy: an optional convex gap (minipoaGapOpenPenalty2/minipoaGapExtensionPenalty2), and the guide tree fixed (below 8 sequences it kept the input order). <minipoa> now ships abPOA's convex gaps (400/30 + 1200/1) with the guide tree on.
  • last-train writes its trained single gap into minipoa and turns the second piece off.
  • Includes ofirr's fix for the "backtrack found no predecessor" crash (Fix traceback at the end row: "backtrack found no predecessor" minipoa#1), ported to the convex traceback.

abPOA: ComparativeGenomicsToolkit fork, main (36110ac, ComparativeGenomicsToolkit/abPOA#12)

  • The submodule URL changes from yangao07/abPOA to ComparativeGenomicsToolkit/abPOA. The pinned commit is upstream's current main, which aligns identically to the v1.5.6 we had, plus one change: each DP row stores only its band, packed together, instead of the full query width.

bar

  • Aligning only the dominant end is now taken only when no adjacency exceeds bandingLimit; it allowed twice that, leaving the far part of such adjacencies unaligned.
  • The log line names pecan's anchor method. New evolver tests run pecan on primates and mammals.

Updating an existing clone

The abPOA URL changed, so after pulling run git submodule sync && git submodule update --init --recursive, or the update will look for the new commit upstream and fail.

Testing

  • Identical output where claimed. abPOA and minipoa (with its old settings) match their previous versions on simulated truth sets, on bar's 8 Mb human/mouse output, and on evolver.
  • abPOA was also compared across all three gap models and local/extend/global modes (305 comparisons), and passes its own tests/run_all.sh.
  • Evolver mammals and primates for all three aligners, and bar's unit tests.
  • minipoa's DP was run under ASan/UBSan and independently reviewed cell by cell against a scalar reference.

Before merging

🤖 Generated with Claude Code

glennhickey and others added 4 commits September 27, 2026 19:53
Bumps cPecan to faster-pecan (12ce978): an exact, probability-space
forward-backward 5-11x faster per pairwise alignment that recomputes large
unanchored chunks in blocks instead of holding them (3.9GB -> 116MB for a 10kb
pair), an array-based progressive MSA (same output, 2x faster, half the memory),
and in-process seed anchoring.

The anchoring is what decides pecan's accuracy on deep branches.  The MUM anchors
bar used accept "unique" matches of a dozen bases, and at 0.3 substitutions per
site per branch half of them are off the true alignment and drag the banded dp
with them.  <pecan anchorMethod="seed"> is now shipped: lastz's recipe (spaced
seeds, ungapped extension, chaining) without a lastz process per alignment.
anchorMethod="mum" or "lastz" select the old ones; without the attribute
useMumAnchors decides as before.

Evolver mammals, mafComparator:  abpoa 0.853/0.652, pecan before 0.859/0.654,
pecan now 0.869/0.666, with bar taking 1-3s per ancestor against abpoa's 0-3s
(stock pecan 1-10s).  Evolver primates: abpoa 0.9973/0.9844, pecan 0.9977/0.9846.
8Mb of human/mouse: bar 26s/0.5GB against abpoa's 59s/6.7GB, aligning slightly
more of human to mouse.  On evolver-like inputs pecan still spends about twice
abpoa's CPU in bar, so baseAligner stays abpoa.

<bar deepAligner deepAlignerDivergence> use deepAligner for ancestors whose two
farthest children are at least that far apart in the scaled tree the workflow
already uses for its divergence settings.  Off by default (0); with branchScale 2,
0.5 picks the deepest 15% of the VGP 577-way's ancestors.

Fixes in bar: aligning only the dominant end is now taken only when no adjacency
is longer than bandingLimit -- it allowed twice that, leaving the far part of
such adjacencies unaligned; flowerAligner.c includes its own header, which shows
makeFlowerAlignment's definition had a parameter its declaration lacks.  The bar
log line names the anchor method.  New evolver tests run pecan on primates and
mammals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bumps minipoa to 0416daa (ai-optimization), which vectorises and streams its
DP, keeps its scratch between windows, centres its band better, adds an
optional convex gap, and fixes its guide tree below 8 sequences.

<minipoa> now ships the convex gap abpoa uses (400/30 and 1200/1, via the new
minipoaGapOpenPenalty2/minipoaGapExtensionPenalty2) and progressive mode on.
Evolver mammals: 0.846/0.646 -> 0.854/0.652, against abpoa's 0.853/0.652;
primates unchanged.  On 8Mb of human/mouse at 8 threads, bar takes 14s and
5.6GB against abpoa's 59s and 6.7GB (10s and 3.5GB with the second gap piece
off, where the old minipoa took 29s and 3.1GB for identical output).

last-train now turns the second piece off, so minipoa runs the trained single
affine model as trained.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
minipoa's DP now keeps two bits a cell for each horizontal gap state instead
of a 16-bit value, with alignments unchanged.  On 8Mb of human/mouse at 8
threads, bar with the shipped <minipoa> settings goes from 14s and 5.6GB to
12s and 4GB (abpoa: 59s and 6.7GB), and with a single affine gap from 10s and
3.5GB to 9s and 2.8GB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Points submodules/abPOA at ComparativeGenomicsToolkit/abPOA instead of
upstream yangao07/abPOA, at 6e02e17 (branch ai-optimization): upstream's
current main, which aligns exactly as the v1.5.6 we had, plus one change --
each DP row keeps only its band, packed next to the others, where every row
used to be stored at full query width.

Alignments are unchanged: bar's output on 8Mb of human/mouse is identical, as
is evolver mammals (0.8526/0.6521).  There, bar went from 59s and 6.9GB to 51s
and 5.5GB at 8 threads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
glennhickey and others added 2 commits October 2, 2026 13:23
The three aligner PRs are merged, so the submodules move from their
feature branches to the merge commits: cPecan master (55920ef, cPecan#9),
abPOA main (36110ac, abPOA#12) and minipoa cactus-integration (d8050a1,
minipoa#2).  cPecan's and minipoa's trees are the ones already tested.
minipoa now also has ofirr's fix for "backtrack found no predecessor"
(minipoa#1), ported to the convex traceback; the commit pinned before
got through those windows only by retrying them unbanded.  abPOA's main
adds upstream's v1.5.7 release metadata, none of it in the library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
So CI runs on the combined code.  master's 23 commits (last-train on by
default in the pangenome pipeline, minigraph penalties from its model,
the hal2vg build, guards against giant snarls) merge without conflicts.
Four files changed on both sides, in different places: the config (the
bar sections here; <poa>'s trained long-gap factor and <graphmap> on
master), last_scoring.py, evolverTest.py and the Makefile.  In
last_scoring.py master now scales the trained matrix and gaps together,
and that scaled model is what this branch hands minipoa, so minipoa's
trained scores stay consistent too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@glennhickey
glennhickey marked this pull request as ready for review October 2, 2026 17:28
@glennhickey
glennhickey merged commit 5bc9c04 into master Oct 4, 2026
1 check passed
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