Repository navigation
B2: 5' homogeneity as the Simpson index of mature-arm starts - #13
Merged
Merged
Conversation
Star and loop reads must not change 5' homogeneity of a 3'-arm miRNA; the value is the unbiased Simpson index of mature-arm 5' starts, whatever the first base, blank with fewer than 2 mature-arm reads. Mark B2 in progress. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
reads_by_arm() assigns reads to arms by miRDeep2's rule for both arm_counts() and five_prime_features(). The Pomonella and FAW tests compare homogeneity with output.mrd until B8 rebuilds the training data; the tutorial's expected output is regenerated (homogeneity 0.988 -> 0.981, label unchanged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…otes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TejusK123
added a commit
that referenced
this pull request
Oct 19, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
B2: 5' homogeneity, the unbiased Simpson index of the mature-arm 5' starts
The bug (from the review). 5' homogeneity divided the reads that start where the most abundant read starts by every read that starts no more than 20 nt after it. When the mature is on the 3' arm, the star and loop reads start upstream, so they entered the denominator and pulled the value down. That is the case for 1,585 of the 2,907 training loci. The manuscript's description ("top n permutations") matched neither the old code nor the new.
The new definition (Tejus, Q2, 18 Oct 2026). The unbiased Simpson index of the 5' start positions of the reads that miRDeep2 assigns to the mature arm, the same reads as result.csv's
mature_read_count: sum n_i(n_i - 1) / (N(N - 1)). It is the probability that two mature-arm reads start at the same nucleotide.num_locisis unchanged. The column name stays the same until B5, because the model selects features by name.Code
mrd.py:reads_by_arm()assigns each read to an arm by miRDeep2's rule and is now shared byarm_counts()andfive_prime_features().five_prime_features()takes the whole locus, because it needs theexpline.folding_properties.py: passes the locus.Tests (written first; all failed before the fix)
tests/test_five_prime_pipeline.py: the acceptance test. Adding star and loop reads to a synthetic 3'-arm miRNA leaves homogeneity unchanged; before the fix, it dropped from 0.90 to 0.70.tests/test_mrd.py: the index worked out by hand; reads outside miRDeep2's mature window don't count; a mismatched first base counts at its position; blank with fewer than 2 mature-arm reads.num_locismust still equal the training rows.xgboost_judgement.csvwas regenerated with the pipeline. Its homogeneity goes from 0.988 to 0.981 and the label stays Confident.Checks
reanalysis.pyontraining_data_pre/: identical toreview/reanalysis_osx-arm64.txt. The training data are not rebuilt until B8; the reference differs fromreanalysis_baseline.txtby up to 0.01 in the XGBoost rows, as before.reanalysis.pyon a scratch copy with only homogeneity recomputed: XGBoost accuracy is 0.864 in random splits (unchanged) and 0.818 leave-one-species-out (0.812 before). That is within noise.review/homogeneity_measures.py(new) compares the candidate measures on the training loci; its output isreview/homogeneity_measures.txt. METHODS_CHANGES.md (B2) cites these numbers: old and new Methods text, and the reasons for the choice.Results. Locally, with the testing folder: 139 passed. CI: see the checks below.
🤖 Generated with Claude Code