Skip to content

Commit

Permalink
Update ushertools.py
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson authored May 23, 2022
1 parent 7b00ea0 commit 202d7dd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions taxoniumtools/src/taxoniumtools/ushertools.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,14 @@ def prune_node(self, node_to_prune):
clade_type] == "":
child.clades[clade_type] = clade_annotation
grandparent = parent.parent
grandparent.remove_child(parent)
parent.remove_child(child)
grandparent.add_child(child)
if grandparent:
grandparent.remove_child(parent)
grandparent.add_child(child)

def shear_tree(self, theshold=1000):
"""Consider each node. If at any point a child has fewer than 1/threshold proportion of the num_tips, then prune it"""
for node in alive_it(self.tree.traverse_postorder()):
for node in alive_it(list(self.tree.traverse_postorder())):
if len(node.children) > 1:
total_tips = node.num_tips
for child in node.children:
Expand Down

1 comment on commit 202d7dd

@vercel
Copy link

@vercel vercel bot commented on 202d7dd May 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.