1 __VERSION__="ete2-2.0rev96"
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import numpy
26 import faces
27
33
35 leaf_color = "#000000"
36 node.img_style["shape"] = "circle"
37 if hasattr(node,"evoltype"):
38 if node.evoltype == 'D':
39 node.img_style["fgcolor"] = "#1d176e"
40 node.img_style["hz_line_color"] = "#1d176e"
41 node.img_style["vt_line_color"] = "#1d176e"
42 elif node.evoltype == 'S':
43 node.img_style["fgcolor"] = "#FF0000"
44 node.img_style["line_color"] = "#FF0000"
45 elif node.evoltype == 'L':
46 node.img_style["fgcolor"] = "#777777"
47 node.img_style["vt_line_color"] = "#777777"
48 node.img_style["hz_line_color"] = "#777777"
49 node.img_style["line_type"] = 1
50 leaf_color = "#777777"
51
52 if node.is_leaf():
53 node.img_style["shape"] = "square"
54 node.img_style["size"] = 4
55 node.img_style["fgcolor"] = leaf_color
56 faces.add_face_to_node( faces.AttrFace("name","Arial",11,leaf_color,None), node, 0 )
57 if hasattr(node,"sequence"):
58 SequenceFace = faces.SequenceFace(node.sequence,"aa",13)
59 faces.add_face_to_node(SequenceFace, node, 1, aligned=True)
60 else:
61 node.img_style["size"] = 6
62
64 square_size = 10
65
66 node.collapsed = False
67
68
69 node.img_style["fgcolor"] = "#3333FF"
70 node.img_style["size"] = 0
71
72 ncols = node.arraytable.matrix.shape[1]
73
74 matrix_max = numpy.max(node.arraytable._matrix_max)
75 matrix_min = numpy.min(node.arraytable._matrix_min)
76 matrix_avg = matrix_min+((matrix_max-matrix_min)/2)
77 ProfileFace = faces.ProfileFace(\
78 matrix_max,\
79 matrix_min,\
80 matrix_avg,\
81 square_size*ncols,\
82 square_size,\
83 "heatmap")
84 ProfileFace.ymargin=0
85 if node.is_leaf():
86
87 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
88
89
90
91
93
94 node.collapsed = False
95
96 node.img_style["fgcolor"] = "#3333FF"
97 node.img_style["size"] = 4
98 matrix_max = numpy.max(node.arraytable._matrix_max)
99 matrix_min = numpy.min(node.arraytable._matrix_min)
100 matrix_avg = matrix_min+((matrix_max-matrix_min)/2)
101 ProfileFace = faces.ProfileFace(\
102 matrix_max,\
103 matrix_min,\
104 matrix_avg,\
105 200,\
106 60,\
107 "cbars")
108
109 if node.is_leaf():
110 nameFace = faces.AttrFace("name",fsize=6 )
111 faces.add_face_to_node(nameFace, node, 1, aligned=True )
112 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
113 else:
114
115 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
116
118
119 node.collapsed = False
120
121 node.img_style["fgcolor"] = "#3333FF"
122 node.img_style["size"] = 4
123 matrix_max = numpy.max(node.arraytable._matrix_max)
124 matrix_min = numpy.min(node.arraytable._matrix_min)
125 matrix_avg = matrix_min+((matrix_max-matrix_min)/2)
126 ProfileFace = faces.ProfileFace(\
127 matrix_max,\
128 matrix_min,\
129 matrix_avg,\
130 200,\
131 50,\
132 "lines")
133
134 if node.is_leaf():
135 nameFace = faces.AttrFace("name",fsize=6 )
136 faces.add_face_to_node(nameFace, node, 1, aligned=True )
137 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
138 else:
139
140 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
141
143
144 node.collapsed = False
145
146 node.img_style["fgcolor"] = "#3333FF"
147 node.img_style["size"] = 4
148
149 if node.is_leaf():
150 matrix_max = numpy.max(node.arraytable._matrix_max)
151 matrix_min = numpy.min(node.arraytable._matrix_min)
152 matrix_avg = matrix_min+((matrix_max-matrix_min)/2)
153 ProfileFace = faces.ProfileFace(\
154 matrix_max,\
155 matrix_min,\
156 matrix_avg,\
157 200,\
158 40,\
159 "bars")
160 nameFace = faces.AttrFace("name",fsize=6 )
161 faces.add_face_to_node(nameFace, node, 1, aligned=True )
162 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
163
165
166 node.img_style["fgcolor"] = "#3333FF"
167 node.img_style["size"] = 0
168
169
170
171 layout_functions = {
172 "Basic": basic,
173 "Phylogenetic tree": phylogeny,
174 "Clustering heatmap": heatmap,
175 "Clustering validation (bars)": cluster_bars,
176 "Clustering validation (profiles)": cluster_cbars,
177 "Very large topology": large
178 }
179