alignedToRPM <- function(readcounts) { # assumes the counts came from Rsubread!
millionsMapped <- colSums(readcounts$counts)/1000000
return( sweep(readcounts$counts, 2, millionsMapped, '/') )
}
asRPM <- function(SE) { # for SEs where we have counts and/or RPKM but not RPM
stopifnot('counts' %in% names(assays(SE, withDimnames=F)))
millionsMapped <- colSums(assays(SE, withDimnames=F)[['counts']])/1000000
return( sweep(assays(SE, withDimnames=F)[['counts']], 2, millionsMapped, '/'))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.