#' Calculate cpm
#'
#' This function calculates the Transcripts Per Million (cpm) for the given counts, peaks, and signature.
#'
#' @param counts The counts data frame.
#' @param peaks The peaks data frame.
#' @param signature The signature vector.
#'
#' @return A data frame of cpm values.
#' @export
#' @rdname calculate_cpm
calculate_cpm <- function(counts, peaks, signature) {
if (length(signature) != 0) {
counts2 <- counts / (peaks[[3]] - peaks[[2]] + 1)
cpm <- as.data.frame(edgeR::cpm(counts2))
} else {
cpm <- counts
}
return(cpm)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.