Want to show the labels for internal nodes of the tree.

569 views
Skip to first unread message

SUDIP ROY

unread,
Apr 19, 2012, 7:27:11 AM4/19/12
to eteto...@googlegroups.com

Dear All,

I am using ETE toolkit of python. I want to show the label of the internal nodes of a tree along with the leaf nodes.
The input file and the image file (pdf) files are attached with this post.

ts.show_internal=True   --- this is not working and also I tried with all possible "format" values.

The Newick format of my tree is as follows:

t = Tree("((B,(E,(A,G)M1_t1)M_1_t2)M2_t3,(C,D)M2_t1)M2_t2;", format=8)

Could you please help me how to do that?

Thanks in advance.
Regards,
Sudip

mytree.py
mytree.pdf

Jaime Huerta Cepas

unread,
Apr 19, 2012, 8:57:23 AM4/19/12
to eteto...@googlegroups.com
You will need to use faces and layouts to customize your view. There are plenty of examples in the tutorial, but something like this should work:

from ete2 import Tree, faces, AttrFace, TreeStyle

def
my_layout(node):
# Add name label to all nodes
 faces.add_face_to_node(AttrFace("name"), node, column=0, position="branch-right")
ts = TreeStyle()
ts.show_leaf_name = False
ts.layout_fn = my_layout


t = Tree("((B,(E,(A,G)M1_t1)M_1_t2)M2_t3,(C,D)M2_t1)M2_t2;", format=8)
t.show(tree_style=ts)


Jaime





=====================================
Jaime Huerta-Cepas, Ph.D.
Comparative Genomics Group
Bioinformatics and Genomics Programme
CRG-Centre for Genomic Regulation
C/ Dr. Aiguader, 88. PRBB Building.
08003 Barcelona, Spain 
Tel. +34 93 316 02 82
http://gabaldonlab.crg.es
=====================================
Reply all
Reply to author
Forward
0 new messages