#' A function to convert counts to counts per million (CPM).
#'
#' @param counts A merged count summary generated by mergeSummaries().
#' @details This function returns a table of counts converted to counts per million with an additional column
#' containing the sum of CPMs across samples.
#' @keywords BC32 processing convert CPM
#' @export
#' @examples
#' cpm <- countsToCPM(counts)
countsToCPM <- function(counts) {
cpm <- counts
for (i in 2:(length(cpm))) {
cpm[,i] <- (cpm[,i]/sum(cpm[,i]))*1000000
}
# Add the sum of CPMs at the last column of the data frame
sum.cpm <- NULL
for (i in 1:nrow(cpm)) {
sum.cpm <- c(sum.cpm, sum(cpm[i,2:(length(cpm))]))
}
cpm$sum.cpm <- sum.cpm
cpm
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.