This function implements the a CSD based on the one presented by Voigt et al. 2017. All pairs of genes are first compared within each condition by the Spearman correlation and the correlation and its variance are estimated by bootstrapping. Finally, the results for the two conditions are compared and C-, S- and D-values are computed and returned.

run_csd(
  x_1,
  x_2,
  n_it = 20L,
  nThreads = 1L,
  verbose = TRUE,
  iterations_gap = 1L
)

Arguments

x_1

Numeric matrix, the gene expression matrix for the first condition. Genes are in columns, samples are in rows. The columns must be named with the name of the genes. Missing values are not allowed.

x_2

Numeric matrix, the gene expression matrix for the second condition.

n_it

Integer, number of bootstrap iterations

nThreads

Integer, number of threads to use for computations

verbose

Logical, should progress be printed?

iterations_gap

If output is verbose - number of iterations after issue a status message (Default=1 - displayed only if verbose=TRUE)

Value

A data.frame with the additional class attribute csd_res with the results of the CSD analysis. This frame has a row for each pair of genes and has the following columns:

Gene1

Character, the name of the first gene

Gene2

Character, the name of the second gene

rho1

Mean correlation of the two genes in the first condition

rho2

Mean correlation of the two genes in the second condition

var1

The estimated variance of rho1 determined by bootstrapping

var2

The estimated variance of rho2 determined by bootstrapping

cVal

Numeric, the conserved score. A high value indicates that the co-expression of the two genes have the same sign in both conditions

sVal

Numeric, the specific score. A high value indicates that the co-expression of the two genes have a high degree of co-expression in one condition, but not the other.

dVal

Numeric, the differentiated score. A high value indicates that the co-expression of the two genes have a high degree of co-expression in both condition, but the sign of co-expression is different.

Details

The gene names in x_1 and x_2 do not need to be in the same order, but must be in the same namespace. Only genes present in both datasets will be considered for the analysis.

References

Voigt A, Nowick K and Almaas E 'A composite network of conserved and tissue specific gene interactions reveals possible genetic interactions in glioma' In: PLOS Computational Biology 13(9): e1005739. (doi: https://doi.org/10.1371/journal.pcbi.1005739)

Examples

data("sick_expression")
data("normal_expression")
cor_res <- run_csd(
    x_1 = sick_expression, x_2 = normal_expression,
    n_it = 100, nThreads = 2L
)
#> Thu Nov 24 13:25:38 2022 => Running CSD with
#> 504 samples from condition 1
#> 399 samples from condition 2
#> Number of genes: 1000
#> Number of bootstrap iterations: 100
#> Number of threads: 2
#> Thu Nov 24 13:25:38 2022 => Running correlation bootstrapping on first condition...
#> Thu Nov 24 13:25:38 2022 => Running bootstrap iteration 1 of 100...
#> Thu Nov 24 13:25:38 2022 => Running bootstrap iteration 2 of 100...
#> Thu Nov 24 13:25:38 2022 => Running bootstrap iteration 3 of 100...
#> Thu Nov 24 13:25:39 2022 => Running bootstrap iteration 4 of 100...
#> Thu Nov 24 13:25:39 2022 => Running bootstrap iteration 5 of 100...
#> Thu Nov 24 13:25:39 2022 => Running bootstrap iteration 6 of 100...
#> Thu Nov 24 13:25:40 2022 => Running bootstrap iteration 7 of 100...
#> Thu Nov 24 13:25:40 2022 => Running bootstrap iteration 8 of 100...
#> Thu Nov 24 13:25:41 2022 => Running bootstrap iteration 9 of 100...
#> Thu Nov 24 13:25:41 2022 => Running bootstrap iteration 10 of 100...
#> Thu Nov 24 13:25:41 2022 => Running bootstrap iteration 11 of 100...
#> Thu Nov 24 13:25:41 2022 => Running bootstrap iteration 12 of 100...
#> Thu Nov 24 13:25:42 2022 => Running bootstrap iteration 13 of 100...
#> Thu Nov 24 13:25:42 2022 => Running bootstrap iteration 14 of 100...
#> Thu Nov 24 13:25:42 2022 => Running bootstrap iteration 15 of 100...
#> Thu Nov 24 13:25:42 2022 => Running bootstrap iteration 16 of 100...
#> Thu Nov 24 13:25:43 2022 => Running bootstrap iteration 17 of 100...
#> Thu Nov 24 13:25:43 2022 => Running bootstrap iteration 18 of 100...
#> Thu Nov 24 13:25:43 2022 => Running bootstrap iteration 19 of 100...
#> Thu Nov 24 13:25:43 2022 => Running bootstrap iteration 20 of 100...
#> Thu Nov 24 13:25:44 2022 => Running bootstrap iteration 21 of 100...
#> Thu Nov 24 13:25:44 2022 => Running bootstrap iteration 22 of 100...
#> Thu Nov 24 13:25:44 2022 => Running bootstrap iteration 23 of 100...
#> Thu Nov 24 13:25:45 2022 => Running bootstrap iteration 24 of 100...
#> Thu Nov 24 13:25:45 2022 => Running bootstrap iteration 25 of 100...
#> Thu Nov 24 13:25:45 2022 => Running bootstrap iteration 26 of 100...
#> Thu Nov 24 13:25:45 2022 => Running bootstrap iteration 27 of 100...
#> Thu Nov 24 13:25:46 2022 => Running bootstrap iteration 28 of 100...
#> Thu Nov 24 13:25:46 2022 => Running bootstrap iteration 29 of 100...
#> Thu Nov 24 13:25:46 2022 => Running bootstrap iteration 30 of 100...
#> Thu Nov 24 13:25:46 2022 => Running bootstrap iteration 31 of 100...
#> Thu Nov 24 13:25:47 2022 => Running bootstrap iteration 32 of 100...
#> Thu Nov 24 13:25:47 2022 => Running bootstrap iteration 33 of 100...
#> Thu Nov 24 13:25:47 2022 => Running bootstrap iteration 34 of 100...
#> Thu Nov 24 13:25:47 2022 => Running bootstrap iteration 35 of 100...
#> Thu Nov 24 13:25:48 2022 => Running bootstrap iteration 36 of 100...
#> Thu Nov 24 13:25:48 2022 => Running bootstrap iteration 37 of 100...
#> Thu Nov 24 13:25:48 2022 => Running bootstrap iteration 38 of 100...
#> Thu Nov 24 13:25:48 2022 => Running bootstrap iteration 39 of 100...
#> Thu Nov 24 13:25:49 2022 => Running bootstrap iteration 40 of 100...
#> Thu Nov 24 13:25:49 2022 => Running bootstrap iteration 41 of 100...
#> Thu Nov 24 13:25:49 2022 => Running bootstrap iteration 42 of 100...
#> Thu Nov 24 13:25:49 2022 => Running bootstrap iteration 43 of 100...
#> Thu Nov 24 13:25:50 2022 => Running bootstrap iteration 44 of 100...
#> Thu Nov 24 13:25:50 2022 => Running bootstrap iteration 45 of 100...
#> Thu Nov 24 13:25:50 2022 => Running bootstrap iteration 46 of 100...
#> Thu Nov 24 13:25:51 2022 => Running bootstrap iteration 47 of 100...
#> Thu Nov 24 13:25:51 2022 => Running bootstrap iteration 48 of 100...
#> Thu Nov 24 13:25:51 2022 => Running bootstrap iteration 49 of 100...
#> Thu Nov 24 13:25:51 2022 => Running bootstrap iteration 50 of 100...
#> Thu Nov 24 13:25:52 2022 => Running bootstrap iteration 51 of 100...
#> Thu Nov 24 13:25:52 2022 => Running bootstrap iteration 52 of 100...
#> Thu Nov 24 13:25:52 2022 => Running bootstrap iteration 53 of 100...
#> Thu Nov 24 13:25:52 2022 => Running bootstrap iteration 54 of 100...
#> Thu Nov 24 13:25:53 2022 => Running bootstrap iteration 55 of 100...
#> Thu Nov 24 13:25:53 2022 => Running bootstrap iteration 56 of 100...
#> Thu Nov 24 13:25:53 2022 => Running bootstrap iteration 57 of 100...
#> Thu Nov 24 13:25:53 2022 => Running bootstrap iteration 58 of 100...
#> Thu Nov 24 13:25:54 2022 => Running bootstrap iteration 59 of 100...
#> Thu Nov 24 13:25:54 2022 => Running bootstrap iteration 60 of 100...
#> Thu Nov 24 13:25:54 2022 => Running bootstrap iteration 61 of 100...
#> Thu Nov 24 13:25:54 2022 => Running bootstrap iteration 62 of 100...
#> Thu Nov 24 13:25:55 2022 => Running bootstrap iteration 63 of 100...
#> Thu Nov 24 13:25:55 2022 => Running bootstrap iteration 64 of 100...
#> Thu Nov 24 13:25:55 2022 => Running bootstrap iteration 65 of 100...
#> Thu Nov 24 13:25:55 2022 => Running bootstrap iteration 66 of 100...
#> Thu Nov 24 13:25:56 2022 => Running bootstrap iteration 67 of 100...
#> Thu Nov 24 13:25:56 2022 => Running bootstrap iteration 68 of 100...
#> Thu Nov 24 13:25:56 2022 => Running bootstrap iteration 69 of 100...
#> Thu Nov 24 13:25:57 2022 => Running bootstrap iteration 70 of 100...
#> Thu Nov 24 13:25:57 2022 => Running bootstrap iteration 71 of 100...
#> Thu Nov 24 13:25:57 2022 => Running bootstrap iteration 72 of 100...
#> Thu Nov 24 13:25:57 2022 => Running bootstrap iteration 73 of 100...
#> Thu Nov 24 13:25:58 2022 => Running bootstrap iteration 74 of 100...
#> Thu Nov 24 13:25:58 2022 => Running bootstrap iteration 75 of 100...
#> Thu Nov 24 13:25:58 2022 => Running bootstrap iteration 76 of 100...
#> Thu Nov 24 13:25:58 2022 => Running bootstrap iteration 77 of 100...
#> Thu Nov 24 13:25:59 2022 => Running bootstrap iteration 78 of 100...
#> Thu Nov 24 13:25:59 2022 => Running bootstrap iteration 79 of 100...
#> Thu Nov 24 13:25:59 2022 => Running bootstrap iteration 80 of 100...
#> Thu Nov 24 13:25:59 2022 => Running bootstrap iteration 81 of 100...
#> Thu Nov 24 13:26:00 2022 => Running bootstrap iteration 82 of 100...
#> Thu Nov 24 13:26:00 2022 => Running bootstrap iteration 83 of 100...
#> Thu Nov 24 13:26:00 2022 => Running bootstrap iteration 84 of 100...
#> Thu Nov 24 13:26:00 2022 => Running bootstrap iteration 85 of 100...
#> Thu Nov 24 13:26:01 2022 => Running bootstrap iteration 86 of 100...
#> Thu Nov 24 13:26:01 2022 => Running bootstrap iteration 87 of 100...
#> Thu Nov 24 13:26:01 2022 => Running bootstrap iteration 88 of 100...
#> Thu Nov 24 13:26:02 2022 => Running bootstrap iteration 89 of 100...
#> Thu Nov 24 13:26:02 2022 => Running bootstrap iteration 90 of 100...
#> Thu Nov 24 13:26:02 2022 => Running bootstrap iteration 91 of 100...
#> Thu Nov 24 13:26:02 2022 => Running bootstrap iteration 92 of 100...
#> Thu Nov 24 13:26:03 2022 => Running bootstrap iteration 93 of 100...
#> Thu Nov 24 13:26:03 2022 => Running bootstrap iteration 94 of 100...
#> Thu Nov 24 13:26:03 2022 => Running bootstrap iteration 95 of 100...
#> Thu Nov 24 13:26:03 2022 => Running bootstrap iteration 96 of 100...
#> Thu Nov 24 13:26:04 2022 => Running bootstrap iteration 97 of 100...
#> Thu Nov 24 13:26:04 2022 => Running bootstrap iteration 98 of 100...
#> Thu Nov 24 13:26:05 2022 => Running bootstrap iteration 99 of 100...
#> Thu Nov 24 13:26:05 2022 => Running bootstrap iteration 100 of 100...
#> Thu Nov 24 13:26:05 2022 => Running correlation bootstrapping on second condition...
#> Thu Nov 24 13:26:05 2022 => Running bootstrap iteration 1 of 100...
#> Thu Nov 24 13:26:05 2022 => Running bootstrap iteration 2 of 100...
#> Thu Nov 24 13:26:05 2022 => Running bootstrap iteration 3 of 100...
#> Thu Nov 24 13:26:06 2022 => Running bootstrap iteration 4 of 100...
#> Thu Nov 24 13:26:06 2022 => Running bootstrap iteration 5 of 100...
#> Thu Nov 24 13:26:06 2022 => Running bootstrap iteration 6 of 100...
#> Thu Nov 24 13:26:06 2022 => Running bootstrap iteration 7 of 100...
#> Thu Nov 24 13:26:06 2022 => Running bootstrap iteration 8 of 100...
#> Thu Nov 24 13:26:07 2022 => Running bootstrap iteration 9 of 100...
#> Thu Nov 24 13:26:07 2022 => Running bootstrap iteration 10 of 100...
#> Thu Nov 24 13:26:07 2022 => Running bootstrap iteration 11 of 100...
#> Thu Nov 24 13:26:07 2022 => Running bootstrap iteration 12 of 100...
#> Thu Nov 24 13:26:07 2022 => Running bootstrap iteration 13 of 100...
#> Thu Nov 24 13:26:08 2022 => Running bootstrap iteration 14 of 100...
#> Thu Nov 24 13:26:08 2022 => Running bootstrap iteration 15 of 100...
#> Thu Nov 24 13:26:08 2022 => Running bootstrap iteration 16 of 100...
#> Thu Nov 24 13:26:08 2022 => Running bootstrap iteration 17 of 100...
#> Thu Nov 24 13:26:09 2022 => Running bootstrap iteration 18 of 100...
#> Thu Nov 24 13:26:09 2022 => Running bootstrap iteration 19 of 100...
#> Thu Nov 24 13:26:09 2022 => Running bootstrap iteration 20 of 100...
#> Thu Nov 24 13:26:09 2022 => Running bootstrap iteration 21 of 100...
#> Thu Nov 24 13:26:09 2022 => Running bootstrap iteration 22 of 100...
#> Thu Nov 24 13:26:10 2022 => Running bootstrap iteration 23 of 100...
#> Thu Nov 24 13:26:10 2022 => Running bootstrap iteration 24 of 100...
#> Thu Nov 24 13:26:10 2022 => Running bootstrap iteration 25 of 100...
#> Thu Nov 24 13:26:10 2022 => Running bootstrap iteration 26 of 100...
#> Thu Nov 24 13:26:10 2022 => Running bootstrap iteration 27 of 100...
#> Thu Nov 24 13:26:11 2022 => Running bootstrap iteration 28 of 100...
#> Thu Nov 24 13:26:11 2022 => Running bootstrap iteration 29 of 100...
#> Thu Nov 24 13:26:11 2022 => Running bootstrap iteration 30 of 100...
#> Thu Nov 24 13:26:11 2022 => Running bootstrap iteration 31 of 100...
#> Thu Nov 24 13:26:11 2022 => Running bootstrap iteration 32 of 100...
#> Thu Nov 24 13:26:12 2022 => Running bootstrap iteration 33 of 100...
#> Thu Nov 24 13:26:12 2022 => Running bootstrap iteration 34 of 100...
#> Thu Nov 24 13:26:12 2022 => Running bootstrap iteration 35 of 100...
#> Thu Nov 24 13:26:12 2022 => Running bootstrap iteration 36 of 100...
#> Thu Nov 24 13:26:12 2022 => Running bootstrap iteration 37 of 100...
#> Thu Nov 24 13:26:13 2022 => Running bootstrap iteration 38 of 100...
#> Thu Nov 24 13:26:13 2022 => Running bootstrap iteration 39 of 100...
#> Thu Nov 24 13:26:13 2022 => Running bootstrap iteration 40 of 100...
#> Thu Nov 24 13:26:13 2022 => Running bootstrap iteration 41 of 100...
#> Thu Nov 24 13:26:13 2022 => Running bootstrap iteration 42 of 100...
#> Thu Nov 24 13:26:14 2022 => Running bootstrap iteration 43 of 100...
#> Thu Nov 24 13:26:14 2022 => Running bootstrap iteration 44 of 100...
#> Thu Nov 24 13:26:14 2022 => Running bootstrap iteration 45 of 100...
#> Thu Nov 24 13:26:14 2022 => Running bootstrap iteration 46 of 100...
#> Thu Nov 24 13:26:15 2022 => Running bootstrap iteration 47 of 100...
#> Thu Nov 24 13:26:15 2022 => Running bootstrap iteration 48 of 100...
#> Thu Nov 24 13:26:15 2022 => Running bootstrap iteration 49 of 100...
#> Thu Nov 24 13:26:16 2022 => Running bootstrap iteration 50 of 100...
#> Thu Nov 24 13:26:16 2022 => Running bootstrap iteration 51 of 100...
#> Thu Nov 24 13:26:16 2022 => Running bootstrap iteration 52 of 100...
#> Thu Nov 24 13:26:16 2022 => Running bootstrap iteration 53 of 100...
#> Thu Nov 24 13:26:16 2022 => Running bootstrap iteration 54 of 100...
#> Thu Nov 24 13:26:17 2022 => Running bootstrap iteration 55 of 100...
#> Thu Nov 24 13:26:17 2022 => Running bootstrap iteration 56 of 100...
#> Thu Nov 24 13:26:17 2022 => Running bootstrap iteration 57 of 100...
#> Thu Nov 24 13:26:17 2022 => Running bootstrap iteration 58 of 100...
#> Thu Nov 24 13:26:17 2022 => Running bootstrap iteration 59 of 100...
#> Thu Nov 24 13:26:18 2022 => Running bootstrap iteration 60 of 100...
#> Thu Nov 24 13:26:18 2022 => Running bootstrap iteration 61 of 100...
#> Thu Nov 24 13:26:18 2022 => Running bootstrap iteration 62 of 100...
#> Thu Nov 24 13:26:18 2022 => Running bootstrap iteration 63 of 100...
#> Thu Nov 24 13:26:18 2022 => Running bootstrap iteration 64 of 100...
#> Thu Nov 24 13:26:19 2022 => Running bootstrap iteration 65 of 100...
#> Thu Nov 24 13:26:19 2022 => Running bootstrap iteration 66 of 100...
#> Thu Nov 24 13:26:19 2022 => Running bootstrap iteration 67 of 100...
#> Thu Nov 24 13:26:19 2022 => Running bootstrap iteration 68 of 100...
#> Thu Nov 24 13:26:20 2022 => Running bootstrap iteration 69 of 100...
#> Thu Nov 24 13:26:20 2022 => Running bootstrap iteration 70 of 100...
#> Thu Nov 24 13:26:20 2022 => Running bootstrap iteration 71 of 100...
#> Thu Nov 24 13:26:20 2022 => Running bootstrap iteration 72 of 100...
#> Thu Nov 24 13:26:20 2022 => Running bootstrap iteration 73 of 100...
#> Thu Nov 24 13:26:21 2022 => Running bootstrap iteration 74 of 100...
#> Thu Nov 24 13:26:21 2022 => Running bootstrap iteration 75 of 100...
#> Thu Nov 24 13:26:21 2022 => Running bootstrap iteration 76 of 100...
#> Thu Nov 24 13:26:21 2022 => Running bootstrap iteration 77 of 100...
#> Thu Nov 24 13:26:21 2022 => Running bootstrap iteration 78 of 100...
#> Thu Nov 24 13:26:22 2022 => Running bootstrap iteration 79 of 100...
#> Thu Nov 24 13:26:22 2022 => Running bootstrap iteration 80 of 100...
#> Thu Nov 24 13:26:22 2022 => Running bootstrap iteration 81 of 100...
#> Thu Nov 24 13:26:22 2022 => Running bootstrap iteration 82 of 100...
#> Thu Nov 24 13:26:22 2022 => Running bootstrap iteration 83 of 100...
#> Thu Nov 24 13:26:23 2022 => Running bootstrap iteration 84 of 100...
#> Thu Nov 24 13:26:23 2022 => Running bootstrap iteration 85 of 100...
#> Thu Nov 24 13:26:23 2022 => Running bootstrap iteration 86 of 100...
#> Thu Nov 24 13:26:23 2022 => Running bootstrap iteration 87 of 100...
#> Thu Nov 24 13:26:23 2022 => Running bootstrap iteration 88 of 100...
#> Thu Nov 24 13:26:24 2022 => Running bootstrap iteration 89 of 100...
#> Thu Nov 24 13:26:24 2022 => Running bootstrap iteration 90 of 100...
#> Thu Nov 24 13:26:24 2022 => Running bootstrap iteration 91 of 100...
#> Thu Nov 24 13:26:24 2022 => Running bootstrap iteration 92 of 100...
#> Thu Nov 24 13:26:24 2022 => Running bootstrap iteration 93 of 100...
#> Thu Nov 24 13:26:25 2022 => Running bootstrap iteration 94 of 100...
#> Thu Nov 24 13:26:25 2022 => Running bootstrap iteration 95 of 100...
#> Thu Nov 24 13:26:25 2022 => Running bootstrap iteration 96 of 100...
#> Thu Nov 24 13:26:25 2022 => Running bootstrap iteration 97 of 100...
#> Thu Nov 24 13:26:25 2022 => Running bootstrap iteration 98 of 100...
#> Thu Nov 24 13:26:26 2022 => Running bootstrap iteration 99 of 100...
#> Thu Nov 24 13:26:26 2022 => Running bootstrap iteration 100 of 100...
#> Thu Nov 24 13:26:26 2022 => Summarizing results
#> Thu Nov 24 13:26:26 2022 => Returning from CSD procedure...
c_max <- max(cor_res$cVal)