def get_goterm_genes(self, id_, descendants=True):
        """Return all genes that are annotated with a particular GO term.

        Parameters
        ----------
        id_: str
            GO term ID of the GO term.
        descendants: bool, optional
            If set to False, only return genes that are directly annotated with
            the specified GO term. By default, also genes annotated with any
            descendant term are returned.

        Returns
        -------
        Notes
        """

        # determine which terms to include
        main_term = self.terms[id_]
        check_terms = {main_term, }

        if descendants:
            assert self._flattened
            check_terms.update([self.terms[id_]
                                for id_ in main_term.descendants])

        # get annotations of all included terms
        genes = set()
        for term in check_terms:
            genes.update(ann.gene for ann in self.term_annotations[term.id])

        return frozenset(genes)