def get_gene_goterms(self, gene, ancestors=False):
        """Return all GO terms a particular gene is annotated with.

        Parameters
        ----------
        gene: str
            The gene symbol of the gene.
        ancestors: bool, optional
            If set to True, also return all ancestor GO terms.


        Returns
        -------
        set of GOTerm objects
            The set of GO terms the gene is annotated with.

        Notes
        -----
        If a gene is annotated with a particular GO term, it can also be
        considered annotated with all ancestors of that GO term.
        """
        annotations = self.gene_annotations[gene]
        terms = set(ann.term for ann in annotations)

        if ancestors:
            assert self._flattened
            ancestor_terms = set()
            for t in terms:
                ancestor_terms.update(self.terms[id_] for id_ in t.ancestors)
            terms |= ancestor_terms

        return frozenset(terms)
def get_gene_goterms ( self , gene , ancestors = False ) : annotations = self . gene_annotations [ gene ] terms = set ( ann . term for ann in annotations ) if ancestors : assert self . _flattened ancestor_terms = set ( ) for t in terms : ancestor_terms . update ( self . terms [ id_ ] for id_ in t . ancestors ) terms |= ancestor_terms return frozenset ( terms )
Return all GO terms a particular gene is annotated with.

        Parameters
        ----------
        gene: str
            The gene symbol of the gene.
        ancestors: bool, optional
            If set to True, also return all ancestor GO terms.


        Returns
        -------
        set of GOTerm objects
            The set of GO terms the gene is annotated with.

        Notes
        -----
        If a gene is annotated with a particular GO term, it can also be
        considered annotated with all ancestors of that GO term.