This is a test version of Biostars. For the public version, visit https://www.biostars.org.
subtree corresponding to ev.etype

Hello,

I tried to extract the orthologs and paralogs based on get_my_evol_events(). One of my speciation node (#7, for example), i.e one inferred as ev.etype =="S" contains a paralog in a deeper node. The out_seq generates a list that includes all the species of node #7. Instead, is there a way to extract corresponding subtree of node #7 and further process it for split by duplication ?. Can anyone suggest a way to achieve this ?

Thanks in advance.

Arun

etetoolkit python2.7 subtree

2 answers

You can do this in R using extract.clade() in the ape package. More here.

In Python, you can use the DendroPy library.

the event instance obtained when calling 'get_my_evol_events()' or 'get_descendant_evol_events' contains a pointer to the corresponding internal node:

an example based on the tutorial:

from ete3 import PhyloTree
nw = "((Dme_001,Dme_002),(((Cfa_001,Mms_001),((Hsa_001,Ptr_001),Mmu_001)),(Ptr_002,(Hsa_002,Mmu_002))));"
t = PhyloTree(nw)
events = t.get_descendant_evol_events()
for ev in events: 
  print ev.etype
  print ev.node
  print ev.node.write()

Log in to answer this question.