Correct entropy regional medians and singleton summaries - #710
Closed
SuhasSrinivasan wants to merge 3 commits into
Closed
Correct entropy regional medians and singleton summaries#710SuhasSrinivasan wants to merge 3 commits into
SuhasSrinivasan wants to merge 3 commits into
Conversation
Contributor
Author
|
This completed regional-statistics fix is now consolidated into #712 with the related entropy state and motif/window ownership corrections. The exact combined head was independently reviewed, formatted, and passed the full serial workspace gate (212 passed, 14 ignored, 0 failed). Closing this duplicate review surface so entropy can be reviewed in one PR. |
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.
Fixes #682.
Summary
Severity
Severity: High — scientific and statistical accuracy
Rationale:
entropy --regionscan exit successfully while omitting a valid singleton region or reporting a plausible but incorrect median for ordinary unsorted genomic-order values. The output itself does not reveal the statistical error.Root cause
Entropy-local
DescriptiveStats::newpassed every nonempty measurement slice directly to the shared percentile helper. That helper intentionally requires at least two observations and assumes its input is already sorted. Regional entropy values arrive in genomic encounter order, not numeric order.Implementation
f32::total_cmp, then call the unchanged linear-interpolation helper.The production change is seven entropy-local lines. Tests-first, production, and expanded CLI/permutation coverage remain separate commits.
Preserved behavior
Non-goals
entropymotif rows depend on window boundaries and overlapping motifs can collapse incompatible strand pairs #681/entropyaborts on valid inputs with ten or more modification states #683 geometry, ownership, or state-cardinality handling.Behavior before and after
[0.75, 0.25, 0.50]in genomic order[0.25, 0.50, 0.75][0.75, 0.00, 0.25, 0.50]Testing
Test environment
7e5050c13ac13a3c6614f532485c45145f253228556d905849c1a3544440a1f70bd11e04f973a3cb; clean after testing5cecc3fb3a9336068d9e3c68d5c08d678153dd2cCargo.lockSHA-256f9d3389f8fc63c9ad653dad3fbf43a1c26cc54008f0a39e06e71ff6455a1e9b5;rust-htslib0.46.0,hts-sys2.2.0PercentileNotEnoughDatapoints(1)and installed CLI leaves the region file empty; unsorted odd/even inputs report 0.25/0.125 instead of 0.50/0.375cargo test -p mod_kit entropy::entropy_mod_tests --lib -- --test-threads=1cargo test -p modkit --test test_entropy_region_statistics -- --test-threads=1a58b12803513e46fe62df518c33db75fd7471dcb9fc7482ec3a69cf1aaabc9c3cargo test -p modkit --test test_entropy -- --test-threads=1TMPDIR=/private/tmp/modkit-tmp-entropy-regional-statistics cargo test --workspace --all-targets -- --test-threads=1rustfmt --check;git diff --check upstream/master...HEAD.rustfmt.tomlrequests nightly-only options and untouched files also differTests not performed
Scientific validation
Output and compatibility
Reviewer guide
entropy --regionsomits singleton summaries and computes medians from genomic rather than value order #682 and the seven-lineDescriptiveStats::newchange.f32::total_cmp.cargo test -p mod_kit entropy::entropy_mod_tests --libandcargo test -p modkit --test test_entropy_region_statistics.Checklist