rapids_singlecell.dcg.viper#

rapids_singlecell.dcg.viper = <rapids_singlecell.decoupler_gpu._helper._Method.Method object>#

Virtual Inference of Protein-activity by Enriched Regulon analysis (VIPER).

Rank molecular features within each observation and transform their ranks to normal quantiles. Combine signed and unsigned enrichment using the network weights to obtain normalized activity scores. Two-sided normal p-values are adjusted by Benjamini-Hochberg across sources.

By default, pleiotropy correction penalizes shared targets of significantly enriched regulators and recomputes their activity scores.

Finally, the obtained pvalue are adjusted by Benjamini-Hochberg correction.

Parameters:
data

AnnData instance, DataFrame or tuple of [matrix, samples, features].

net

Dataframe in long format. Must include source and target columns, and optionally a weight column.

tmin

Minimum number of targets per source. Sources with fewer targets will be removed.

layer

Layer key name of an anndata.AnnData instance.

raw

Whether to use the .raw attribute of anndata.AnnData.

empty

Whether to remove empty observations (rows) or features (columns).

bsize

For large datasets in sparse format, this parameter controls how many observations are processed at once. Increasing this value speeds up computation but uses more memory. If omitted, uses the method’s default batch size.

verbose

Whether to display progress messages and additional execution details.

pre_load

Whether to pre-load the data into memory. If True, the data will be pre-loaded into memory before processing.

adj_pv_gpu

Whether to use GPU for adjusting p-values.

pleiotropy

Whether to correct for pleiotropic regulation.

reg_sign

P-value threshold for selecting significant regulators for pleiotropy correction. Must lie strictly between zero and one.

n_targets

Shared-target count must be strictly greater than this nonnegative integer to apply pleiotropy correction, matching decoupler.

penalty

Positive penalty exponent for pleiotropic interactions.

Returns:

Enrichment scores ES and, if applicable, adjusted pvalue by Benjamini-Hochberg.

Notes

Ties receive average ranks. As in decoupler, the unsigned rank transform uses a batch-wide adjustment. When all observations have tied extreme values, scores can depend on bsize or Dask chunk boundaries.

Scoring and pleiotropy correction run entirely on the GPU. Signed sums within floating-point roundoff of zero are treated as zero when an unsigned contribution could amplify their sign. Such cancellation cases can differ from decoupler’s CPU-dependent rounding.

Example

import decoupler as dc
import rapids_singlecell as rsc

adata, net = dc.ds.toy()
rsc.dcg.viper(adata, net, tmin=3)