require(edgeR) rnaseqMatrix0= read.table("/data/images/proton/DKlab/orsalia2/stringtie/gene_count_matrix.csv",header=T,sep=",") r=rownames(rnaseqMatrix0) flt=grep("ENSMUSG",r) #data = read.table("/data/images/proton/run125/www/genes.counts.matrix", header=T, row.names=1, com='') #col_ordering = c(1,2,6,7) rnaseqMatrix0 =rnaseqMatrix0[flt,]; #rnaseqMatrix = round(rnaseqMatrix) rnaseqMatrix = rnaseqMatrix0[rowSums(rnaseqMatrix0)>=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")) col_ordering = c(11,13,15,16,17,18,19,20,12,14,5,6,1,2,9,10,3,4,7,8)#0h 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=cpm(exp_study)[r, order(exp_study$samples$group)] x=cbind(as.data.frame(tTags),c) summary(de <- decideTestsDGE(et, p=0.05)) #tab <- topTags(lrt) #write.table(tTags, file="edgeRgenes.csv") col_ordering = c(5,6,11,13)#0h rnaseqMatrix =rnaseqMatrix0[,col_ordering]; rnaseqMatrix = rnaseqMatrix[rowSums(rnaseqMatrix)>=2,] conditions = factor(c("KO","KO","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(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="edgeRgenes-0h.csv") write.table(x, file="edgeRgenesExpr-0h.csv") col_ordering = c(1,2,15,16)#2h rnaseqMatrix =rnaseqMatrix0[,col_ordering]; rnaseqMatrix = rnaseqMatrix[rowSums(rnaseqMatrix)>=2,] 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="edgeRgenes-2h.csv") col_ordering = c(9,10,17,18)#6h rnaseqMatrix =rnaseqMatrix0[,col_ordering]; rnaseqMatrix = rnaseqMatrix[rowSums(rnaseqMatrix)>=2,] 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="edgeRgenes-6h.csv") col_ordering = c(3,4,19,20)#IFN rnaseqMatrix =rnaseqMatrix0[,col_ordering]; rnaseqMatrix = rnaseqMatrix[rowSums(rnaseqMatrix)>=2,] 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="edgeRgenes-IFN.csv") col_ordering = c(7,8,12,14)#IL4 rnaseqMatrix =rnaseqMatrix0[,col_ordering]; rnaseqMatrix = rnaseqMatrix[rowSums(rnaseqMatrix)>=2,] 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="edgeRgenes-IL4.csv")