z_summary: Calculating Z summary

Description Usage Arguments Details Value Examples

View source: R/comparison.R

Description

Use the topological metrics and permutations from output of modulePreservation to compute a Z summary (a composite preservation statistic) as defined by https://doi.org/10.1371/journal.pcbi.1001057

Usage

1
z_summary(observed_stat, permutations_array)

Arguments

observed_stat

matrix, bidimensional matrix containing the topological matrix computed for each module by modulePreservation (the element observed). Modules are in row, metrics are in column.

permutations_array

matrix, tridimensional matrix containing the topological matrix computed for each module by modulePreservation (the element observed). Modules are in dim 1, metrics are in dim 2, permutations are in dim 3.

Details

The original Zsummary composite preservation statistic was defined by Langfelder et al. (2011). However this method use the metric from modulePreservation since they it handle better large and multiple testing correction.

Value

A named vector of the z summary statistic with the module id as name.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
expr_by_cond <- list(cond1 = kuehne_expr[1:24, 1:350],
                     cond2 = kuehne_expr[25:48, 1:350])
net_by_cond <- lapply(expr_by_cond, build_net, cor_func = "spearman",
                      n_threads = 1, keep_matrices = "both")

mods_labels <- setNames(
  sample(1:6, 350, replace = TRUE,
         prob = c(0.05, 0.4, 0.25, 0.15, 0.1, 0.05)),
  colnames(expr_by_cond$cond1))

netrep_res <- NetRep::modulePreservation(
  network = lapply(net_by_cond, `[[`, "adja_mat"),
  data = lapply(expr_by_cond, as.matrix),
  correlation = lapply(net_by_cond, `[[`, "cor_mat"),
  moduleAssignments = mods_labels,  nPerm = 100)

z_summary(netrep_res$observed, netrep_res$nulls)

mod_by_cond <- mapply(detect_modules, expr_by_cond,
                      lapply(net_by_cond, `[[`, "network"),
                      MoreArgs = list(detailled_result = TRUE),
                      SIMPLIFY = FALSE)

comparison <- compare_conditions(expr_by_cond,
                                 lapply(net_by_cond, `[[`, "adja_mat"),
                                 lapply(net_by_cond, `[[`, "cor_mat"),
                                 lapply(mod_by_cond, `[[`, "modules"),
                                 n_perm = 100)

z_summary(comparison$result$cond1$cond2$observed,
          comparison$result$cond1$cond2$nulls)

GWENA documentation built on Feb. 17, 2021, 2:01 a.m.