rapids_singlecell.dcg.ulm#

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

Univariate Linear Model (ULM).

This approach uses the molecular features from one observation as the population of samples and it fits a linear model with a single covariate, which is the feature weights of a set F.

yi=β0+β1xi+ε,i=1,2,...,n

Where:

  • yi is the observed feature statistic (e.g. gene expression, log2FC, etc.) for feature i

  • xi is the weight of feature i in feature set F. For unweighted sets, membership in the set is indicated by 1, and non-membership by 0.

  • β0 is the intercept

  • β1 is the slope coefficient

  • ε is the error term for feature i

The enrichment score ES is then calculated as the t-value of the slope coefficient.

ES=tβ1=βˆ1SE(βˆ1)

Where:

  • tβ1 is the t-value of the slope

  • SE(βˆ1) is the standard error of the slope

Next, pvalue are obtained by evaluating the two-sided survival function (sf) of the Student’s t-distribution.

pvalue=2×sf(|ES|,df)

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.

tval

Whether to return the t-value (tval=True) the coefficient of the fitted model (tval=False).

Returns:

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

Example

import decoupler as dc

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