Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jeromekelleher opened this issue Sep 16, 2021 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@jeromekelleher
Copy link
Member

jeromekelleher commented Sep 16, 2021

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.

@jeromekelleher jeromekelleher added the bug Something isn't working label Sep 16, 2021
@jeromekelleher jeromekelleher self-assigned this Sep 16, 2021
jeromekelleher added a commit to jeromekelleher/tskit that referenced this issue Oct 15, 2021
@mergify mergify bot closed this as completed in a882a5d Oct 18, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant