R/AbsCor.R

Defines functions AbsCor

Documented in AbsCor

#' @title Calculate absolute correlations among gene pairs
#' @usage AbsCor(DataIn, method="pearson", diagNA=TRUE)
#' @param DataIn input data, gene-by-sample matrix
#' @param method "pearson" or "spearman"; default is "pearson"
#' @param diagNA whether replace diagonal values to NA's
#' @return Output is a gene-by-gene matrix; 
#' the i, j th entry shows the absolute correlation of the ith and jth gene.
#' @examples AbsCor(matrix(rnorm(10),ncol=5))
#' @author Ning Leng
AbsCor <- function(DataIn, method = "pearson", diagNA=TRUE){
		MatCor <- cor(scale(t(DataIn)))
    absMatCor <- abs(MatCor)
		diag(absMatCor) <- NA
		SimiMatIn <- absMatCor
}

Try the Oscope package in your browser

Any scripts or data that you put into this service are public.

Oscope documentation built on Nov. 8, 2020, 7:12 p.m.