Need to make a plot merging heat map and a phylogenetic tree in Python. I have already made the heat map using the square distance matrix that I have with the help of numpy and matplotlib but now I would like to merge a phylogentic tree with this heat map, For this purpose I found a BioPython Package called ETE2, however the problem with this is that it needs a newick formatted file instead of the distance matrix(Phylip format) that I have. Is there a module in BioPython which could help me in this conversion(Distance matrix to Newick)?
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
response in the ete mailing list: https://groups.google.com/forum/#!topic/etetoolkit/pXr4B71Ozt0