I am trying to build a tree using BioPython, the Phylo module.
What I have done so far is this image: 
each name has a four-digit number followed by a number: this number refers to the number of times this sequence is presented. This means 1578 - 22 that node should represent 22 sequences.
aligned sequence file : file
file with distance to build a tree: file
So now I know how to resize each node size. Each node has a different size, this easily makes an array of different values:
fh = open(MEDIA_ROOT + "groupsnp.txt") list_size = {} for line in fh: if '>' in line: labels = line.split('>') label = labels[-1] label = label.split() num = line.split('-') size = num[-1] size = size.split() for lab in label: for number in size: list_size[lab] = int(number) a = array(list_size.values())
But the array is arbitrary, I would like to put the correct node size to the right of the node, I tried this:
for elem in list_size.keys(): if labels == elem: Phylo.draw_graphviz(tree_xml, prog="neato", node_size=a)
but nothing appears when I use the if statement.
Anyway, can this be done?
I would be very grateful!
Thanks everyone
python numpy graphviz biopython
pavid
source share