Migrating from ETE 3¶
ETE v4 introduces many changes with respect to v3, including some function names and arguments.
General considerations¶
In ETE 3 there are two classes that are identical, TreeNode
and
Tree
(since a node is a tree in itself). In ete4 there is only the
Tree
class.
In ETE 3, a node has necessarily a name, a distance and support (which
default to ''
, 0, and 1 respectively). In ETE 4 they don’t have to
have them. If you request them (node.name
, node.dist
,
node.support
) for a node that doesn’t have them, ETE 4 returns
None
.
A node contains all its properties in a dictionary called props
.
In particular, reading special properties like name
(which can be
done with node.name
) is equivalent to node.props.get('name')
.
Changes in syntax¶
This is a summary of the main changes to consider when adapting a program using ETE 3 to ETE 4:
ETE 3 |
ETE 4 |
Notes |
---|---|---|
|
|
You can refer to a node by its name, or by a tuple that identifies its position as in |
|
|
|
|
|
|
|
|
|
|
|
The |
|
|
The constructor now admits arbitrary properties for the node, in the form of a dict |
|
|
Since |
|
|
All such functions now return iterators (similar to Python’s |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
It can now fine-tune the representation with different arguments (and produces a nicer / more modern text output) |
|
|
Also, new implementation that keeps the relative sizes of branches closer to the original tree |
|
|
Argument used in several functions ( |
|
|
Arguments used in several functions (they all refer to the same thing, arbitrary properties attached to a node, which are elements of its |
|
|
Argument used in |
|
|
Argument in |
|
|
Shorter name, and can instead accept a list of nodes too |
|
|
|
|
|
|
|
|
The tree can be randomly generated according to different models (yule or uniform), and accept arbitrary functions to randomly generate distances and supports |
|
|
ete4 parsers are more general, and we can create customized simple ones using |
|
|
|
New syntax¶
New in ETE 4:
ETE 4 |
Notes |
---|---|
|
In addition to numbers, some parsers have easy to remember aliases (in this case, interpret field in internal nodes as support, same as |
|
Tuple like |
|
Number of nodes between node and root |
Changes in the ete4 tool¶
When using ete4 explore -t [...]
:
Instead of
~=
we use=~
Instead of
<-
we use<=