#' Returns normalized data from PQN normalization
#' see getMedianNormalizationFactors
#'
#' @param data matrix which will be normalized and returned
#' @param data2 optional input matrix to be used for normalization
#'
#' @return
#' @export
#'
#'
n <- function(data, data2) {
if(!hasArg(data2)) {
data2 <- data
}
factors <- matrix(NA, nrow = nrow(data2), ncol = nrow(data2))
rownames(factors) <- colnames(factors) <- rownames(data2)
for(i in 1:nrow(data2)) {
factors[i, ] <- medianFactor(factorizeMatrix(data2, i))
}
data / apply(factors, 2, geomean)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.