#' Creates list containing correlation matrix relevant objects
#'
#' @param data.expr expression data
#' @param cm0 threshold of missing values before normalization
#' @param n normalize
#' @param impute should missing values be imputed
#' @param threshold threshold of missing values after normalization
#' @param shift shift for imputation
#' @param width width for imputation
#' @param method.s similarity function
#' @param method.a adjacency function
#' @param exp exponent of correlation coefficients
#' @param save should data be saved
#' @param name name to save under
#' @param destination where to save
#' @param return should data be returned
#'
#' @return
#' @export
#'
#'
cor.object <- function(data.expr, cm0 = 0, n = F, impute = T, threshold, shift, width, method.s = "not", method.a = "power", exp = 1, diag.zero = F, save = F, name, destination = "dat", return = T) {
if(!hasArg(data.expr)) {
data.expr <- getData()
}
data.expr <- cm0(data.expr)
if(n) {
data.expr <- n(data.expr)
}
if(impute) {
data.expr <- impute_normd(data.expr, threshold = threshold, shift = shift, width = width)
}
cor.object <- list()
data.cor <- WGCNA::cor(data.expr)
data.cor <- similarity(data.cor, method = method.s)
if(diag.zero) {
diag(data.cor) <- 0
}
dist <- dist(x = data.cor)
dendrogram <- fastcluster::hclust(d = dist, method = "average")
cor.object[[1]] <- data.expr
cor.object[[2]] <- data.cor
cor.object[[3]] <- dendrogram
names(cor.object) <- c("expr", "cor", "dendrogram")
if(save) {
saveThis(cor.object, name, destination)
}
if(return) {
cor.object
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.