#' Wrapper for partial correlations from corpcor
#'
#' Conducts co-expression analysis using full partial correlations; these are
#' computed using the shrinkage approach for covariance estimation from the
#' corpcor package.
#' @param x The n by p matrix of counts.
#' @param threshold Cutoff for significant associations. If NULL, all correlations
#' are returned. Otherwise, correlations of magnitude at or below this threshold are
#' set to zero.
#' @param verbose If true, progress messages will be printed from pcor.shrink().
#' @return A p by p matrix of association scores.
#' @export
run_pcor <- function(x, transformation = NULL, verbose = FALSE, ...) {
if(!is.null(transformation)) {
x <- transformation(x)
}
scores <- corpcor::pcor.shrink(x, verbose = verbose)
scores <- matrix(as.numeric(scores), nrow = nrow(scores), ncol = ncol(scores))
diag(scores) <- 0
colnames(scores) <- colnames(x)
return(scores)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.