decoupler.run_wsum

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

Weighted sum (WSUM).

WSUM infers regulator activities by first multiplying each target feature by its associated weight which then are summed to an enrichment score (wsum_estimate). Furthermore, permutations of random target features can be performed to obtain a null distribution that can be used to compute a z-score (wsum_norm), or a corrected estimate (wsum_corr) by multiplying wsum_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

WSUM scores. Stored in .obsm[‘wsum_estimate’] if mat is AnnData.

normDataFrame

Normalized WSUM scores. Stored in .obsm[‘wsum_norm’] if mat is AnnData.

corrDataFrame

Corrected WSUM scores. Stored in .obsm[‘wsum_corr’] if mat is AnnData.

pvalsDataFrame

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