8000 add a --meth CI test and document two scoring details by nh13 · Pull Request #4 · nh13/minibwa · GitHub
[go: up one dir, main page]

Skip to content

add a --meth CI test and document two scoring details - #4

Draft
nh13 wants to merge 3 commits into
masterfrom
chore/meth-cleanups
Draft

nh13 wants to merge 3 commits into
masterfrom
chore/meth-cleanups

Conversation

@nh13
@nh13 nh13 commented Jun 25, 2026
Copy link
Copy Markdown
Owner

Recreated from lh3/minibwa#19, which Heng closed unmerged on 2026-06-22.
Heng's closing rationale: (closed silently, no comment)
Recreated as a draft in this fork (nh13/minibwa) for continued development and review.
Note: a deep review confirmed this branch is based on top of the current (post-meth4) methylation code — all three cleanups still apply to current master and merge cleanly.


Three small --meth-related changes. No change to alignment output.

1. Add a bisulfite alignment test to CI. build.yml previously only built (plus api-test), with no functional coverage — so the recent 3-letter → 4-base meth rewrite had no regression net. test/test-meth-align.sh bisulfite-converts the bundled chrM reads (R1 C→T, R2 G→A), maps them with --meth, and asserts they align with low edit distance (mean NM < 2) and clearly beat plain mapping of the same converted reads (a regression to the non-meth path would spike NM and fail the test). Wired into the build workflow.

2. Document the conversion-strand flip in mb_align1_inv. Replaces the // TODO: check if this is correct at align.c:775 with a comment. The flip is correct: mt is the read's base conversion (the same value mb_align1 receives and flips locally per segment), and the inverted segment maps to strand !r1->rev, so flipping when !r1->rev mirrors the established mb_align1 / mb_matesw_core convention of flipping mt whenever the aligned segment is reverse. Verified empirically: across 555,050 holodeck chr17 em-seq alignments, NM is 0–2 for 99.18% and never exceeds 10 — a wrong-strand bisulfite alignment would spike NM to 30–70.

3. Note that b_ts is unset by default. opt->b_ts (transition mismatch penalty) has no CLI flag and is never initialized (unlike b_ambi), so it stays 0 and the transition branch in ksw_gen_nt4_mat is inactive unless set programmatically. Documented in minibwa.h so the field isn't mistaken for a live knob.

nh13 added 3 commits June 18, 2026 22:54
CI previously only built (make + api-test) with no functional coverage, so the
3-letter -> 4-base meth rewrite had no regression net. test/test-meth-align.sh
bisulfite-converts the bundled chrM reads, maps them with --meth, and asserts
they align with low edit distance (mean NM < 2) and clearly beat plain mapping
of the same converted reads (a regression to the non-meth path would spike NM
and fail). Wired into the build workflow.
Replaces the "TODO: check if this is correct" on the mt flip. The flip is
correct: mt is the read's base conversion (the same value mb_align1 receives
and flips locally per segment), and the inverted segment maps to strand
!r1->rev, so flipping when !r1->rev mirrors the mb_align1 / mb_matesw_core
convention of flipping mt whenever the aligned segment is reverse.

Verified empirically: across 555,050 holodeck chr17 em-seq alignments, NM is
0-2 for 99.18% of reads and never exceeds 10; a wrong-strand bisulfite
alignment would spike NM to 30-70.
opt->b_ts has no CLI flag and is never initialized (b_ambi is, in options.c),
so it stays 0 and the transition branch in ksw_gen_nt4_mat is inactive unless
set programmatically. Document this so the field is not mistaken for a live
knob, and note that meth mode forces the C>T/G>A cell to a match via mt
regardless of b_ts.
@nh13 nh13 added the feature review vehicle for a manifest feature; never a merge vehicle label Aug 3, 2026
@nh13
nh13 commented Sep 4, 2026
Copy link
Copy Markdown
Owner Author

@coderabbitai pause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature review vehicle for a manifest feature; never a merge vehicle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0