Skip to contents

Calculates regulatory activities using MLM.

Usage

run_mlm(
  mat,
  network,
  .source = source,
  .target = target,
  .mor = mor,
  .likelihood = likelihood,
  sparse = FALSE,
  center = FALSE,
  na.rm = FALSE,
  minsize = 5
)

Arguments

mat

Matrix to evaluate (e.g. expression matrix). Target nodes in rows and conditions in columns. rownames(mat) must have at least one intersection with the elements in network .target column.

network

Tibble or dataframe with edges and it's associated metadata.

.source

Column with source nodes.

.target

Column with target nodes.

.mor

Column with edge mode of regulation (i.e. mor).

.likelihood

Deprecated argument. Now it will always be set to 1.

sparse

Deprecated parameter.

center

Logical value indicating if mat must be centered by base::rowMeans().

na.rm

Should missing values (including NaN) be omitted from the calculations of base::rowMeans()?

minsize

Integer indicating the minimum number of targets per source.

Value

A long format tibble of the enrichment scores for each source across the samples. Resulting tibble contains the following columns:

  1. statistic: Indicates which method is associated with which score.

  2. source: Source nodes of network.

  3. condition: Condition representing each column of mat.

  4. score: Regulatory activity (enrichment score).

Details

MLM fits a multivariate linear model for each sample, where the observed molecular readouts in mat are the response variable and the regulator weights in net are the covariates. Target features with no associated weight are set to zero. The obtained t-values from the fitted model are the activities (mlm) of the regulators in net.

See also

Other decoupleR statistics: decouple(), run_aucell(), run_fgsea(), run_gsva(), run_mdt(), run_ora(), run_udt(), run_ulm(), run_viper(), run_wmean(), run_wsum()

Examples

inputs_dir <- system.file("testdata", "inputs", package = "decoupleR")

mat <- readRDS(file.path(inputs_dir, "mat.rds"))
net <- readRDS(file.path(inputs_dir, "net.rds"))

run_mlm(mat, net, minsize=0)
#> # A tibble: 72 × 5
#>    statistic source condition   score p_value
#>    <chr>     <chr>  <chr>       <dbl>   <dbl>
#>  1 mlm       T1     S01        3.52   0.00781
#>  2 mlm       T2     S01       -1.13   0.290  
#>  3 mlm       T3     S01       -0.247  0.811  
#>  4 mlm       T1     S02        3.48   0.00831
#>  5 mlm       T2     S02       -0.213  0.837  
#>  6 mlm       T3     S02       -0.353  0.733  
#>  7 mlm       T1     S03        3.15   0.0135 
#>  8 mlm       T2     S03       -0.638  0.541  
#>  9 mlm       T3     S03        0.0749 0.942  
#> 10 mlm       T1     S04        3.82   0.00512
#> # ℹ 62 more rows