pegasus.gsea
- pegasus.gsea(data, rank_key, pathways, method='gseapy', gsea_key='gsea_out', min_size=15, max_size=500, n_jobs=4, seed=0, verbose=True, **kwargs)[source]
Perform Gene Set Enrichment Analysis (GSEA).
- Parameters
data (
MultimodalDataorUnimodalData) – Single-cell or pseudo-bulk data.rank_key (
str) – Key in pre-computed DE results representing gene ranks. The string format isde_key:attr, wherede_keyis the key of DE results indata.varm, andattris the column name indata.varm['de_key']used as the gene signatures for GSEA analysis.pathways (
str) – Either a keyword or a path to the gene set file in GMT format. If keyword, choosing from “hallmark” and “canonical_pathways” (MSigDB H and C2/CP).method (
str, optional, default:gseapy) – Specify which package to use as the backend for GSEA. By defaultgseapy, use GSEAPY’s prerank method. Notice thatpermutation_num=1000is set by default. If you want to change these parameters, please reset inkwargs. Alternatively, if specifyfgsea, then use R packagefgsea, which requiresrpy2and R installation.gsea_key (
str, optional, default:"gsea_out") – Key to use to store GSEA results as a data frame.min_size (
int, optional, default:15) – Minimum allowed number of genes from gene set also the data set.max_size (
int, optional, default:500) – Maximum allowed number of genes from gene set also the data set.n_jobs (
int, optional, default:4) – Numbr of threads used for parallel computation.seed (
int, optional, default:0) – Random seed to make sure GSEA results are reproducible.verbose (
bool, optional, default:True) – If printing out progress of the job. Only works whenmethod="gseapy".kwargs – If
method="gseapy", pass other keyword arguments togseapy.prerankfunction. Details about GSEAPY prerank function’s optional parameters are here.
- Return type
None- Returns
NoneUpdate
data.uns–data.uns[gsea_key]: GSEA outputs sorted by q-values (adjusted p-values) in ascending order, and if q-values are equal, sort by NES scores in descending order.
Examples
>>> pg.gsea(data, "deseq2:stat", "canonical_pathways") >>> pg.gsea(data, "de_res:1:mwu_U", "canonical_pathways", method="fgsea")