Get closest taxa of a target species in a phylogeny
1
0
Entering edit mode
3.4 years ago
mchimich ▴ 20

Dear users, Since many days I'm struggling with a technical problem for which I was not able to find any clear answer given that I'm not familiar with the automatic manipulation of phylogenetic trees. let's consider the following phylogeny tree :

enter image description here

It there any automatic way (R package or any other langue) to get the closest taxa names of a particular target taxa. For example the closest species of t3 will be : t14 and t13. for t7 it will be : t12,t17,t18 and for t10 this will be t11. It is also possible to add a threshold using bootstrap values ?

Thank you so much for your help !

Cheers

phylogeny • 1.2k views
ADD COMMENT
4
Entering edit mode
3.4 years ago

In Python you can use ete3 package.

UPDATED: The following code finds a sister group to your query taxon and prints all leaves of that sister group (if bootstrap value is equal or greater than threshold)

import ete3

YOUR_TREE = '((raccoon:19.19959,bear:6.80041)50:0.84600,((sea_lion:11.99700, seal:12.00300)100:7.52973,((monkey:100.85930,cat:47.14069)80:20.59201, weasel:18.87953)75:2.09460)50:3.87382,dog:25.46154);'
YOUR_QUERY = 'weasel'
MIN_BOOTSTRAP = 50 

t = ete3.Tree(YOUR_TREE)
node = t.search_nodes(name=YOUR_QUERY)[0]

for sister_group in node.get_sisters():
    if sister_group.support >= MIN_BOOTSTRAP:
        for leaf in sister_group.get_leaves():
            printleaf.name)

You will get the names of leaves that are present in the sister group (cat and monkey) to weasel. Of note, the tree is unrooted (so there is no outgroup here). If you look at the QUERY_TREE you can see that weasel is next to monkey and cat: [..] ((monkey:100.85930,cat:47.14069)80:20.59201, weasel:18.87953) [..].

ADD COMMENT
0
Entering edit mode

Dear a.zielezinski , thanks for your answer. I tried your code and it works ! however the closest leaves to weasel in your example is cat and monkey. However what I wanted to get based on your example is the sister clade that contain dog, bear, raccoon, seal and sea_lion not the outgroups (cat and monkey) enter image description here

Do you know if it is possible to consider sister group only if the bootstrap value is bigger than a threshold

Thanks again for your help !

ADD REPLY
1
Entering edit mode

Hi mchimich, I just updated my answer. Hope it helps.

ADD REPLY
1
Entering edit mode

Thank you so much !! now everything is working perfectly ! appreciated

ADD REPLY

Login before adding your answer.

Traffic: 2101 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6