Skip to content

Unexpected union behaviour: edges dropped if tables have all identical nodes #3168

Closed
@hyanwong

Description

@hyanwong

I think this should produce a table with edges spanning 0..2, but instead, the unioned TS is missing 0..1

import tskit
import numpy as np

ts = tskit.Tree.generate_comb(2, span=2).tree_sequence
# Cut it up
ts1 = ts.keep_intervals([[0, 1]])
ts2 = ts.delete_intervals([[0, 1]])
node_mapping = np.arange(ts.num_nodes)
# Paste back together
ts_both = ts2.union(ts1, node_mapping=node_mapping, check_shared_equality=False)
ts_edges_squashed = ts_both.simplify()
print(ts_both.draw_text())
assert ts.equals(ts_edges_squashed, ignore_provenance=True)  # fails

Here's what the result of union looks like

1.00┊     ┊  2  ┊
    ┊     ┊ ┏┻┓ ┊
0.00┊ 0 1 ┊ 0 1 ┊
    0     1     2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions