I got a tree with your program. However, I had to avoid the organism names and make data matrix out of numerical values alone. However I face a problem when I need to make a heat map out of such a tree.With the use of "Tree" and Profileface (which is used for heatmap) in ETE2 package, I tried making it but tree node does not have a profile face attribute.
Here is my code: def distmat_clustered_tree(fullmatrix_filename): list_lines=reading_file(fullmatrix_filename) full_mapped_floats,org_list=convert_num(list_lines) Z=linkage(full_mapped_floats,"average") T=to_tree(Z) return T
def clusT_eteTree(T):
root=Tree()
root.dist=0
root.name="root"
item2node={T:root}
to_visit =[T]
while to_visit:
node=to_visit.pop()
cl_dist =node.dist/2.0
for ch_node in [node.left, node.right]:
if ch_node:
ch=Tree()
ch.dist=cl_dist
ch.name=strch_node.id)
item2node[node].add_child(ch)
item2node[ch_node]=ch
to_visit.append(ch_node)
tree=root
##tree.add_face(ProfileFace(20, 1, 3, width=200, height=40, style='lines', colorscheme=2),column=0,position="branch-right")
tree.show()
##nw_str=tree.get_newick(features=[],format=1)
return