Hi,
I want to print a tree with selected attributes using ete3 in python using a Newick (with NHX annotations) file e.g. :
(dog[&&NHX:Genes=3:Identical=3:Duplicated=0:Lost=0:Novel=0:Singleton=0], ((mouse2[&&NHX:Genes=19:Identical=19:Duplicated=0:Lost=0:Novel=0:Singleton=0], mouse[&&NHX:Genes=21:Identical=17:Duplicated=4:Lost=0:Novel=0:Singleton=0])mouse_mouse2[&&NHX:Genes=19:Identical=9:Duplicated=0:Lost=1:Novel=10:Singleton=0], human[&&NHX:Genes=9:Identical=9:Duplicated=0:Lost=1:Novel=0:Singleton=0])"human/mouse/mouse2"[&&NHX:Genes=10:Identical=3:Duplicated=0:Lost=0:Novel=7:Singleton=0])LUCA[&&NHX:Genes=3];
I can print an ascii tree like so:
/-dog, 3, 0, 0, 0
|
-LUCA /-mouse2, 19, 0, 0, 0
| /mouse_mouse2, 9, 0, 1, 0
\"human/mouse/mouse2", 3, 0, 0, 0 \-mouse, 17, 4, 0, 0
|
\-human, 9, 0, 1, 0
Is there a way to do this as a phylogenetic tree image e.g. using the TreeStyle()
function?
Thanks.
Thanks, I do think this is a good place to start and it answers my question.
However, a problem: How can this be done iteratively for a very big tree. I want to display this at each node of the tree.
Can I simply just recurse over each node and at that node say
n.add_face(AttrFace("dist", text_prefix="/"), column=2, position="branch-top")
?Thanks,
yes, iter over nodes and add as many faces as you want. Faces in the same column will be stacked.
Great, thank you.
@jhc can you take a look at this if you get a chance: http://stackoverflow.com/questions/39380907/how-to-color-leaves-on-ete3-tree-python-3
check answer her: http://stackoverflow.com/a/39409340/255832