Return all relationships seen in GO Dag subset.
484124
def _get_all_relationships(self):
        """"""
        relationships_all = set()
        for goterm in self.go2obj.values():
            if goterm.relationship:
                relationships_all.update(goterm.relationship)
            if goterm.relationship_rev:
                relationships_all.update(goterm.relationship_rev)
        return relationships_all
1351680
def get_all_parents(go_objs):
    """"""
    go_parents = set()
    for go_obj in go_objs:
        go_parents |= go_obj.get_all_parents()
    return go_parents
479847
def get_gene2gos(go2nt):
        """"""
        gene2gos = cx.defaultdict(set)
        nt0 = next(iter(go2nt.values()))
        b_str = isinstance(nt0.study_items, str)
        # print("NNNNTTTT", nt0)
        for goid, ntgo in go2nt.items():
            study_items = ntgo.study_items.split(', ') if b_str else ntgo.study_items
            for geneid in study_items:
                gene2gos[geneid].add(goid)
        if b_str:
          b_set = set(isinstance(g.isdigit(), int) for g in nt0.study_items.split(', '))
          if b_set == set([True]):
            return {int(g):gos for g, gos in gene2gos.items()}
        return {g:gos for g, gos in gene2gos.items()}
1314783
def get_nodes(graph: BELGraph, node_predicates: NodePredicates) -> Set[BaseEntity]:
    """"""
    return set(filter_nodes(graph, node_predicates=node_predicates))
1168957
def relations(cls):
        
        return [c.key for c in cls.__mapper__.iterate_properties
                if isinstance(c, RelationshipProperty)]
321587
def _infer_child_relations_iter(graph, node: BaseEntity) -> Iterable[str]:
    """"""
    for child in iter_children(graph, node):
        yield from transfer_causal_edges(graph, node, child)
        yield from infer_child_relations(graph, child)
275873
public List<ExtendedRelation> getRelationships() {
		List<ExtendedRelation> result = null;
		try {
			if (extendedRelationsDao.isTableExists()) {
				result = extendedRelationsDao.queryForAll();
			} else {
				result = new ArrayList<>();
			}
		} catch (SQLException e) {
			throw new GeoPackageException("Failed to query for relationships "
					+ "in " + EXTENSION_NAME, e);
		}
		return result;
	}
1145525
def common_parent_go_ids(goids, godag):
    '''
        
    '''
    # Find candidates from first
    rec = godag[goids[0]]
    candidates = rec.get_all_parents()
    candidates.update({goids[0]})

    # Find intersection with second to nth goid
    for goid in goids[1:]:
        rec = godag[goid]
        parents = rec.get_all_parents()
        parents.update({goid})

        # Find the intersection with the candidates, and update.
        candidates.intersection_update(parents)
    return candidates
1121226
def get_c2ps(self):
        """"""
        c2ps = defaultdict(set)
        for goid_child, goid_parent in self.edges:
            c2ps[goid_child].add(goid_parent)
        return c2ps
84286
def _traverse_relationship_objs(self, rel2src2dsts, goobj_child, goids_seen):
        """"""
        child_id = goobj_child.id
        goids_seen.add(child_id)
        ##A self.go2obj[child_id] = goobj_child
        # Update goids_seen and go2obj with child alt_ids
        for goid_altid in goobj_child.alt_ids:
            goids_seen.add(goid_altid)
            ##A self.go2obj[goid_altid] = goobj_child
        # Loop through relationships of child object
        for reltype, recs in goobj_child.relationship.items():
            if reltype in self.relationships:
                for relationship_obj in recs:
                    relationship_id = relationship_obj.id
                    rel2src2dsts[reltype][relationship_id].add(child_id)
                    # If relationship has not been seen, traverse
                    if relationship_id not in goids_seen:
                        self._traverse_relationship_objs(rel2src2dsts, relationship_obj, goids_seen)
206819
def _get_pltdag_ancesters(self, hdrgo, usrgos, desc=""):
        """"""
        go_srcs = usrgos.union([hdrgo])
        gosubdag = GoSubDag(go_srcs,
                            self.gosubdag.get_go2obj(go_srcs),
                            relationships=self.gosubdag.relationships,
                            rcntobj=self.gosubdag.rcntobj,
                            go2nt=self.gosubdag.go2nt)
        tot_usrgos = len(set(gosubdag.go2obj.keys()).intersection(self.usrgos))
        return self.ntpltgo(
            hdrgo=hdrgo,
            gosubdag=gosubdag,
            tot_usrgos=tot_usrgos,
            parentcnt=False,
            desc=desc)
22740
def get_dag_configs(self) -> Dict[str, Dict[str, Any]]:
        
        return {dag: self.config[dag] for dag in self.config.keys() if dag != "default"}
766346
def get_id2gos_all(taxid2asscs_a2b):
        """"""
        id2gos_all = {}
        for a2b in taxid2asscs_a2b.values():
            for geneid, gos in a2b['ID2GOs'].items():
                id2gos_all[geneid] = gos
        return id2gos_all
957661
def _get_goid2dbids(associations):
        """"""
        go2ids = cx.defaultdict(set)
        for ntd in associations:
            go2ids[ntd.GO_ID].add(ntd.DB_ID)
        return dict(go2ids)
623929
def get_independent_nodes(dag):
    """"""
    nodes = set(dag.keys())
    dependent_nodes = set([node for downstream_nodes in dag.values() for node in downstream_nodes])
    return set(nodes - dependent_nodes)
1226253
def get_usrgos_w_parents(self, hdrgos, usrgos_all=None):
        """"""
        usrgos = set()
        _go2parents = self.gosubdag.rcntobj.go2parents
        if usrgos_all is None:
            usrgos_all = self.usrgos
        for usrgo in usrgos_all:
            all_usrgo_parents = _go2parents.get(usrgo)
            sel_usrgo_parents = all_usrgo_parents.intersection(hdrgos)
            if sel_usrgo_parents:
                usrgos.add(usrgo)
        return usrgos
765402
def get_associations(self, env):
        

        if env.is_root:
            return None

        associations = self.associations.get_all()
        return [assoc for assoc in associations
                if associations[assoc] == self._get_view_path(env)]