decoupler.mt.aucell

Contents

decoupler.mt.aucell#

decoupler.mt.aucell = <decoupler._Method.Method object>#

Area Under the Curve for set enrichment within single cells (AUCell) [AGBM+17].

Given a ranked list of features per observation, AUCell calculates the AUC by measuring how early the features in the set appear in this ranking. Specifically, the enrichment score ESES is:

ESi,F=01RecoveryCurvei,F(ri)dr{ES}_{i, F} = \int_0^1 {RecoveryCurve}_{i, F}(r_i) \, dr

Where:

  • ii is the obervation

  • FF is the feature set

  • RecoveryCurvei,F(ri){RecoveryCurve}_{i, F}(r_i) is the proportion of features from FF recovered in the top rir_i-fraction of the ranked list for observation ii

This method does not perform statistical testing on ESES and therefore does not return pvaluep_{value}.

Parameters:
  • data

    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 in long format. Must include source and target columns, and optionally a weight column.

  • tmin (default: 5) – Minimum number of targets per source. Sources with fewer targets will be removed.

  • layer – Layer key name of an anndata.AnnData instance.

  • raw (default: False) – Whether to use the .raw attribute of anndata.AnnData.

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

  • bsize (default: 250000) – 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 (default: False) – Whether to display progress messages and additional execution details.

  • n_up – Number of features to include in the AUC calculation. If None, the top 5% of features based on their magnitude are selected.

Returns:

Enrichment scores ESES and, if applicable, adjusted pvaluep_{value} by Benjamini-Hochberg.

Example

import decoupler as dc

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