def get_orthology_graph( t,seedname,phyid ): """Return graph representing orthology relationships from the tree.""" #get evol_events evolEvents,seednode=get_evolEvents( t,phyid,seedname ) if not evolEvents: return #create orthologs graph ortho_graph=MyGraph( t.get_leaf_names() ) #non-directed graph #populate it with orthologs for e in filter( lambda x: x.etype=='S',evolEvents ): #seednode.get_my_evol_events() ): for o1 in e.out_seqs: for o2 in e.in_seqs: ortho_graph.add_line( o1,o2 ) return ortho_graph
def get_orthology_graph(t, seedname, phyid): """Return graph representing orthology relationships from the tree.""" #get evol_events evolEvents, seednode = get_evolEvents(t, phyid, seedname) if not evolEvents: return #create orthologs graph ortho_graph = MyGraph(t.get_leaf_names()) #non-directed graph #populate it with orthologs for e in filter(lambda x: x.etype == 'S', evolEvents): #seednode.get_my_evol_events() ): for o1 in e.out_seqs: for o2 in e.in_seqs: ortho_graph.add_line(o1, o2) return ortho_graph
def populate_orthology_graph( t,seedname,phyid,species_list ): #get seed orthologs orthologs=get_orthologs( t,seedname,phyid,species_list ) if not orthologs: return [],None #create orthologs graph ortho_graph=MyGraph( orthologs ) #non-directed graph #populate it with orthologs for orth in orthologs: if orth==seedname: continue ortho_graph.add_line( seedname, orth ) #mark all orthologs of given ortholog in the graph for orth_in in get_orthologs( t,orth,phyid,species_list ): if orth_in in orthologs: ortho_graph.add_line( orth, orth_in ) return orthologs,ortho_graph