-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeneRpkm2.R
More file actions
21 lines (16 loc) · 864 Bytes
/
GeneRpkm2.R
File metadata and controls
21 lines (16 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
load("RiboHistGeneCounts.rda")#load GeneCount file
Pheno<-read.table("RiboPheno.txt", header = T)#load demographic/technical info for subjects
#remove "," from numbers to use
Pheno$TotalNumMapped<-as.numeric(gsub(",", "", Pheno$TotalNumMapped))
#parse out gene counts and gene annotation info
Geneanno = GeneCounts[,1:6]
gCounts = GeneCounts[, 7:length(colnames(GeneCounts))]
#get RPKM values
genebgE= matrix(rep(Pheno$TotalNumMapped), nc = nrow(Pheno), nr = nrow(GeneCounts), byrow = T)
genewidE = matrix(rep(Geneanno$Length), nr = nrow(GeneCounts),
nc = nrow(Pheno), byrow=F)
geneRpkm<- GeneCounts/(genewidE/1000)/(genebgE/1e6)
geneRpkm_withanno <- data.frame(Geneanno, geneRpkm)
#get log2(Rpkm values +1)
geneRpkm2 <- data.frame(Geneanno, log2(geneRpkm + 1))
save(Pheno, geneRpkm2, geneRpkm, geneRpkm_withanno, file = "geneRpkm2.rda")