This is a test version of Biostars. For the public version, visit https://www.biostars.org.
ETE - Make tree ultrametric with internal node labels

Is there a way to create an ultrametric tree in ETE (preferably ete2) for a tree that contains some internal branch attribute labels. I can make one with no attributes set, however I cannot make one when my tree has the attribute faces added to internal nodes.

Any solved this problem before ?

Thanks., R

EDIT: More detail

My tree currently looks something like this :http://imgur.com/cn04ylK

I visualize the attributes by grabbing with AttrFace and using the node.add_face function in a custom Treestyle layout function.

python phylogenetics

Have you tried format=3, features=[your attributes] (which created a NHX extended newick)?

For example,

t.write(format=3, features=['vowel'])

'((D:0.723274[&&NHX:vowel=False],F:0.567784[&&NHX:vowel=False])E:0.067192[&&NHX:vowel=True],(B:0.279326[&&NHX:vowel=False],H:0.756049[&&NHX:vowel=False])B:0.807788[&&NHX:vowel=False]);'

The following page shows an example of adding attributes to internal nodes.

http://etetoolkit.org/docs/latest/tutorial/tutorial_trees.html#node-annotation

In the worse case, you can always code your attribute to the node names.

Ill add a little more detail to the question. I can add attributes. I just need to be able to add branch labels to both leaf nodes and internal nodes and output a tree with aligned taxa.

1 answer

Not completely trivial - you would need to know the exact size of the graphical items associated to internal faces, and the compensate branches as needed.

Another option would be to use a custom layout where you add all tip names (or other leaf faces) in "aligned" position, and then turn TreeStyle.draw_guiding_lines=True. The effect should be like having all leave nodes aligned by compensating their branch lengths.

Log in to answer this question.