decoupler.mt.consensus

Contents

decoupler.mt.consensus#

decoupler.mt.consensus(result, verbose=False)#

Consensus score across methods.

For each method, enrichment scores are split into positive and negative subsets and transformed independently into z-scores.

  1. Subset values based on sign (direction).

  2. Mirror each subset into positive and negative values with the same magnitude.

  3. Compute z-scores for each subset: zi=xiμσz_i = \frac{x_i - \mu}{\sigma}.

  4. Restore the original signs to the z-scored values

This transformation ensures comparability across methods while preserving the biological interpretation of activation (positive) and inhibition (negative). The final consensus enrichment score ESES is computed as the mean of these signed z-scores across methods.

ES=m=1Mzi(m)MES = \frac{\sum_{m=1}^{M} z_{i}^{(m)}}{M}

Where:

  • MM is the number of methods

  • zi(m)z_{i}^{(m)} is the z-score from method mm.

A two-sided pvaluep_{value} is then calculated from the consensus score using the survival function sfsf of the standard normal distribution.

p=2×sf(ES)p = 2 \times \mathrm{sf}\bigl(\lvert \mathrm{ES} \rvert \bigr)

Finally, the obtained pvaluep_{value} are adjusted by Benjamini-Hochberg correction.

Parameters:
  • result (dict | AnnData) – Results from decoupler.mt.decouple.

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

Return type:

tuple[DataFrame, DataFrame] | None

Returns:

Consensus enrichment scores and p-values.

Example

import decoupler as dc

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