decoupler.mt.ulm#

decoupler.mt.ulm = <decoupler._Method.Method object>#

Univariate Linear Model (ULM) [BiMVSB+22].

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

Univariate Linear Model (ULM) schematic.

Univariate Linear Model (ULM) scheme. In this example, the observed gene expression of Sample1 is predicted using the interaction weights of TF1. Since the target genes that have negative weights are lowly expressed, and the positive target genes are highly expressed, the relationship between the two variables is positive so the obtained ES score is positive. Scores can be interpreted as active when positive, repressive when negative, and inconclusive when close to 0.#

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.AnnData instance, pandas.DataFrame, or a tuple of (matrix, samples, features). All methods assume that input values follow a normal distribution unless otherwise specified. Therefore, when working with observational count data, some form of normalization is required (e.g., scanpy’s library-size normalization followed by log1p). Using raw integer counts is not recommended, as they follow a Poisson distribution.

Feature scaling on normalized counts is also acceptable, but note that it changes the results by assuming equal importance across features, and outcomes will vary depending on which observations are included.

No normalization or transformation is required when using contrast-level feature statistics such as log fold changes or Wald test statistics.

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.

verbose

Whether to display progress messages and additional execution details.

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