Skip to content
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

Triplets Correct and RF functions both mutate the underlying tree #173

Open
richardyz98 opened this issue Feb 18, 2022 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@richardyz98
Copy link
Collaborator

From the following code snippet, we see that even though the cached edges do not change, the underlying backend networkx object has changed, with the singleton edge at the top of the tree being collapsed. Hence we believe that the behavior of the collapse_unifurcations function that is called on the (supposed) copy of the trees passed into triplets_correct and robinson_foulds somehow persists.

import cassiopeia as cas

simulated_tree_dir = "/data/yosef2/users/richardz/projects/CassiopeiaV2-Reproducibility/topologies/exponential_plus_c/400cells/no_fit/"
reconstructed_tree_dir = '/data/yosef2/users/richardz/projects/CassiopeiaV2-Reproducibility/reconstructed/exponential_plus_c/400cells/no_priors/no_fit/char40/'

ind = 0
tree = pic.load(open(f'{simulated_tree_dir}/topology{ind}.pkl', 'rb'))
print(len(tree.edges))
print(tree._CassiopeiaTree__network.number_of_edges())
print(tree.root, tree.children(tree.root))

recon_tree = cas.data.CassiopeiaTree(tree=f'{reconstructed_tree_dir}/greedy/recon{ind}')
triplets = cas.critique.triplets_correct(tree, recon_tree, min_triplets_at_depth = 50)[0]  # or rf = cas.critique.robinson_foulds(tree, recon_tree)
print(len(tree.edges))
print(tree._CassiopeiaTree__network.number_of_edges())
print(tree.root, tree.children(tree.root))
@richardyz98 richardyz98 self-assigned this Feb 18, 2022
@richardyz98 richardyz98 added the bug Something isn't working label Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant