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−μσ.

  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 ES is computed as the mean of these signed z-scores across methods.

ES=∑m=1Mzi(m)M

Where:

  • M is the number of methods

  • zi(m) is the z-score from method m.

A two-sided pvalue is then calculated from the consensus score using the survival function sf of the standard normal distribution.

p=2×sf(|ES|)

Finally, the obtained pvalue 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)