You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Individual.parents should be added to integrity checks #1137
We should check at least for reference integrity, i.e., that individual parent IDs are valid.
We should consider whether it's possible to detect inconsistencies in the data model, such that genetic information and pedigree information are inconsistent, and whether that is something we can detect during the integrity check. I suspect not, though, as we'd surely need to build the trees to detect any disagreements. See also #1136.
To check for inconsistencies, we'd have to assume something like diploidy, and that we have both nodes for each individual. If so, then every individual parent-child relationship must have at least one node parent-child relationship (since you get one copy of each chromosome from each parent). Then it's checkable on a single pass through the tables: initialize a vector of False for each individual.parent, then go through the edge table to see if the relationship validates it.
Oh, maybe I'm speaking too soon: suppose that individual A is a parent to B, who is a parent to C, D, and E. The nodes of A are A1 and A2, etcetera. Suppose C1 and D1 inherit B1, while E1 inherits B2. They all coalesce in A1. Then simplification would remove B2, but B would remain, so the individual parent-child relationship of B-E wouldn't be reflected in the tree sequence. It wouldn't be inconsistent either, but it seems potentially very tricky to figure out if it is consistent.
If instead C1 and D1 inherited the left half of B1 and the right half of B2, and E1 inherited the complement, then a similiar thing would happen except that B would retain both its nodes.
Thanks for thinking this through. I think it is too hard to spot that the pedigree is consistent in general. I think we could probably spot grosser things during simplify, like we have an edge (parent=1, child=0) and, node table says individual[0] = 0 and individual[1] =1, but the individual parents say parent[0] = 2 (or something). Basically, in the simplest possible case the edge and pedigree parents directly contradict each other.
Activity
jeromekelleher commentedon Jan 25, 2021
We should check at least for reference integrity, i.e., that individual parent IDs are valid.
We should consider whether it's possible to detect inconsistencies in the data model, such that genetic information and pedigree information are inconsistent, and whether that is something we can detect during the integrity check. I suspect not, though, as we'd surely need to build the trees to detect any disagreements. See also #1136.
petrelharp commentedon Jan 25, 2021
To check for inconsistencies, we'd have to assume something like diploidy, and that we have both nodes for each individual. If so, then every individual parent-child relationship must have at least one node parent-child relationship (since you get one copy of each chromosome from each parent). Then it's checkable on a single pass through the tables: initialize a vector of False for each individual.parent, then go through the edge table to see if the relationship validates it.
Oh, maybe I'm speaking too soon: suppose that individual A is a parent to B, who is a parent to C, D, and E. The nodes of A are A1 and A2, etcetera. Suppose C1 and D1 inherit B1, while E1 inherits B2. They all coalesce in A1. Then simplification would remove B2, but B would remain, so the individual parent-child relationship of B-E wouldn't be reflected in the tree sequence. It wouldn't be inconsistent either, but it seems potentially very tricky to figure out if it is consistent.
If instead C1 and D1 inherited the left half of B1 and the right half of B2, and E1 inherited the complement, then a similiar thing would happen except that B would retain both its nodes.
jeromekelleher commentedon Jan 25, 2021
Thanks for thinking this through. I think it is too hard to spot that the pedigree is consistent in general. I think we could probably spot grosser things during simplify, like we have an edge (parent=1, child=0) and, node table says individual[0] = 0 and individual[1] =1, but the individual parents say parent[0] = 2 (or something). Basically, in the simplest possible case the edge and pedigree parents directly contradict each other.