AttributeError: 'NoneType' object has no attribute 'traverse_tree'
Closed this issue · 2 comments
I'm trying to use the ".traverse_tree" option on an imported .json file. When I use traverse_tree, I get an error saying, "AttributeError: 'NoneType' object has no attribute 'traverse_tree'."
A colleague of mine doesn't get this error using the same code, but they use version 0.1.0. I have gotten it with version 0.1.1 and 0.1.2. When I tried to revert to version 0.1.0, I get the following error: "FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'".
You can see a copy of the code I'm running here.
Hi Cole,
I believe this will be caused by the fact that .subtree()
will return None
if the conditional traversal doesn't encounter any tips. This can happen if you initiate a traversal on a node in state B but all of the node's children are in another state and since there's no tips in the conditional subtree there's no subtree to be extracted. I think I had the code set up correctly for Ebola exploded trees but didn't bother for flu B because I knew all the traversals would be fine. You can test if this is the case by traversing the subtree with the same condition (should be ll.traverse_tree(k, traverse_condition=traverse_condition, reset_branches=False)
) and seeing if any tips are returned.
Thanks for spotting this!
Best,
Gytis
This was it! Thank you!