decoupler.bm.benchmark

Contents

decoupler.bm.benchmark#

decoupler.bm.benchmark(adata, net, metrics=None, groupby=None, runby='expr', sfilt=False, thr=0.1, emin=5, verbose=False, kws_decouple=None, **kwargs)#

Benchmark enrichment methods or networks on a given set of perturbation experiments.

Parameters:
  • adata (AnnData) – Annotated data matrix with observations (rows) and features (columns).

  • net (DataFrame | dict) – Dataframe in long format. Must include source and target columns, and optionally a weight column.

  • metrics (str | list | None (default: None)) – Which metrics to use to evaluate classification performance.

  • groupby (str | list | None (default: None)) – Whether to group experiments by a metadata column in anndata.AnnData.obs.

  • runby (str (default: 'expr')) – Whether to evaluate performances at the experiment ("expr") or at the source ("source") level.

  • sfilt (bool (default: False)) – Whether to fitler out sources in net for which there are not perturbation data.

  • thr (float (default: 0.1)) – Threshold of significance. Methods that generate no p-value will be consider significant if the thr > 1quantile1 - quantile

  • emin (int (default: 5)) – Minimum number of experiments per group.

  • verbose (bool (default: False)) – Whether to display progress messages and additional execution details.

  • kws_decouple (dict | None (default: None)) – Keyword arguments to pass to decoupler.mt.decouple.

Returns:

Dataframe containing metric scores.

Example

import decoupler as dc

adata, net = dc.ds.toy_bench()
df = dc.bm.benchmark(adata=adata, net=net, kws_decouple={"tmin": 3})
df