This is a test version of Biostars. For the public version, visit https://www.biostars.org.
TPM to log2(TPM+1)

Hi there! I´m using KIRC database from TCGA and downloaded FPKM values, then converted to TPM with this formulas:

FPKMtoTPM <- function(x) { return(exp(log(x) - log(sum(x)) + log(1e6))) }

df <- data %>% mutate_if(is.numeric, FPKMtoTPM)

Now i want to convert TPM to log2(TPM+1). How can i do this?

Thanks! David

log tcga kirc rna-seq tpm

1 answer

Just as you defined the first function FPKMtoTPM you can define another one for the log transformation of the TPM values

logTPM <- function(x) {return(log2(x+1))}

df %>% mutate_if(is.numeric, logTPM)

Perfect!! Thank you!

Log in to answer this question.