Skip to content

Tree.root_threshold not working correctly on empty tree sequence #1706

@jeromekelleher

Description

@jeromekelleher
tables = tskit.TableCollection(1)
for _ in range(10):
    tables.nodes.add_row(flags=tskit.NODE_IS_SAMPLE, time=0)
ts = tables.tree_sequence()
print(ts)

tree = tskit.Tree(ts)
tree.first()
print(tree.roots)
# Gives [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
tree = tskit.Tree(ts, root_threshold=2)
tree.first()
print(tree.roots)
# Gives [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

The list of roots should be empty in the second case.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions