Load a tree file

This is a small example expliciting how to load a tree file in cocoatree using cocoatree.io.load_tree_ete3() function.

from cocoatree.io import load_tree_ete3

Let’s start by creating a simplified tree:

simple_tree = "(A:1,(B:1,(C:1,D:1):0.5):0.5);"
t = load_tree_ete3(simple_tree)
print(t)
   /-A
--|
  |   /-B
   \-|
     |   /-C
      \-|
         \-D

Here, we have a tree with distances and leaf names. The distances are specified after the : character and the leaf names are A, B, C, and D.

cocoatree.io.load_tree_ete3() also accepts trees with more information such as branch support values encoded as follow:

bootstrap_tree = "(A:1,(B:1,(C:1,D:1)95:0.5)98:0.5);"
t_boot = load_tree_ete3(bootstrap_tree)

The branch support values are placed following their corresponding closing bracket.

Warning

Only one type of branch support value is accepted (i.e. a file with bootstrap and jack-knife branch support values will not be accepted).

Branch support values should not be between square brackets as those are not accepted.

See also

Simple tree visualization with metadata for a simple tree visualization or Plot XCoR together with (phylogenetic) tree and metadata for a more complete visualization.

Total running time of the script: (0 minutes 0.004 seconds)

Gallery generated by Sphinx-Gallery