summaryrefslogtreecommitdiff
path: root/examples/phyloxml/phyloxml_parser.py
blob: f46b24dfb7dccb237c13c87e262e376fc3a1e402 (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)))