Correct entropy state, motif ownership, and regional statistics - #712
Open
SuhasSrinivasan wants to merge 14 commits into
Open
Correct entropy state, motif ownership, and regional statistics#712SuhasSrinivasan wants to merge 14 commits into
SuhasSrinivasan wants to merge 14 commits into
Conversation
This was referenced Aug 11, 2026
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.
Review status: Author-reviewed and ready for ONT review.
Summary
This PR consolidates the related entropy correctness fixes into one review surface:
All changes are confined to entropy state construction, motif/window ownership, and regional statistics. No threshold, CRAM, probability-sampling, DMR, or output-schema changes are included.
Severity
High — scientific correctness, statistical accuracy, and output integrity.
Affected accepted inputs can silently omit or duplicate motif anchors, report invalid window coordinates, pair incompatible anchors, omit valid singleton regions, or emit plausible but incorrect medians. Valid ten-state analyses can abort and leave incomplete output.
Bugs and corrected behavior
(position, strand, base)anchors form a deterministic unionu32-backed typed symbols support the tested 9/10/12/17-state alphabetsf32::total_cmpbefore the existing interpolationThe statistics fix does not mutate encounter order, window/read alignment, read counts, success/failure counts, mean, minimum, or maximum.
Implementation
EntropySymbol(u32)reserves explicit canonical and filtered/wildcard states; compact modification IDs remain deterministic.Testing
Tested exact revision:
3bfce607ffcf91217d7697c5ea1c387ad5d0eb0fTree:
965621babdba8c49890891a2155548d233a0c41aPlatform/toolchain: macOS arm64; rustc/cargo 1.90.0;
rust-htslib0.46.0 andhts-sys2.2.0.a58b12803513e46fe62df518c33db75fd7471dcb9fc7482ec3a69cf1aaabc9c3.e549001d7573f4586750a0496931e3a87bbad0672bd0aca30f6d3c7524e4c30e.log2(10)with 10 accepted reads.--forceall fail before creating or truncating output.git diff --check, targetedrustfmt --check, clean-worktree, ancestry, and Cargo.lock checks passed.Bioinformatics review independently verified singleton, median, anchor ownership, partner-bijection,
log2(K), wildcard-mass, and ordering invariants. Exact-head Rust review verified representation, bounded streams, preflight/failure ordering, and preservation of both source test suites. No blocker remained.Output compatibility
Reviewer guide
EntropySymboland wildcard matching inmethylation_entropy.rs.entropy/mod.rs.entropy/subcommand.rs.cargo test -p mod_kit entropy --lib -- --test-threads=1,cargo test -p modkit --test test_entropy_geometry -- --test-threads=1,cargo test -p modkit --test test_entropy_state_cardinality -- --test-threads=1, andcargo test -p modkit --test test_entropy_region_statistics -- --test-threads=1as focused canaries.Non-goals