-
Notifications
You must be signed in to change notification settings - Fork 78
Decapitate2 #2331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decapitate2 #2331
Conversation
|
Will update once #2302 iis merged. TODO: update changelog. |
Codecov Report
@@ Coverage Diff @@
## main #2331 +/- ##
=======================================
Coverage 93.26% 93.26%
=======================================
Files 28 28
Lines 26636 26642 +6
Branches 1213 1213
=======================================
+ Hits 24842 24848 +6
Misses 1762 1762
Partials 32 32
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
petrelharp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whew! Looks good!
Closes tskit-dev#2236
2ff1984 to
55c4def
Compare
|
Ready for final review @benjeffery, if you'd like to take a look. |
benjeffery
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Really nice testing here. I tried for a while to think of a case that wasn't covered and failed!
As a thought about the flags/population/metadata of new nodes, how come population is the only one that can inherit from the retained node? Sorry if you've explained elsewhere, but I don't see why that wouldn't be useful for flags and metadata. I also wonder why it is the child information that gets used, would it not be the deleted parent?
Good questions! Population is different here I think because, unless there is other information in the model, we'd assume that any genome (node) that exists along the edge will be in the same population as the child. Flags and metadata are different in that we're probably not making these kinds of assumptions about processes. Why it inherits from the child rather than the parent is because of the generally half-openness of intervals. The more I try to explain this, the weaker the reasoning is though... Maybe we should also default the population to -1, and file an issue to track adding functionality later to allow copying from the child or parent, like maybe something like: def decapitate, time, *, flags=None, population=None, metadata=None, copy_parent=False, copy_child=False):
"""
If flags, population or metadata are not specified and ``copy_parent`` is True, copy the value from the edge's
parent node (likewise for copy_child). If values are explicitly provided for any of the node fields, the field
in question will **not** be copied from the child/parent.
"""@petrelharp, any thoughts? |
|
I think you're right - defaulting to |
|
OK, opened a new issue to track this before 0.5 (#2334) as I can't bear updating this PR any more! |
Stacked on #2302.
Finally, decapitate fully implemented!
The testing is perhaps a bit overboard, but I had implemented all of this in #2240 and it seemed a waste to just throw it away.