def get_paths_from_to(self, goobj_start, goid_end=None, dn0_up1=True):
        """Get a list of paths from goobj_start to either top or goid_end."""
        paths = []
        # Queue of terms to be examined (and storage for their paths)
        working_q = cx.deque([[goobj_start]])
        # Loop thru GO terms until we have examined all needed GO terms
        adjfnc = self.adjdir[dn0_up1]
        while working_q:
            #print "WORKING QUEUE LEN({})".format(len(working_q))
            path_curr = working_q.popleft()
            goobj_curr = path_curr[-1]
            go_adjlst = adjfnc(goobj_curr)
            #print 'END', goid_end, goobj_curr
            # If this GO term is the endpoint, Stop. Store path.
            if (goid_end is not None and goobj_curr.id == goid_end) or \
               (goid_end is None and not go_adjlst):
                paths.append(path_curr)
            # Else if this GO term is the not the end, add neighbors to path
            else:
                for go_neighbor in go_adjlst:
                    if go_neighbor not in path_curr:
                        #print "{}'s NEIGHBOR IS {}".format(goobj_curr.id, go_neighbor.id)
                        new_path = path_curr + [go_neighbor]
                        #sys.stdout.write(" {}'s {} {}\n".format(goobj_curr, up_dn, go_neighbor))
                        working_q.append(new_path)
        #self.prt_paths(paths)
        return paths
def get_paths_from_to ( self , goobj_start , goid_end = None , dn0_up1 = True ) : paths = [ ] working_q = cx . deque ( [ [ goobj_start ] ] ) adjfnc = self . adjdir [ dn0_up1 ] while working_q : path_curr = working_q . popleft ( ) goobj_curr = path_curr [ - 1 ] go_adjlst = adjfnc ( goobj_curr ) if ( goid_end is not None and goobj_curr . id == goid_end ) or ( goid_end is None and not go_adjlst ) : paths . append ( path_curr ) else : for go_neighbor in go_adjlst : if go_neighbor not in path_curr : new_path = path_curr + [ go_neighbor ] working_q . append ( new_path ) return paths
Get a list of paths from goobj_start to either top or goid_end.