We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6055db3 commit 25dd68bCopy full SHA for 25dd68b
1 file changed
treeprofiler/src/utils.py
@@ -204,11 +204,21 @@ def ete4_parse(newick, internal_parser="name"):
204
# pruning
205
def taxatree_prune(tree, rank_limit='subspecies'):
206
for node in tree.traverse("preorder"):
207
- if node.props.get('rank') == rank_limit:
+ rank = node.props.get('rank')
208
+ if rank == rank_limit:
209
children = node.children.copy()
210
for ch in children:
211
print("prune", ch.name)
212
remove(ch)
213
+ lca_dict = node.props.get('lca')
214
+ if lca_dict:
215
+ lca = lca_dict.get(rank_limit, None)
216
+ if lca:
217
+ node.name = lca
218
+ children = node.children.copy()
219
+ for ch in children:
220
+ print("prune", ch.name)
221
+ remove(ch)
222
return tree
223
224
def conditional_prune(tree, conditions_input, prop2type):
0 commit comments