pegasus.de_analysis

pegasus.de_analysis(data, cluster, condition=None, subset=None, result_key='de_res', n_jobs=- 1, auc=True, t=True, fisher=False, mwu=False, temp_folder=None, verbose=True)[source]

Perform Differential Expression (DE) Analysis on data.

Parameters
  • data (anndata.AnnData) – Annotated data matrix with rows for cells and columns for genes.

  • cluster (str) – Cluster labels used in DE analysis. Must exist in data.obs.

  • condition (str, optional, default: None) – Sample attribute used as condition in DE analysis. If None, no condition is considered; otherwise, must exist in data.obs.

  • subset (str, optional, default: None) – Perform DE analysis on only a subset of cluster IDs. Cluster ID subset is specified as "clust_id1,clust_id2,...,clust_idn", where all IDs must exist in data.obs[cluster].

  • result_key (str, optional, default: "de_res") – Key name of DE analysis result stored.

  • n_jobs (int, optional, default: -1) – Number of threads to use. If -1, use all available threads.

  • auc (bool, optional, default: True) – If True, calculate area under ROC (AUROC) and area under Precision-Recall (AUPR).

  • t (bool, optional, default: True) – If True, calculate Welch’s t test.

  • fisher (bool, optional, default: False) – If True, calculate Fisher’s exact test.

  • mwu (bool, optional, default: False) – If True, calculate Mann-Whitney U test.

  • temp_folder (str, optional, default: None) – Joblib temporary folder for memmapping numpy arrays.

  • verbose (bool, optional, default: True) – If True, show detailed intermediate output.

Return type

None

Returns

  • None

  • Update data.varmdata.varm[result_key]: DE analysis result.

Examples

>>> pg.de_analysis(adata, cluster = 'spectral_leiden_labels')

subset: a comma-separated list of cluster labels. Then de will be performed only on these subsets.