Unrooted tree?

131 views
Skip to first unread message

Daniel

unread,
Apr 10, 2010, 7:12:54 PM4/10/10
to The ETE toolkit
Hi all,

I am wondering if the PhylomeDB API retrieves rooted or unrooted trees
for ETE2, a method of the node objects I want to use appears to
require a rooted tree, and I guess the PhylomeDB trees should be
rooted reading this from the PhylomeDB manual( http://phylomedb.org/help/doku.php?id=manual3
):

(...) our approach does not require any previous fully resolved
species topology, as far as the trees are rooted. The orthology
prediction algorithm is run independently for each seed protein using
the corresponding phylogenetic tree

The method I am trying to use is:
node.get_descendant_evol_events()

And the error displayed:
Traceback (most recent call last):
File "coevolution.py", line 282, in <module>
phylomeDB_web()
File "coevolution.py", line 202, in phylomeDB_web
process_tree(tuple[3][0],tuple[2])
File "coevolution.py", line 247, in process_tree
nde.get_descendant_evol_events()
File "build/bdist.linux-x86_64/egg/ete2/phylo/phylotree.py", line
170, in get_descendant_evol_events
File "build/bdist.linux-x86_64/egg/ete2/phylo/spoverlap.py", line
150, in get_evol_events_from_root
TypeError: Tree is not rooted

Any ideas?
Thanks,
Daniel.

Jaime Huerta Cepas

unread,
Apr 12, 2010, 3:44:46 AM4/12/10
to eteto...@googlegroups.com
Hi Daniel,

Trees shown in phylomeDB (web interface) are rooted, but the ones you download from DB are *not* processed. You will need to root them before executing tree reconciliation or the species overlap algorithm.
You can root trees manually or automatically selecting the best outgroup node within each tree. For this you can use the "get_farthest_oldest_node" method, which only requires a dictionary with the relative ages of each species included in the trees. In the case of the human phylome, such a dictionary is provided by ETE.

Here you have an example:

from ete2 import PhylomeDBConnector
# Import the dictionary of species relative ages used by phylomeDB
from ete2 import ROOTED_PHYLOMES
# Creates a connector to PhylomeDB
p = PhylomeDBConnector()
# Gets a tree from phylome 1 (=Human Phylome)
best_model, all_lk, tree = p.get_best_tree("Hsa0000001", 1)

## Tree is unrroted, we need to root it using our criteria. For
## instance, the ROOTED_PHYLOMES dictionary contains info about the species of several phylomes.
## ROOTED_PHYLOMES[1] means the species dictionary of phylome 1 = human phylome
outgroup = tree.get_farthest_oldest_leaf(ROOTED_PHYLOMES[1])

## If no species relative ages is defined, you can always use midpoint
## outgroup (not the best option)
# outgroup = tree.get_midpoint_outgroup()

# Applies our outgroup
tree.set_outgroup(outgroup)
# And runs the species overlap algorithm
events = tree.get_descendant_evol_events()
# Show us the tree
tree.show()


Jaime



--
To unsubscribe, reply using "remove me" as the subject.

Reply all
Reply to author
Forward
0 new messages