Calculate the difference between the clock correlation distances (CCDs), relative to a reference, for two groups of samples. Statistical significance is calculated using permutation of the samples that belong to either of those two groups.

calcDeltaCCD(
refCor,
emat,
groupVec,
groupNormal,
refEmat = NULL,
nPerm = 1000,
geneNames = NULL,
dopar = FALSE
)

## Arguments

refCor Correlation matrix to be used as the reference, such as comes from getRefCor(). Should contain Spearman correlation values. Matrix of expression values, where each row corresponds to a gene and each column corresponds to a sample. The rownames and colnames of refCor should be present in the rownames of emat. For the p-value calculation, it is important that emat include all measured genes, not just those in refCor. Vector indicating the group to which group each sample belongs. It's ok for groupVec to have more than two groups. Value indicating the group in groupVec that corresponds to normal or healthy. Other groups will be compared to this group. Optional expression matrix for calculating co-expression for the reference, with the same organization as emat. Only used if refCor is not provided. Number of permutations for assessing statistical significance. Optional vector indicating a subset of genes in refCor, emat, and/or refEmat to use for calculating the CCD. Logical indicating whether to process features in parallel. Use doParallel::registerDoParallel() to register the parallel backend.

## Value

A data frame with columns for group 1, group 2, deltaCCD, and p-value. In each row, the deltaCCD is the CCD of group 2 minus the CCD of group 1, so group 1 corresponds to groupNormal.

getRefCor(), calcCCD(), plotHeatmap()

## Examples

if (FALSE) {
library('deltaccd')
library('doParallel')
library('doRNG')

registerDoParallel(cores = 2)
set.seed(35813)

refCor = getRefCor()
ccdResult = calcCCD(refCor, GSE19188$emat, GSE19188$groupVec, dopar = TRUE)
deltaCcdResult = calcDeltaCCD(refCor, GSE19188$emat, GSE19188$groupVec,
'non-tumor', dopar = TRUE)

pRef = plotRefHeatmap(refCor)
pTest = plotHeatmap(rownames(refCor), GSE19188$emat, GSE19188$groupVec)
}