hucira.run_one_enrichment_test

hucira.run_one_enrichment_test#

hucira.run_one_enrichment_test(adata, df, celltype_combo, contrasts_combo, celltype_column, contrast_column, direction='upregulated', threshold_lfc=1.0, threshold_expression=0.0, threshold_pval=0.01, min_size=10, max_size=1000, permutation_num=1000, weight=1.0, seed=2025, verbose=False, threads=6)#

Compute cytokine enrichment activity in one cell type using GSEA scoring.

  1. “Looks up” query cell type in human cytokine dictionary and retrieves associated up-/downregulated genes per cytokine as reference.

  2. Creates ranking of query data genes contrasting condition 1 vs condition 2.

  3. Computes enrichment of each cytokine by matching their associated gene set in the ranked list.

Parameters:
  • adata (AnnData) – The query AnnData object.

  • df (pandas.DataFrame) – Human Cytokine Dictionary, CIP signatures, or custom gene-program DataFrame.

  • celltype_combo (tuple of (str, str)) – Cell-type name in the query adata (first) and the corresponding cell-type name in df (second).

  • celltype_column (str) – Column name in adata.obs that stores the cell types.

  • contrasts_combo (tuple of (str, str) or list of tuple) – Pair(s) of biological conditions to compare.

  • contrast_column (str) – Column name in adata.obs that stores condition labels.

  • direction (str) – One of "upregulated", "downregulated", or "both".

  • threshold_lfc (float) – Minimum log-fold change used to build the gene set.

  • threshold_expression (float) – Minimum mean gene expression across all cells.

  • threshold_pval (float) – Maximum adjusted p-value used to build the gene set.

  • min_size (int) – Minimum gene-set size passed to GSEA.

  • max_size (int) – Maximum gene-set size passed to GSEA.

  • permutation_num (int) – Number of permutations for GSEA.

  • weight (float) – GSEA weighting exponent.

  • seed (int) – Random seed for reproducibility.

  • verbose (bool) – Whether to print progress messages.

  • threads (int) – Number of threads for GSEA.

Return type:

DataFrame | None

Returns:

pandas.DataFrame DataFrame with all computed enrichment scores and statistical parameters. Not filtered by significance or robustness yet.