# | /--------| # | | | /-Hsa_001 # | | | /--------| # | | \--------| \-Ptr_001 # \--------| | # | \-Mmu_001 # | # | /-Ptr_002 # \--------| # | /-Hsa_002 # \--------| # \-Mmu_002 # # To obtain all the evolutionary events involving a given leaf node we # use get_my_evol_events method matches = t.search_nodes(name="Hsa_001") human_seq = matches[0] # Obtains its evolutionary events events = human_seq.get_my_evol_events() # Print its orthology and paralogy relationships print "Events detected that involve Hsa_001:" for ev in events: if ev.etype == "S": print ' ORTHOLOGY RELATIONSHIP:', ','.join(ev.in_seqs), "<====>", ','.join(ev.out_seqs) elif ev.etype == "D": print ' PARALOGY RELATIONSHIP:', ','.join(ev.in_seqs), "<====>", ','.join(ev.out_seqs) # Alternatively, you can scan the whole tree topology events = t.get_descendant_evol_events() # Print its orthology and paralogy relationships print "Events detected from the root of the tree"