ggml_ot.gene.enrichment#
- ggml_ot.gene.enrichment(adata, n_genes=50, components=None, gene_symbols=None, up_regulated=False, down_regulated=False, ordered=False, alpha=0.05, organism='hsapiens', max_terms=None, log_axis=False, orient='v', wrap_width=35, figsize=None, font_size=None, save=None, show=None, **kwargs)[source]#
Performs enrichment analysis on top-ranked genes and visualizes the enriched biological terms.
- Parameters:
- adata
Anndata object
- n_genes default:
50 Number of considered top-ranked genes
- components default:
None One-based component IDs. For example,
'1,2,3'means the first, second, and third GGML component. Defaults to all GGML components.- gene_symbols
Optional[str] (default:None) Key for field in .var that stores gene symbols if you do not want to use .var_names.
- up_regulated default:
False If True, run enrichment on genes with the largest positive loadings.
- down_regulated default:
False If True, run enrichment on genes with the largest negative loadings. When both flags are equal, absolute loadings are used.
- ordered default:
False Whether the gene lists are ordered by importance
- alpha default:
0.05 Threshold for significance in enrichment
- organism default:
'hsapiens' Organism ID for g:Profiler
- max_terms
Optional[int] (default:None) Maximum number of enriched terms shown per component.
Noneshows all enriched terms.- log_axis default:
False Whether to plot
-log10(p_value)instead of raw p-values.- orient default:
'v' Whether to layout the plots horizontally (
"h") or vertically ("v").- wrap_width
Optional[int] (default:35) Maximum number of characters per line for term names. Long names are wrapped at word boundaries to fit within this width.
Nonedisables wrapping.- figsize
Optional[tuple[float,float]] (default:None) Figure size (width, height) in inches.
Noneuses a default that scales with the number of components.- font_size
Optional[float] (default:None) Base font size in points applied to ticks, labels, titles, and the alpha annotation.
Nonekeeps matplotlib defaults. Use this together withfigsizeto tune the text-to-plot ratio.- show
Optional[bool] (default:None) Whether to display the plot.
None(default) automatically shows in interactive environments (notebooks, IPython) and suppresses in scripts.True/Falseoverride explicitly.- save
UnionType[str,bool,None] (default:None) Whether to save the figure to disk.
None/Falseskip saving.Truesaves under the default name intosettings.figdir. A str is used as the filename.- kwargs
Passed to sns.barplot