Skip to content

Add lazy bathalign, and --nofs to skip frameshift calibration - #15

Open
kevinmoran1988 wants to merge 1 commit into
TravisWheelerLab:mainfrom
kevinmoran1988:bathalign
Open

kevinmoran1988 wants to merge 1 commit into
TravisWheelerLab:mainfrom
kevinmoran1988:bathalign

Conversation

@kevinmoran1988

@kevinmoran1988 kevinmoran1988 commented Sep 5, 2026

Copy link
Copy Markdown

BATH dropped HMMER's hmmalign driver but kept the whole tracealign engine (tracealign.c, p7_tracealign_*) compiled into libhmmer.a. bathalign is a 288-line driver over that existing engine -- no new alignment code. Alphabet-generic, as the engine is; BATH3/f is a superset of HMMER3/f, so it reads both .bhmm and .hmm. Amino output is byte-identical to HMMER 3.4 hmmalign across --mapali, --outformat, --trim, and Stockholm and afa output, for models from bathbuild and hmmbuild alike. Note that bathbuild itself is amino-only, so non-amino models must come from hmmbuild.

c2ba68e made frameshift tau calculation unconditional and dropped --fs, but left the gating in place: evalues.c still guards FS3/FS5 on cfg_b->fs and p7_hmmfile.c still guards the header lines on hmm->fs. --nofs re-exposes that switch against the new default.

Alignment never reads the frameshift stats, so for a model built to be aligned against, the calibration is pure waste -- and it is more than half of bathbuild's runtime. Where the model exists only for alignment, building it dominates the cost of aligning.

400 dipteraODB12 alignments, serial, 3 runs each, in seconds:

full 43.83 / 43.32 / 43.38
nofs 15.26 / 15.50 / 15.57

A --nofs model is byte-identical to a full one apart from the omitted FS3/FS5 STATS and FRAMESHIFT PROB lines, and gives identical bathsearch results when --fs/--fsonly are not used. When they are, bathsearch fails cleanly on the unset stats rather than mis-scoring.

BATH dropped HMMER's hmmalign driver but kept the whole tracealign engine (tracealign.c, p7_tracealign_*) compiled into libhmmer.a. bathalign is a 288-line driver over that existing engine -- no new alignment code. Alphabet-generic, as the engine is; BATH3/f is a superset of HMMER3/f, so it reads both .bhmm and .hmm. Amino output is byte-identical to HMMER 3.4 hmmalign across --mapali, --outformat, --trim, and Stockholm and afa output, for models from bathbuild and hmmbuild alike. Note that bathbuild itself is amino-only, so non-amino models must come from hmmbuild.

c2ba68e made frameshift tau calculation unconditional and dropped --fs, but left the gating in place: evalues.c still guards FS3/FS5 on cfg_b->fs and p7_hmmfile.c still guards the header lines on hmm->fs. --nofs re-exposes that switch against the new default.

Alignment never reads the frameshift stats, so for a model built to be aligned against, the calibration is pure waste -- and it is more than half of bathbuild's runtime. Where the model exists only for alignment, building it dominates the cost of aligning.

400 dipteraODB12 alignments, serial, 3 runs each, in seconds:

full 43.83 / 43.32 / 43.38
nofs 15.26 / 15.50 / 15.57

A --nofs model is byte-identical to a full one apart from the omitted FS3/FS5 STATS and FRAMESHIFT PROB lines, and gives identical bathsearch results when --fs/--fsonly are not used. When they are, bathsearch fails cleanly on the unset stats rather than mis-scoring.
@kevinmoran1988

kevinmoran1988 commented Sep 5, 2026

Copy link
Copy Markdown
Author

As a further note, the MSV/Viterbi/Forward fits in p7_Calibrate() are dead weight for the same align-only case, and cost about as much again: over 400 dipteraODB12 alignments, --nofs is 15.4s and skipping the standard fits drops bathbuild runtime to 10.4s (1.5x) with bathalign producing identical alignments over the 400 tested dipteraODB12 genes.

I did NOT implement this here because it is a separate and riskier change. -- p7_Calibrate() has to leave evparam unset and p7H_STATS clear, and nothing currently checks p7H_STATS, so bathsearch would score against p7_EVPARAM_UNSET instead of failing.

Edit: The force push was just changing the commit description to match the edited conversation in the initial post.

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