This is a test version of Biostars. For the public version, visit https://www.biostars.org.
From counts to TPM code verification

Hey, I'm getting odd results in my analysis and wanted to verify my code is right (from raw counts to TPM). First I normalize to RPKM and only then I convert to TPM, by this code:

rpkm = apply(X = subset(counts),
               MARGIN = 2,
               FUN = function(x) {
                 10^9 * x / geneLengths / sum(as.numeric(x))
               })

TPM = apply(rpkm, 2, function(x) x / sum(as.numeric(x)) * 10^6) %>% as.data.frame()

What do you think? seems ok right ?

tpm normalization r

1 answer

Raw counts to TPM in R

I assume you know that these simple per-million scalings might underperform quite a bit, TMM-Normalization

Log in to answer this question.