This function implements the CSD algorithm 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
)
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.
Numeric matrix, the gene expression matrix for the second condition.
Integer, number of bootstrap iterations
Integer, number of threads to use for computations
Logical, should progress be printed?
If output is verbose - Number of iterations between
each status message
(Default=1 - Displayed only if verbose=TRUE
)
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.
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.
The parallelism gained by nThreads
applies to the computations
within a single iteration. The iterations are run is serial in order
to reduce the memory footprint.
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)
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 7 15:37:56 2024 => 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 7 15:37:56 2024 => Running correlation bootstrapping on first condition...
#> Thu Nov 7 15:37:56 2024 => Running bootstrap iteration 1 of 100...
#> Thu Nov 7 15:37:56 2024 => Running bootstrap iteration 2 of 100...
#> Thu Nov 7 15:37:56 2024 => Running bootstrap iteration 3 of 100...
#> Thu Nov 7 15:37:56 2024 => Running bootstrap iteration 4 of 100...
#> Thu Nov 7 15:37:56 2024 => Running bootstrap iteration 5 of 100...
#> Thu Nov 7 15:37:56 2024 => Running bootstrap iteration 6 of 100...
#> Thu Nov 7 15:37:56 2024 => Running bootstrap iteration 7 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 8 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 9 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 10 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 11 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 12 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 13 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 14 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 15 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 16 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 17 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 18 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 19 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 20 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 21 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 22 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 23 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 24 of 100...
#> Thu Nov 7 15:37:57 2024 => Running bootstrap iteration 25 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 26 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 27 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 28 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 29 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 30 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 31 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 32 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 33 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 34 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 35 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 36 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 37 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 38 of 100...
#> Thu Nov 7 15:37:58 2024 => Running bootstrap iteration 39 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 40 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 41 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 42 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 43 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 44 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 45 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 46 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 47 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 48 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 49 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 50 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 51 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 52 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 53 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 54 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 55 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 56 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 57 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 58 of 100...
#> Thu Nov 7 15:37:59 2024 => Running bootstrap iteration 59 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 60 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 61 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 62 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 63 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 64 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 65 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 66 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 67 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 68 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 69 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 70 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 71 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 72 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 73 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 74 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 75 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 76 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 77 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 78 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 79 of 100...
#> Thu Nov 7 15:38:00 2024 => Running bootstrap iteration 80 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 81 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 82 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 83 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 84 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 85 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 86 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 87 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 88 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 89 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 90 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 91 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 92 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 93 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 94 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 95 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 96 of 100...
#> Thu Nov 7 15:38:01 2024 => Running bootstrap iteration 97 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 98 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 99 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 100 of 100...
#> Thu Nov 7 15:38:02 2024 => Running correlation bootstrapping on second condition...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 1 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 2 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 3 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 4 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 5 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 6 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 7 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 8 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 9 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 10 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 11 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 12 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 13 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 14 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 15 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 16 of 100...
#> Thu Nov 7 15:38:02 2024 => Running bootstrap iteration 17 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 18 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 19 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 20 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 21 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 22 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 23 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 24 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 25 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 26 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 27 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 28 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 29 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 30 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 31 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 32 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 33 of 100...
#> Thu Nov 7 15:38:03 2024 => Running bootstrap iteration 34 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 35 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 36 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 37 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 38 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 39 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 40 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 41 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 42 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 43 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 44 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 45 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 46 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 47 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 48 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 49 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 50 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 51 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 52 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 53 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 54 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 55 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 56 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 57 of 100...
#> Thu Nov 7 15:38:04 2024 => Running bootstrap iteration 58 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 59 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 60 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 61 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 62 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 63 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 64 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 65 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 66 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 67 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 68 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 69 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 70 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 71 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 72 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 73 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 74 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 75 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 76 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 77 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 78 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 79 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 80 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 81 of 100...
#> Thu Nov 7 15:38:05 2024 => Running bootstrap iteration 82 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 83 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 84 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 85 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 86 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 87 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 88 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 89 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 90 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 91 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 92 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 93 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 94 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 95 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 96 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 97 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 98 of 100...
#> Thu Nov 7 15:38:06 2024 => Running bootstrap iteration 99 of 100...
#> Thu Nov 7 15:38:07 2024 => Running bootstrap iteration 100 of 100...
#> Thu Nov 7 15:38:07 2024 => Summarizing results
#> Thu Nov 7 15:38:07 2024 => Returning from CSD procedure...
c_max <- max(cor_res$cVal)