################################################################### ##Count2FPKM: normalized the RNA-seq data form reads cout to FPKM## ################################################################### library(cli) ################################################### ########## Input Genome annotation file ########### gtf<-read.table("~\\gene_position.txt") rownames(gtf)<-gtf$V3 ########## Input Genome annotation file ########### ################################################### ################################################### ############# Input RNA-seq dataset ############### GSE_rna<- read.table("~\\GSE176260_QCed_counts_exploratory.txt",header = T,row.names = 1) ############# Input RNA-seq dataset ############### ################################################### ################################################### ################### Count to FPKM ################# gri<-intersect(rownames(GSE_rna),rownames(gtf)) GSE_rna[gri,]->GSE_rna_gene gtf[gri,]->gtf_gene #duplicated GSE_rna_gene<-GSE_rna_gene[!duplicated(gtf_gene$V4),] gtf_gene<-gtf_gene[!duplicated(gtf_gene$V4),] # rownames(GSE_rna_gene)<-gtf_gene$V4 GSE_rna_gene_norm<-cbind(gene_length=gtf_gene$V2-gtf_gene$V1+1,GSE_rna_gene) for(i in 2:ncol(GSE_rna_gene_norm)){ total_reads<-sum(GSE_rna_gene_norm[,i]) GSE_rna_gene_norm[,i]<-GSE_rna_gene_norm[,i]*1000000*1000/(GSE_rna_gene_norm[,1]*total_reads) } rna_fpkm<-GSE_rna_gene_norm[,-1] #####save the FPKM data##### write.table(rna_fpkm,"~\\rna_fpkm.txt",col.names = T,row.names = T,quote = F) ################### Count to FPKM ################## ####################################################