#analysis of MJ11 transcriptomic changes in evolved and delta-binK strains # used to generate Figure 9 and Table 3 #source("http://www.bioconductor.org/biocLite.R") #biocLite("edgeR") #DE between species, for each tissue library(edgeR) dat1<-read.table("~/Source code 1.txt",header=T, row.names=1) colnames(dat1)<-substring(colnames(dat1),first=15,last=19) dat2<-read.table("~/Source code 2.txt",header=T, row.names=1) colnames(dat2)<-substring(colnames(dat2),first=15,last=19) data<-rbind(dat1,dat2) data<-round(data) colnames(data) data<-data[,c(1,8,9,10,11,12,2,3,4,5,6,7)] colSums(data) #drop<-c(2); data<-data[,-drop] #specify strain factor strains<-factor(c(rep("MJ11",4),rep("p2p4i1",4),rep("delta",4))) #strains<-factor(c(rep("MJ11",3),rep("p2p4i1",4),rep("delta",4))) #par(mfrow=c(1,2)) #for exactTest: only one factor is considered #ie, MJ vs delta comparison #can calc dispersion using qCML instead of GLM MJdeltadat<-data[,which(strains == "MJ11" | strains=="delta")] strains<-factor(c(rep("MJ11",4),rep("delta",4))) #strains<-factor(c(rep("MJ11",3),rep("delta",4))) b<-DGEList(counts= MJdeltadat,group=strains) b<-calcNormFactors(b) b<-estimateCommonDisp(b, verbose=T) b<-estimateTrendedDisp(b) b<-estimateTagwiseDisp(b) plotBCV(b,cex=0.5) et<-exactTest(b) toptagstable<-topTags(et,n=nrow(b))$table #adds a FDR col toptagstable<-toptagstable[order(toptagstable$FDR),] head(toptagstable) signif<-0.05 toptop<-toptagstable[toptagstable$FDR