Repository navigation
Support migrations in keep_intervals, delete_intervals, and trim - #1129
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1129 +/- ##
=======================================
Coverage ? 93.70%
=======================================
Files ? 26
Lines ? 21470
Branches ? 904
=======================================
Hits ? 20118
Misses ? 1314
Partials ? 38
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
Thanks @jeromekelleher. #1131 looks good to me, I added one small comment about documenting the sorting of the migration table, to be consistent with the other tables' documentation |
|
@awohns, this is ready to pick up again I think. We've merged support for sorting migrations. |
7b7eebe to
7575104
Compare
fbda6ea to
cc1b874
Compare
|
Ok, I've rolled back my C changes to sort and tests pass so I think this is ready for review! |
|
@hyanwong, can you have a quick look over this please to see if there's anything we've missed? |
| 2D numpy array with shape (N, 2), where N is the number of intervals. | ||
| :param bool simplify: If True, run simplify on the tables so that nodes | ||
| no longer used are discarded. (Default: True). | ||
| no longer used are discarded. Must be ``False`` if input tree sequence |
There was a problem hiding this comment.
I guess this is only because simplify itself does not support migrations? So should we note to change this when #20 is fixed? Perhaps we should add a test of trim() with simplify=True on a ts with migrations, that is currently expected to fail, and comment at the top of the test that once it starts passing, we need to change the docs?
| if (np.min(self.migrations.left) < np.min(self.edges.left)) and ( | ||
| np.max(self.migrations.right) > np.max(self.edges.right) | ||
| ): | ||
| raise ValueError( |
There was a problem hiding this comment.
What can't we do this? I mean, we'd lose those migrations, right? But should we just issue a warning? Or instead should we tell the user how to work around it, e.g. "this would lose information, so you have to deliberately remove migrations outside the trimmed regions using delete_intervals([[trim_left, trim_right]]) first"?
I don't know much about migrations, but this looks like a simple change to me. 2 very minor comments above. I guess I don't need to approve or anything, though. |
cc1b874 to
4a3567b
Compare
Description
Adds support for running
keep_intervals,delete_intervals, andtrimon tree sequences that contain migrations. I've modified the python api for these functions to support migrations and written some tests. However,keep_intervalscallssort, and my implementation of sorting the migration table isn't worked out yet, I would appreciate any pointers, so to speak!Addresses the following issues
Closes #1128. If sorting the migration table is worked out, would close #22, and could be modified to address #117