Closed hyanwong closed 8 months ago
The updates across the GeneticInheritanceGraphLibrary and its tests focus on refining and enhancing the logic for genetic inheritance simulations. Key improvements include refactoring interval checks, introducing new named tuples for clarity, refining randomness in simulations, and ensuring accuracy in genetic relationship validations. These changes collectively aim to increase the library's efficiency, readability, and reliability in simulating genetic inheritance patterns.
Files | Change Summary |
---|---|
.../graph.py |
Refactored interval checks in to_tree_sequence method to directly iterate over iedges and enhanced error messaging. |
.../tables.py , tests/...util.py |
Introduced MRCAintervals and ComparablePositions named tuples, refined random_match_pos logic for inverted sequences, and updated random number generation to use rng . Improved handling of return values and added comments. |
tests/test_...util.py , tests/test_tables.py |
Adjusted method names and return types, enhanced assertions and checks for genetic simulations, including inversion handling and validation of parent-child relationships. |
šāØ To the code we hop and leap,
Through genetic puzzles deep.
With each change, we refine,
Ensuring logic does align.
In the warren, bright and wise,
Our code, like rabbits, multiplies.
šš¾
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Fixed and tidied for merge
There's a bug in the forward simulator where we manage to produce the following edges. All edges apart from the inversion should have parent_interval == child_interval:
This PR (not yet for merging) is trying to track down the bug. In particular, since the inversion is from 100-200, we shouldn't have a recombination breakpoint at 122 unless both parents 4 and 5 share the inversion in their history
It seems suspicious that the parent_left on the bad edge is 200, which is the right hand location of the inversion. I suspect there is some off-by-one problem in the recombination breakpoint calcs. Also these are the only two iedges with child == 170 which means that the child genome is only covered from 0..122 rather than 0..321 as it should be.
Summary by CodeRabbit