FPKM 一般来说不太好用,转为TPM进行后续的分析比较合适。下面是FPKM转化为TPM的R实现:
#download FPKM data
FPKMquery <- GDCquery(project = "TCGA-LUAD",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "HTSeq - FPKM-UQ")
GDCdownload(FPKMquery, method = "api")
FPKMdat <- GDCprepare(query = FPKMquery)
# FPKMdat = readRDS("LUAD_FPKMdat.RDS")
FPKMexpdat = assay(FPKMdat)
#def func
FPKM2TPM <- function(fpkm){
exp(log(fpkm) - log(sum(fpkm)) + log(1e6))
}
#exec
TPMs <- apply(FPKMexpdat ,2,FPKM2TPM)