3to4
Jordi Burguet-Castell edited this page Nov 20, 2023
·
4 revisions
ETE v4 introduces many changes with respect to v3, including the names of some function names and arguments.
This is a summary of the main changes to consider when adapting a program using ete3 to ete4:
t = Tree(filename) -> t = Tree(open(filename))
Tree(name='Hi', dist=1, support=1) -> Tree({'name': 'Hi', 'dist': 1, 'support': 1})
Tree(nw, format=1) -> Tree(nw, parser=1)
convert_to_ultrametric() -> to_ultrametric() (also, new implementation)
topology_only -> topological (argument in several functions)
feature(s), attribute(s), property(ies) -> prop(s) (argument in several functions)
attr, target_attr -> prop (in get_topology_id(), is_monophiletic() and others)
popup_prop_keys -> include_props, exclude_props (in explore() and others)
t & 'A' -> t['A']
tree['A'] (get the node called 'A')
tree[0,1,0] (get the node that comes from the root's 1st child, then its 2nd child, and then its 1st child)
node.id (tuple like [0,1,0])
node.level (number of nodes between node and root)
t.get_tree_root() -> t.root
t.is_root() -> t.is_root
t.is_leaf() -> t.is_leaf
t.get_common_ancestor(n1, n2, n3) -> t.common_ancestor([n1, n2, n3])
t.get_ancestors() -> t.ancestors()
t.get_leaves(), t.iter_leaves() -> t.leaves()
t.get_edges(), t.iter_edges() -> t.edges()
t.get_leaf_names() -> t.leaf_names()
t.get_leaves_by_name() -> t.search_leaves_by_name()
t.get_descendants() , t.iter_descendants() -> t.descendants()
t.populate(size, names_library, random_branches, dist_range, support_range) -> t.populate(size, names, model, dist_fn, support_fn)
t.get_ascii() -> t.to_str()
t.write(props=[], format=1) -> t.write(props=None, parser=1)
A.get_distance(B) -> t.get_distance(A, B)
t.swap_children() -> t.reverse_children(), t.swap_children() (but only for 2 children)
nw = t.write(format=f, dist_formatter="%0.1f", name_formatter="TEST-%s", support_formatter="SUP-%0.1f")
->
parser = newick.make_parser(f, dist='%0.1f', name='TEST-%s', support='SUP-%0.1f')
nw = t.write(parser=parser)
props=None (default in some functions) -> write all extended properties
props=[] -> do not write any extended properties
_FaceContainer -> Grid
_HeaderFaceContainer -> AlignedGrid
get_FaceAreas -> make_faces
ETE Toolkit http://etetoolkit.org