Closed hyanwong closed 8 months ago
The recent updates to the GeneticInheritanceGraphLibrary introduce a comprehensive suite of enhancements aimed at improving genetic inheritance simulations. Key improvements include the validation of edge inputs, the ability to detect inversions, and enhanced interval handling. These changes are geared towards ensuring more accurate and efficient forward simulations by allowing direct operations on unfrozen tables and incorporating rigorous validation to maintain data integrity.
Files | Change Summary |
---|---|
GeneticInheritanceGraphLibrary/tables.py , tests/test_tables.py |
Added new imports (collections , logging , portion , sortedcontainers ), introduced new constants, methods for edge intervals, table operations, inversion detection, interval properties, copying, bitflag handling, row addition with validation, and MRCA region identification. Added test methods for various scenarios. |
tests/gigutil.py |
Modified __init__ method to take a use_validation parameter, added add_iedge_params method, updated add_inheritance_paths method, updated run method behavior, and modified find_comparable_points method to operate on tables . |
tests/conftest.py |
Renamed the fixture all_sv_types_gig to all_sv_types_no_re_gig , added a new fixture all_sv_types_re_gig , and made changes to node data and edge definitions in fixtures to reflect different genetic inheritance scenarios. |
Objective | Addressed | Explanation |
---|---|---|
Validate edges on add_row (#69) | ✅ |
In the library where genes intertwine,
A rabbit hopped in, with code so fine.
"Let's validate," it said with a cheer,
Edges and nodes, far and near.
🐇 With each leap, a bug it did fix,
Ensuring the genetics, a perfect mix.
In the world of code, it left its mark,
A tiny, wise, coding spark. 🌟
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?
@duncanMR - would you like to test whether the forward simulations in test_gigutil.py are faster with this PR? There are some perf stats in https://github.com/hyanwong/GeneticInheritanceGraphLibrary/issues/86. I guess you can run the cProfiler as described in https://github.com/hyanwong/GeneticInheritanceGraphLibrary/issues/86#issuecomment-1970029273 with the old (as of aeb87eb7a416074cd7bafff1d35d94049fcbbd43) and the new code?
Merging this now, as it contains a lot of useful stuff. We can revise the API later if need be
Major reworking of validation so that we can use find_MRCA on a set of tables without converting them to a GIG.
Should fix #69 and also speed up simulations because of #86 (reduce use of as_dict)
Summary by CodeRabbit