What’s new in ETE 2.2¶
- Improvements in the standalone visualization script (a.k.a. ete3)
- Added the etree2orthoxml script, which provides conversion between phylogenetic tree and the orthoXML format
News in core Tree instances:
TreeNode.robinson_foulds()distance to compare the topology of two trees (i.e. tree.robinson_foulds(tree2)). It includes automatic pruning to compare trees of different sizes. See tutorial and examples
TreeNode.get_cached_content()function, which returns a dictionary linking each node instance with its leaf content. Such a dictionary might be used as a cache to speed up functions that require intensive use of node traversing. See tutorial and examples
TreeNode.get_ascii()function for text-based visualization of trees. A new attributes argument can be passed to display node attributes within the ASCII tree representation.
from ete3 import Tree t = Tree("((A, B)Internal_1:0.7, (C, D)Internal_2:0.5)root:1.3;", format=1) t.add_features(size=4) print t.get_ascii(attributes=["name", "dist", "size"]) # # /-A, 0.0 # /Internal_1, 0.7 # | \-B, 0.0 # -root, 1.3, 4 # | /-C, 0.0 # \Internal_2, 0.5 # \-D, 0.0 #
Random branch length and support values generation is now available for the
a new argument
is_leaf_fnis available for a number of traversing functions, thus allowing to provide custom stopping criteria when browsing a tree. This is, any node matching the function provided through the
is_leaf_fnargument will be temporarily considered as a terminal/leaf node by the traversing function (tree will look as a pruned version of itself). See tutorial and examples
TreeNode.iter_prepostorder()tree node iterator.
Newick parser accepts now the creation of single node trees. For example, a text string such as
"node1;"will be parsed as a single tree node whose name is
node1. By contrast, the newick string
(node1);will be interpreted as an unnamed root node plus a single child named
TreeNode.write()accepts now a
format_root_nodeargument to export root node features as a part of the newick string.
TreeNode.check_monophyly()method allows to check if a node is mono, poly or paraphyletic for a given attribute and values (i.e. grouped species). Although monophyly is actually a phylogenetic concept, the idea can be applied to any tree, so any topology could be queried for the monophyly of certain attribute values. If not monophyletic, the method will return also the type of relationship connecting the provided values (para- or poly-phyletic). See tutorial and examples
TreeNode.get_monophyletic()method that returns a list of nodes in a tree matching a custom monophyly criteria.
News PhyloTree instances:
Marcet-Houben M, Gabaldón T.
Nucleic Acids Res. 2011 May;39(10):e66. doi: 10.1093/nar/gkr087.
PhyloNode.collapse_lineage_specific_expansions()method, which returns a pruned version of a tree, where nodes representing lineage specific expansions are converted into a single leaf node. See tutorial and examples
News on sequence and multiple sequence alignment parsing:
- added the option to disable the automatic correction of duplicated
names when loading
SeqGroupdata from phylip and fasta files.
- added the option to disable the automatic correction of duplicated names when loading
News on tree visualization and image rendering:
node style attributes can now be modified without the need of initialization by directly accessing the
Multiple layout functions can now be provided to combine their functionality. This way, you can keep separate styling templates and combine them as necessary.
from ete3 import TreeStyle def color_leaves(node): if node.is_leaf(): node.img_style["fgcolor"] = "red" def size_internal(node): if not node.is_leaf(): node.img_style["size"] = 15 ts = TreeStyle() # provide a list of layout functions, instead of a single one ts.layout_fn = [color_leaves, size_internal]
SVG_COLORSdictionaries are provided for easy access to color codes and several predefined color schemes. In addition, a
random_color()function is also available as a generator of RGB colors (where saturation and lightness can be fixed).
from ete3 import random_color, COLOR_SCHEMES, SVG_COLORS # generate 20 random colors node_colors = [random_color(s=0.4, l=4) for i in xrange(20)]
News on node faces:
face.rotationattribute, that allows to rotate individual faces even when a global
SequenceFace: Sequence sites are now rendered one by one, allowing interaction with each of them and getting rid of the previous pixmap size limitation. Site image dimensions and colours are now configurable.
SeqMotifFaceclass, which represent an enriched version of the former
SequenceFaceinstance. This new face type allows to represent sequences as a succession of domain/motif elements or to represent sequence positions as color points. Gaps can also be taken into account and therefore shown as as a black space or a flat line.
ImgFaceclass, now accepting on the fly image scaling.
News on the GUI
- Allows image region selection.
- Allows zooming on selected regions or specific nodes (Z - zoomIn, X - zoomOut, R - focus region).
C-cwill now interrupt the GUI application when started from a terminal.
- Added keyboard-based node navigation (click on a node and play the arrow keys).