decoupler.mt.decouple

Contents

decoupler.mt.decouple#

decoupler.mt.decouple(data, net, methods='all', args=None, cons=False, **kwargs)#

Runs multiple enrichment methods sequentially.

Parameters:
  • data (AnnData | DataFrame | tuple[ndarray, ndarray, ndarray]) –

    anndata.AnnData instance, pandas.DataFrame, or a tuple of (matrix, samples, features). All methods assume that input values follow a normal distribution unless otherwise specified. Therefore, when working with observational count data, some form of normalization is required (e.g., scanpy’s library-size normalization followed by log1p). Using raw integer counts is not recommended, as they follow a Poisson distribution.

    Feature scaling on normalized counts is also acceptable, but note that it changes the results by assuming equal importance across features, and outcomes will vary depending on which observations are included.

    No normalization or transformation is required when using contrast-level feature statistics such as log fold changes or Wald test statistics.

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

  • methods (str | list (default: 'all')) – List of methods to run.

  • args (dict | None (default: None)) – Dictionary of dictionaries containing method-specific keyword arguments.

  • cons (bool (default: False)) – Whether to get a consensus score across the used methods.

  • tmin – Minimum number of targets per source. Sources with fewer targets will be removed.

  • raw – Whether to use the .raw attribute of anndata.AnnData.

  • empty – Whether to remove empty observations (rows) or features (columns).

  • bsize – For large datasets in sparse format, this parameter controls how many observations are processed at once. Increasing this value speeds up computation but uses more memory.

  • verbose – Whether to display progress messages and additional execution details.

Return type:

dict | None

Returns:

Dictionary of results or as .obsm keys in the provided AnnData.

Example

import decoupler as dc

adata, net = dc.ds.toy()
dc.mt.decouple(adata, net, tmin=3)