Entering edit mode
2.5 years ago
JACKY
▴
160
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 ?