decoupler.run_wmean

decoupler.run_wmean(mat, net, source='source', target='target', weight='weight', times=1000, batch_size=10000, min_n=5, seed=42, verbose=False, use_raw=True)

Weighted mean (WMEAN).

WMEAN infers regulator activities by performing the weighted sum of the targets and weights, divided by the absolute sum of the weights to obtain an enrichment score (wmean_estimate). Furthermore, permutations of random target features can be performed to obtain a null distribution that can be used to compute a z-score (wmean_norm), or a corrected estimate (wmean_corr) by multiplying wmean_estimate by the minus log10 of the obtained empirical p-value.

Parameters:
matlist, DataFrame or AnnData

List of [features, matrix], dataframe (samples x features) or an AnnData instance.

netDataFrame

Network in long format.

sourcestr

Column name in net with source nodes.

targetstr

Column name in net with target nodes.

weightstr

Column name in net with weights.

timesint

How many random permutations to do.

batch_sizeint

Size of the batches to use. Increasing this will consume more memmory but it will run faster.

min_nint

Minimum of targets per source. If less, sources are removed.

seedint

Random seed to use.

verbosebool

Whether to show progress.

use_rawbool

Use raw attribute of mat if present.

Returns:
estimateDataFrame

WMEAN scores. Stored in .obsm[‘wmean_estimate’] if mat is AnnData.

normDataFrame

Normalized WMEAN scores. Stored in .obsm[‘wmean_norm’] if mat is AnnData.

corrDataFrame

Corrected WMEAN scores. Stored in .obsm[‘wmean_corr’] if mat is AnnData.

pvalsDataFrame

Obtained p-values. Stored in .obsm[‘wmean_pvals’] if mat is AnnData.