You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import phylotreelib as pt
tree = pt.Tree.from_string("(Gorilla:3, (Human:2, (Chimpanzee:1, Bonobo:1):1):1);")
tree.numberprune(2, return_leaves=True)
Observed error:
>>> tree.numberprune(2, return_leaves=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/phylotreelib.py", line 2192, in numberprune
clusters = self.cluster_n(nclust=nkeep)[0] # list containing sets of leafnames
File "/usr/local/lib/python3.9/site-packages/phylotreelib.py", line 1825, in cluster_n
kid_dict[kid].parent_height = pheight
AttributeError: 'Branchstruct' object has no attribute 'parent_height'
The text was updated successfully, but these errors were encountered:
Note: instead of number_prune() I recommend using function prune_maxlen(). This function prunes the tree such that the remaining nkeep leaves spread out the maximal percentage of branch length. The function number_prune() instead conceptually finds the height above the root where cutting the branches will result in nkeep separate clusters, and then keeps one leaf from each of these (and where leaves that are below this cutpoint - i.e. closer to the root - are considered individual clusters and are all kept also). This is highly dependent on rooting, and will not necessarily result in the most representative set of leaves. The function prune_maxlen() can instead be said to return the set of leaves that maintains the maximal phylogenetic diversity possible.
Also: I should clean up function names to be more consistent...
Using version 1.5.5. MWE
Observed error:
The text was updated successfully, but these errors were encountered: