Skip to contents

Calculates regulatory activities using WMEAN.

Usage

run_wmean(
  mat,
  network,
  .source = source,
  .target = target,
  .mor = mor,
  .likelihood = likelihood,
  times = 100,
  seed = 42,
  sparse = TRUE,
  randomize_type = "rows",
  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.

times

How many permutations to do?

seed

A single value, interpreted as an integer, or NULL for random number generation.

sparse

Should the matrices used for the calculation be sparse?

randomize_type

How to randomize the expression matrix.

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).

  5. p_value: p-value for the score of the method.

Details

WMEAN infers regulator activities by first multiplying each target feature by its associated weight which then are summed to an enrichment score wmean. Furthermore, permutations of random target features can be performed to obtain a null distribution that can be used to compute a z-score norm_wmean, or a corrected estimate corr_wmean by multiplying wmean by the minus log10 of the obtained empirical p-value.

See also

Other decoupleR statistics: decouple(), run_aucell(), run_fgsea(), run_gsva(), run_mdt(), run_mlm(), run_ora(), run_udt(), run_ulm(), run_viper(), 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_wmean(mat, net, minsize=0)
#> # A tibble: 216 × 5
#>    statistic  source condition score p_value
#>    <chr>      <chr>  <chr>     <dbl>   <dbl>
#>  1 corr_wmean T1     S01        15.0    0.02
#>  2 corr_wmean T1     S02        14.7    0.02
#>  3 corr_wmean T1     S03        15.2    0.02
#>  4 corr_wmean T1     S04        15.7    0.02
#>  5 corr_wmean T1     S05        14.4    0.02
#>  6 corr_wmean T1     S06        14.2    0.02
#>  7 corr_wmean T1     S07        14.8    0.02
#>  8 corr_wmean T1     S08        14.8    0.02
#>  9 corr_wmean T1     S09        15.3    0.02
#> 10 corr_wmean T1     S10        13.8    0.02
#> # ℹ 206 more rows