Hello!
I'm trying to adapt an example of Visualization of phylogenetic trees. Unfortunately it fails on line recon_tree, events = genetree.reconcile(sptree)
with The following species are not contained in the species tree: ARA,THE'
. And indeed, there are no "ARA" ant "THE" species defined.
However the script is able to generate both genetree
and sptree
.
I don't understand where this error comes from(second day with python) there is of course no "ARA" and "THE" species in the tree.
Thank you!
The whole code is:
from ete2 import PhyloTree, TreeStyle
alg = """
>SOLTU_M1A5X1
MASRRLIASLLRSSAQRGAGSGGGPISRSSIANSIARPASRASPKGFLLNRAVQYATSAAAPASKPS
>ARATH_Q9C5A9
MASRRILSSLLRSSSSRSTSK-SSLIGSRNPRLLSPGPAHGAAPCGTLLGRVAEYSTSSPANSAAPS
>THELL_Tp6g34190
MASRRVLSSLLRSSSGRSAA----KFGSRNPRLSSPSPARRAAPFGDLLGRVAEYSTSSPANSAASS
>PHYPA_A9T281
MSGRKALAAALRAGSRRLSSSPQPPKGARSFSPN--------ASNGRAVANAAAKGLSRSIFNSARA
>ORYSJ_Q0DG48
MATRRALSSLVRAASRLR-GA--------SPAPRPRGPLHRPSPSGYLFNRAAAYATAAAAKEAAPP
>BRADI_I1HQG7
MATRRAISSIVRSASRIR-AA--------SPSPLPRAPLHRPSPAGFLLNRAAAYATSAAAQAAPAT
"""
def get_example_tree():
# Performs a tree reconciliation analysis
gene_tree_nw = '(PHYPA_A9T28,((ARATH_Q9C5A9,THELL_Tp6g34190)((ORYSJ_Q0DG48,BRADI_I1HQG7),SOLTU_M1A5X1)));'
species_tree_nw = "((SELML, PHYPA), ((ORYSJ, BRADI), (SOLTU, (ARATH, THELL))));"
genetree = PhyloTree(gene_tree_nw)
sptree = PhyloTree(species_tree_nw)
recon_tree, events = genetree.reconcile(sptree)
recon_tree.link_to_alignment(alg)
return recon_tree, TreeStyle()
if __name__ == "__main__":
# Visualize the reconciled tree
t, ts = get_example_tree()
t.show(tree_style=ts)
#recon_tree.render("phylotree.png", w=750)