rapids_singlecell.dcg.mlm#

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

Multivariate Linear Model (MLM).

This approach uses the molecular features from one observation as the population of samples and it fits a linear model with with multiple covariates, which are the weights of all feature sets F.

yi=β0+β1x1i+β2x2i+⋯+βpxpi+ε

Where:

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

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

  • β0 is the intercept

  • βp is the slope coefficient for feature set Fp

  • ε is the error term for feature i

The enrichment score ES for each F is then calculated as the t-value of the slope coefficients.

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)
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.mlm(adata, net, tmin=3)