-
Notifications
You must be signed in to change notification settings - Fork 77
Unexpected union
behaviour: edges dropped if tables have all identical nodes
#3168
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
Comments
aw crap, this does look like a bug |
I would try to suggest a fix, but it's in the C code I guess, so 😱 |
By the way, passing a node mapping of |
It would be nice to fix this. Does e.g. @mufernando have any idea what the source of this bug could be? |
Two notes: first, passing
Note that in this situation, the edges we'd like to have added have neither parent nor child new. The check happens here (that's the python test reference implementation). I think if we were to extend
(?). However, I'm not seeing an easy way to adjust the logic there - note that in the current implementation we don't have to build trees. We certainly could figure this out, but I'm wondering if we just want a different function for this use case - as you say - which is "paste together tree sequences describing different chnks of the genome". |
Also note that doing |
Ah, good catch @petrelharp, thanks. Good that it's not a bug, but I do find this somewhat unexpected behaviour for something called In my case, I guess the way for me to work around this is to identify any edges between the indexes passed into the node_mapping that do not have a NULL entry, and simply add those by hand: used_nodes = np.where(node_mapping != tskit.NULL)
omitted = np.logical_and(np.isin(other.edges.child, used_nodes), np.isin(other.edges.parent, used_nodes))
for e in np.where(omitted)[0]:
new_tables.edges.append(other.edges[e])
new_tables.sort() |
union
: edges dropped if tables have all identical nodesunion
: edges dropped if tables have all identical nodes
union
: edges dropped if tables have all identical nodesunion
behaviour: edges dropped if tables have all identical nodes
So this is not a bug, but a misunderstanding about what union does. See #3183 (comment) and #3183 (comment) for suggestions to clarify. |
Uh oh!
There was an error while loading. Please reload this page.
I think this should produce a table with edges spanning 0..2, but instead, the
union
ed TS is missing 0..1Here's what the result of
union
looks likeThe text was updated successfully, but these errors were encountered: