rapids_singlecell.dcg.run_wsum#
- rapids_singlecell.dcg.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)[source]#
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 multiplyingwsum_estimate
by the minus log10 of the obtained empirical p-value.- Parameters:
- mat
AnnData
|DataFrame
|list
List of [features, matrix], dataframe (samples x features) or an AnnData instance.
- net
DataFrame
Network in long format.
- source default:
'source'
Column name in net with source nodes.
- target default:
'target'
Column name in net with target nodes.
- weight default:
'weight'
Column name in net with weights.
- times default:
1000
How many random permutations to do.
- batch_size
int
(default:10000
) Size of the batches to use. Increasing this will consume more memory but it will run faster.
- min_n
int
(default:5
) Minimum of targets per source. If less, sources are removed.
- seed
int
(default:42
) Random seed to use.
- verbose
bool
(default:False
) Whether to show progress.
- use_raw
bool
(default:True
) Use raw attribute of mat if present.
- mat
- Return type:
- Returns:
Updates
adata
with the following fields.- estimateDataFrame
WSUM scores. Stored in
.obsm['wsum_estimate']
ifmat
is AnnData.- norm: DataFrame
Normalized WSUM scores. Stored in
.obsm['wsum_norm']
ifmat
is AnnData.- corrDataFrame
Corrected WSUM scores. Stored in
.obsm['wsum_corr']
ifmat
is AnnData.- pvalsDataFrame
Obtained p-values. Stored in
.obsm['wsum_pvals']
ifmat
is AnnData.