Use ete3 to combine node support values from 2 Newick tree files?

20 views
Skip to first unread message

Tatyana Livshultz

unread,
Mar 14, 2023, 8:06:49 PM3/14/23
to The ETE toolkit
Hello there:

I'm using Astral to output two Newick-format tree files of the same tree topology: one with local posterior probability at each node and one with the polytomy test p-value at each node. Is it possible to use ETE3 to combine these two into a visualization of the tree topology with both support values at each node, e.g. with the two values separated by a comma? 

Thanks for any insight,
Tanya

dengzi...@gmail.com

unread,
Mar 17, 2023, 9:11:43 AM3/17/23
to The ETE toolkit
hi! yes, ete3 support tree node annotation so you can modify the node features easily, although 

# we load a tree
t = Tree('((((H,K)D,(F,I)G)B,E)A,((L,(N,Q)O)J,(P,S)M)C);', format=1)

for node in t.traverse("postorder"):
  #add two support values in two different features
  node.add_features(support1=support_val1, support2=support_val2)
  # or two support values in one features separated by a comma
  node.add_feature(new_support, f"{support_val1},{support_val2}")


*note that the default support feature note.support must be a float number, hence if you have more than one support values to be added, I reccomend create a new feature(s) of node to put your data

Ziqi

Reply all
Reply to author
Forward
0 new messages