We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 469a405 commit f74cfffCopy full SHA for f74cfff
gtdb_itol_decorate/itol.py
@@ -51,8 +51,14 @@ def get_phylum_to_lca(tree: dendropy.Tree):
51
"""Calculate the LCA for each phylum. Considers singletons."""
52
out = defaultdict(list)
53
for node in tree.postorder_node_iter():
54
- if len(node.tax_label) > 0 and node.tax_label[0].startswith('p__'):
55
- out[node.tax_label[0]].append(get_lca_str(node))
+ # Consider the case where the domain shares the same label as the phylum
+ if len(node.tax_label) > 0:
56
+ if len(node.tax_label) >= 2:
57
+ if node.tax_label[0].startswith('d__') and node.tax_label[1].startswith('p__'):
58
+ out[node.tax_label[1]].append(get_lca_str(node))
59
+ else:
60
+ if node.tax_label[0].startswith('p__'):
61
+ out[node.tax_label[0]].append(get_lca_str(node))
62
return out
63
64
0 commit comments