1 __VERSION__="ete2-2.0rev86"
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 matrix_max = numpy.max(node.arraytable.matrix)
74 matrix_min = numpy.min(node.arraytable.matrix)
75 matrix_avg = matrix_min+((matrix_max-matrix_min)/2)
76 ProfileFace = faces.ProfileFace(\
77 matrix_max,\
78 matrix_min,\
79 matrix_avg,\
80 square_size*ncols,\
81 square_size,\
82 "heatmap")
83 ProfileFace.ymargin=0
84 if node.is_leaf():
85
86 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
87
89
90 node.collapsed = False
91
92 node.img_style["fgcolor"] = "#3333FF"
93 node.img_style["size"] = 4
94 matrix_max = numpy.max(node.arraytable.matrix)
95 matrix_min = numpy.min(node.arraytable.matrix)
96 matrix_avg = matrix_min+((matrix_max-matrix_min)/2)
97 ProfileFace = faces.ProfileFace(\
98 matrix_max,\
99 matrix_min,\
100 matrix_avg,\
101 200,\
102 60,\
103 "cbars")
104
105 if node.is_leaf():
106 nameFace = faces.AttrFace("name",fsize=6 )
107 faces.add_face_to_node(nameFace, node, 1, aligned=True )
108 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
109 else:
110
111 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
112
114
115 node.collapsed = False
116
117 node.img_style["fgcolor"] = "#3333FF"
118 node.img_style["size"] = 4
119 matrix_max = numpy.max(node.arraytable.matrix)
120 matrix_min = numpy.min(node.arraytable.matrix)
121 matrix_avg = matrix_min+((matrix_max-matrix_min)/2)
122 ProfileFace = faces.ProfileFace(\
123 matrix_max,\
124 matrix_min,\
125 matrix_avg,\
126 200,\
127 50,\
128 "lines")
129
130 if node.is_leaf():
131 nameFace = faces.AttrFace("name",fsize=6 )
132 faces.add_face_to_node(nameFace, node, 1, aligned=True )
133 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
134 else:
135
136 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
137
139
140 node.collapsed = False
141
142 node.img_style["fgcolor"] = "#3333FF"
143 node.img_style["size"] = 4
144
145 if node.is_leaf():
146 matrix_max = numpy.max(node.arraytable.matrix)
147 matrix_min = numpy.min(node.arraytable.matrix)
148 matrix_avg = matrix_min+((matrix_max-matrix_min)/2)
149 ProfileFace = faces.ProfileFace(\
150 matrix_max,\
151 matrix_min,\
152 matrix_avg,\
153 200,\
154 40,\
155 "bars")
156 nameFace = faces.AttrFace("name",fsize=6 )
157 faces.add_face_to_node(nameFace, node, 1, aligned=True )
158 faces.add_face_to_node(ProfileFace, node, 0, aligned=True )
159
161
162 node.img_style["fgcolor"] = "#3333FF"
163 node.img_style["size"] = 0
164
165
166
167 layout_functions = {
168 "Basic": basic,
169 "Phylogenetic tree": phylogeny,
170 "Clustering heatmap": heatmap,
171 "Clustering validation (bars)": cluster_bars,
172 "Clustering validation (profiles)": cluster_cbars,
173 "Very large topology": large
174 }
175