summaryrefslogtreecommitdiff
path: root/examples/phyloxml/phyloxml_parser.py
blob: 0deeb4cf2066b97bf4914b43e31bc6b1b719a0a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from ete3 import Phyloxml
project = Phyloxml()
project.build_from_file("apaf.xml")

# Each tree contains the same methods as a PhyloTree object
for tree in project.get_phylogeny():
    print tree
    # you can even use rendering options
    tree.show()
    # PhyloXML features are stored in the phyloxml_clade attribute
    for node in tree:
        print "Node name:", node.name
        for seq in node.phyloxml_clade.get_sequence():
            for domain in seq.domain_architecture.get_domain():
                domain_data = [domain.valueOf_, domain.get_from(), domain.get_to()]
                print "  Domain:", '\t'.join(map(str, domain_data))