-
Notifications
You must be signed in to change notification settings - Fork 79
Add individual parent checks #1192
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1192 +/- ##
==========================================
+ Coverage 92.52% 93.72% +1.19%
==========================================
Files 10 26 +16
Lines 11643 21507 +9864
Branches 0 904 +904
==========================================
+ Hits 10773 20157 +9384
- Misses 870 1312 +442
- Partials 0 38 +38
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
049d301 to
dd8ff23
Compare
jeromekelleher
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, but I don't think we need to check for ordered individuals in simplify. We should relax the requirement and put in a test (in Python) to verify that we can successfully simplify with unordered parents.
dd8ff23 to
2ea5d2f
Compare
c/tskit/tables.c
Outdated
| k < individuals.parents_offset[j + 1]; k++) { | ||
| if (individuals.parents[k] != TSK_NULL | ||
| && individuals.parents[k] >= (tsk_id_t) j) { | ||
| ret = TSK_ERR_UNSORTED_INDIVIDUALS; |
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.
I suppose we might check that no individual is its own parent (even if we are not checking individual ordering).
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.
Could be a useful diagnostic. No good reason to be your own parent (unless people are being sloppy with the tables and want to fix things up at the end).
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.
I'll add a test for this, as this code already forbids it.
|
I realized we can check for loops reasonably easily: Edit: this is computationally terrible, since it traverses every possible path on the pedigree. I say we skip this check out figure out a smarter way. |
jeromekelleher
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.
Still needs some tweaks on testing simplify.
Doesn't parent-before-child rule out loops? |
Yes, sorry - never mind this. |
31219de to
4a2df5c
Compare
|
Ok, I've added the test for self-parentage and removed the simplify test that was doing nothing. Should be good to go. |
|
I was actually suggesting that we check for self parentage always (not just when checking for ordering). And, turns out that test I said wasn't testing anything actually was - it was testing whether simplify runs even if the individuals are unordered. I've just gone ahead and done those things; feel free to do whatever to this commit. |
|
@jeromekelleher I like @petrelharp 's addition here, more precise error messages are always a good thing. I think this PR is ready to go. |
|
OK, great! |
e7575b7 to
774f74a
Compare
Fixes #1137 by adding checks for individual reference integrity and ordering.