def get_static_enrichment(<EOL>self, genes: Iterable[str],<EOL>pval_thresh: float,<EOL>adjust_pval_thresh: bool = True,<EOL>K_min: int = <NUM_LIT:3>,<EOL>gene_set_ids: Iterable[str] = None) -> StaticGSEResult:
genes = set(genes)<EOL>gene_set_coll = self._gene_set_coll<EOL>gene_sets = self._gene_set_coll.gene_sets<EOL>gene_memberships = self._gene_memberships<EOL>sorted_genes = sorted(genes)<EOL>if gene_set_ids is not None:<EOL><INDENT>gs_indices = np.int64([self._gene_set_coll.index(id_)<EOL>for id_ in gene_set_ids])<EOL>gene_sets = [gene_set_coll[id_] for id_ in gene_set_ids]<EOL>gene_memberships = gene_memberships[:, gs_indices]  <EOL><DEDENT>K_vec = np.sum(gene_memberships, axis=<NUM_LIT:0>, dtype=np.int64)<EOL>sel = np.nonzero(K_vec >= K_min)[<NUM_LIT:0>]<EOL>K_vec = K_vec[sel]<EOL>gene_sets = [gene_sets[j] for j in sel]<EOL>gene_memberships = gene_memberships[:, sel]<EOL>unknown = <NUM_LIT:0><EOL>sel = []<EOL>filtered_genes = []<EOL>logger.debug('<STR_LIT>', len(sorted_genes))<EOL>for i, g in enumerate(sorted_genes):<EOL><INDENT>try:<EOL><INDENT>idx = self._gene_indices[g]<EOL><DEDENT>except KeyError:<EOL><INDENT>unknown += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>sel.append(idx)<EOL>filtered_genes.append(g)<EOL><DEDENT><DEDENT>sel = np.int64(sel)<EOL>gene_indices = np.int64(sel)<EOL>k_vec = np.sum(gene_memberships[sel, :], axis=<NUM_LIT:0>, dtype=np.int64)<EOL>if unknown > <NUM_LIT:0>:<EOL><INDENT>logger.warn('<STR_LIT>',<EOL>unknown, len(genes),<EOL><NUM_LIT:100> * (unknown / float(len(genes))))<EOL><DEDENT>n = len(filtered_genes)<EOL>N, m = gene_memberships.shape<EOL>logger.info('<STR_LIT>', m)<EOL>final_pval_thresh = pval_thresh<EOL>if adjust_pval_thresh:<EOL><INDENT>final_pval_thresh /= float(m)<EOL>logger.info('<STR_LIT>',<EOL>final_pval_thresh)<EOL><DEDENT>enriched = []<EOL>logger.debug('<STR_LIT>', N, n)<EOL>sys.stdout.flush()<EOL>genes = self._valid_genes<EOL>for j in range(m):<EOL><INDENT>pval = hypergeom.sf(k_vec[j] - <NUM_LIT:1>, N, K_vec[j], n)<EOL>if pval <= final_pval_thresh:<EOL><INDENT>sel_genes = [genes[i] for i in<EOL>np.nonzero(gene_memberships[gene_indices, j])[<NUM_LIT:0>]]<EOL>enriched.append(<EOL>StaticGSEResult(gene_sets[j], N, n, set(sel_genes), pval))<EOL><DEDENT><DEDENT>return enriched<EOL>
Find enriched gene sets in a set of genes.

        Parameters
        ----------
        genes : set of str
            The set of genes to test for gene set enrichment.
        pval_thresh : float
            The significance level (p-value threshold) to use in the analysis.
        adjust_pval_thresh : bool, optional
            Whether to adjust the p-value threshold using a Bonferroni
            correction. (Warning: This is a very conservative correction!)
            [True]
        K_min : int, optional
            The minimum number of gene set genes present in the analysis. [3]
        gene_set_ids : Iterable or None
            A list of gene set IDs to test. If ``None``, all gene sets are
            tested that meet the :attr:`K_min` criterion.

        Returns
        -------
        list of `StaticGSEResult`
            A list of all significantly enriched gene sets.