require(edgeR) rnaseqMatrix0= read.table("/data/images/proton/DKlab/orsalia2/stringtie/transcript_count_matrix.csv",header=T,sep=",") #data = read.table("/data/images/proton/run125/www/genes.counts.matrix", header=T, row.names=1, com='') #col_ordering = c(1,2,6,7) rnaseqMatrix =rnaseqMatrix0; #rnaseqMatrix = round(rnaseqMatrix) rnaseqMatrix = rnaseqMatrix[rowSums(rnaseqMatrix)>=2,] #conditions = factor(c(rep("FAGsA", 2), rep("FAGsB", 2))) # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #conditions = factor(c("KO2","KO2","KOIFN","KOIFN","Ko0","Ko0","KoIL4","KoIL4","Ko6","Ko6","wt0","wt0IL4","wt0","wt0IL4","wt2","wt2","wt6","wt6","wtIFN","wtIFN")) conditions = factor(c("KO","KO","KO","KO","KO","KO","KO","KO","KO","KO","wt","wt","wt","wt","wt","wt","wt","wt","wt","wt")) exp_study = DGEList(counts=rnaseqMatrix, group=conditions) exp_study = calcNormFactors(exp_study) exp_study = estimateCommonDisp(exp_study) exp_study = estimateTagwiseDisp(exp_study) et = exactTest(exp_study) tTags = topTags(et,n=NULL,adjust.method = "fdr") r = rownames(tTags) c=data[r,col_ordering] #tab <- topTags(lrt) #write.table(tTags, file="edgeRtranscripts.csv") col_ordering = c(11,13,5,6)#0h rnaseqMatrix =rnaseqMatrix0[,col_ordering];rnaseqMatrix = rnaseqMatrix[(rnaseqMatrix[,1]+rnaseqMatrix[,2]>0)&(rnaseqMatrix[,3]+rnaseqMatrix[,4]>0),];conditions = factor(c("WT","WT","KO","KO")); exp_study = DGEList(counts=rnaseqMatrix, group=conditions);exp_study = calcNormFactors(exp_study);exp_study = estimateCommonDisp(exp_study);exp_study = estimateTagwiseDisp(exp_study);et = exactTest(exp_study) tTags = topTags(et,n=NULL,adjust.method = "fdr") r <- rownames(topTags(et)$table) c=cpm(exp_study)[r, order(exp_study$samples$group)] x=cbind(as.data.frame(tTags),c) summary(de <- decideTestsDGE(et, p=0.05)) #detags <- rownames(exp_study)[as.logical(de)] #plotSmear(et, de.tags=detags) #abline(h = c(-1, 1), col = "blue") write.table(tTags, file="edgeRtranscripts-0h.csv") write.table(x, file="edgeRtranscriptsExpr-0h.csv") col_ordering = c(15,16,1,2)#2h rnaseqMatrix =rnaseqMatrix0[,col_ordering];rnaseqMatrix = rnaseqMatrix[(rnaseqMatrix[,1]+rnaseqMatrix[,2]>0)&(rnaseqMatrix[,3]+rnaseqMatrix[,4]>0),];conditions = factor(c("WT","WT","KO","KO")); exp_study = DGEList(counts=rnaseqMatrix, group=conditions);exp_study = calcNormFactors(exp_study);exp_study = estimateCommonDisp(exp_study);exp_study = estimateTagwiseDisp(exp_study);et = exactTest(exp_study) tTags = topTags(et,n=NULL,adjust.method = "fdr") write.table(tTags, file="edgeRtranscripts-2h.csv") col_ordering = c(17,18,9,10)#6h rnaseqMatrix =rnaseqMatrix0[,col_ordering];rnaseqMatrix = rnaseqMatrix[(rnaseqMatrix[,1]+rnaseqMatrix[,2]>0)&(rnaseqMatrix[,3]+rnaseqMatrix[,4]>0),];conditions = factor(c("WT","WT","KO","KO")); exp_study = DGEList(counts=rnaseqMatrix, group=conditions);exp_study = calcNormFactors(exp_study);exp_study = estimateCommonDisp(exp_study);exp_study = estimateTagwiseDisp(exp_study);et = exactTest(exp_study) tTags = topTags(et,n=NULL,adjust.method = "fdr") write.table(tTags, file="edgeRtranscripts-6h.csv") col_ordering = c(19,20,3,4)#IFN rnaseqMatrix =rnaseqMatrix0[,col_ordering];rnaseqMatrix = rnaseqMatrix[(rnaseqMatrix[,1]+rnaseqMatrix[,2]>0)&(rnaseqMatrix[,3]+rnaseqMatrix[,4]>0),];conditions = factor(c("WT","WT","KO","KO")); exp_study = DGEList(counts=rnaseqMatrix, group=conditions);exp_study = calcNormFactors(exp_study);exp_study = estimateCommonDisp(exp_study);exp_study = estimateTagwiseDisp(exp_study);et = exactTest(exp_study) tTags = topTags(et,n=NULL,adjust.method = "fdr") write.table(tTags, file="edgeRtranscripts-IFN.csv") col_ordering = c(12,14,7,8)#IL4 rnaseqMatrix =rnaseqMatrix0[,col_ordering];rnaseqMatrix = rnaseqMatrix[(rnaseqMatrix[,1]+rnaseqMatrix[,2]>0)&(rnaseqMatrix[,3]+rnaseqMatrix[,4]>0),];conditions = factor(c("WT","WT","KO","KO")); exp_study = DGEList(counts=rnaseqMatrix, group=conditions);exp_study = calcNormFactors(exp_study);exp_study = estimateCommonDisp(exp_study);exp_study = estimateTagwiseDisp(exp_study);et = exactTest(exp_study) tTags = topTags(et,n=NULL,adjust.method = "fdr") write.table(tTags, file="edgeRtranscripts-IL4.csv")