#Information## #The samples were labelled as follows: #iTRAQ 1: #Donor 1: 113 - Fresh, 114 - 24 hours, 115 - 72 hours and 116: 7 days ##113 used as reference in JH1.csv #Donor 2: 117 - Fresh, 118 - 24 hours, 119 - 72 hours and 121: 7 days ##117 used as reference in JH2.csv #iTRAQ 2: #Donor 3: 113 - Fresh, 114 - 24 hours, 115 - 72 hours and 116: 7 days ##113 used as reference in JH3.csv #Donor 4: 117 - Fresh, 118 - 24 hours, 119 - 72 hours and 121: 7 days ##117 used as reference in JH4.csv #iTRAQ 3: #Donor 5: 116 - Fresh, 113 - 24 hours, 114 - 72 hours and 115: 7 days ##116 used as reference in JH5.csv #The spreadsheets attached contain the original data for all the samples run in each iTRAQ #and therefore have both donors timepoints relative to only 1 of the donors fresh samples/spreadsheet. #File names are JH1.csv, Jh2.csv, JH3.csv, JH4.csv, and JH5.csv ## Script requires package limma# #source("https://bioconductor.org/biocLite.R") #biocLite("limma") ##### Sort data files to extract relevant information ##### JH1<-read.csv(file="JH1.csv") ## reads in datafile JH1.csv JH1$Accession <- matrix(unlist(strsplit(as.character(JH1$Accession),"|",fixed=T)),ncol=3,byrow=T)[,2] ##strips out simple accession number ## make objects of relevant columns ## unusedJH1<-JH1[,2] peptidesJH1<-JH1[,8] IDJH1<-JH1[,5:6] JH1T24<-JH1[,9] JH1T72<-JH1[,14] JH1T168<-JH1[,19] Donor1<-cbind(unusedJH1, peptidesJH1, IDJH1, JH1T24,JH1T72,JH1T168) ### Binds relvant columns into a single dataframe dataJH1 <- Donor1[which(Donor1[,2]>1),] ### Subsets protiens identified with 2 or more peptides dataJH1A <- dataJH1[which(Donor1[,1]>1),] ### unused>1 (95%) dataJH1B <- dataJH1A[which(Donor1[,2]==1),] ### subsets proteins identified by 1 peptide dataJH1C <- dataJH1B[which(dataJH1B[,1]>2),] ### subsets proteins identified by 1 peptide with 99% conifidence (unused >2) JH1data<-rbind(dataJH1A,dataJH1C) ### binds rows of data with 2+ peptides with 95% or more confidence and single petide with 99% confidence ##### Repeat data sorting for other data files### ############################################################################################################### JH2<-read.csv(file="JH2.csv") JH2$Accession <- matrix(unlist(strsplit(as.character(JH2$Accession),"|",fixed=T)),ncol=3,byrow=T)[,2] unusedJH2<-JH2[,2] peptidesJH2<-JH2[,8] IDJH2<-JH2[,5:6] JH2T24<-JH2[,9] JH2T72<-JH2[,14] JH2T168<-JH2[,19] Donor2<-cbind(unusedJH2, peptidesJH2, IDJH2, JH2T24,JH2T72,JH2T168) dataJH2 <- Donor2[which(Donor2[,2]>1),] dataJH2A <- dataJH2[which(Donor2[,1]>1),] dataJH2B <- dataJH2A[which(Donor2[,2]==1),] dataJH2C <- dataJH2B[which(dataJH2B[,1]>2),] JH2data<-rbind(dataJH2A,dataJH2C) ############################################################################################################### JH3<-read.csv(file="JH3.csv") JH3$Accession <- matrix(unlist(strsplit(as.character(JH3$Accession),"|",fixed=T)),ncol=3,byrow=T)[,2] unusedJH3<-JH3[,2] peptidesJH3<-JH3[,8] IDJH3<-JH3[,5:6] JH3T24<-JH3[,9] JH3T72<-JH3[,14] JH3T168<-JH3[,19] Donor3<-cbind(unusedJH3, peptidesJH3, IDJH3, JH3T24, JH3T72, JH3T168) dataJH3 <- Donor3[which(Donor3[,2]>1),] dataJH3A <- dataJH3[which(Donor3[,1]>1),] dataJH3B <- dataJH3A[which(Donor3[,2]==1),] dataJH3C <- dataJH3B[which(dataJH3B[,1]>2),] JH3data<-rbind(dataJH3A,dataJH3C) ############################################################################################################### JH4<-read.csv(file="JH4.csv") JH4$Accession <- matrix(unlist(strsplit(as.character(JH4$Accession),"|",fixed=T)),ncol=3,byrow=T)[,2] unusedJH4<-JH4[,2] peptidesJH4<-JH4[,8] IDJH4<-JH4[,5:6] JH4T24<-JH4[,29] JH4T72<-JH4[,34] JH4T168<-JH4[,39] Donor4<-cbind(unusedJH4, peptidesJH4, IDJH4, JH4T24, JH4T72, JH4T168) dataJH4 <- Donor4[which(Donor4[,2]>1),] dataJH4A <- dataJH4[which(Donor4[,1]>1),] dataJH4B <- dataJH4A[which(Donor4[,2]==1),] dataJH4C <- dataJH4B[which(dataJH4B[,1]>2),] JH4data<-rbind(dataJH4A,dataJH4C) ############################################################################################################### JH5<-read.csv(file="JH5.csv") JH5$Accession <- matrix(unlist(strsplit(as.character(JH5$Accession),"|",fixed=T)),ncol=3,byrow=T)[,2] unusedJH5<-JH5[,2] peptidesJH5<-JH5[,8] IDJH5<-JH5[,5:6] JH5T24<-JH5[,9] JH5T72<-JH5[,14] JH5T168<-JH5[,19] Donor5<-cbind(unusedJH5, peptidesJH5, IDJH5, JH5T24, JH5T72, JH5T168) dataJH5 <- Donor5[which(Donor5[,2]>1),] dataJH5A <- dataJH5[which(Donor5[,1]>1),] dataJH5B <- dataJH5A[which(Donor5[,2]==1),] dataJH5C <- dataJH5B[which(dataJH5B[,1]>2),] JH5data<-rbind(dataJH5A,dataJH5C) ############################################################################################################### ### Extract list of unique protein IDs ### AllIDs<-rbind(IDJH1, IDJH2, IDJH3, IDJH4, IDJH5) uniqueIDs<-unique(AllIDs) dim(uniqueIDs) ### returns number of unique IDs in dataset ### ###Extract required columns for each dataset### Sorted1<-JH1data[c(3,5,6,7)] Sorted1<-unique(Sorted1) Sorted2<-JH2data[c(3,5,6,7)] Sorted2<-unique(Sorted2) Sorted3<-JH3data[c(3,5,6,7)] Sorted3<-unique(Sorted3) Sorted4<-JH4data[c(3,5,6,7)] Sorted4<-unique(Sorted4) Sorted5<-JH5data[c(3,5,6,7)] Sorted5<-unique(Sorted5) #MERGE DATA FILES### Merge<-merge(uniqueIDs, Sorted1, ,by="Accession",incomparables=NA,all=TRUE) Merge12<-merge(Merge,Sorted2,by="Accession",incomparables=NA,all=TRUE) Merge123<-merge(Merge12,Sorted3,by="Accession",incomparables=NA,all=TRUE) Merge1234<-merge(Merge123,Sorted4,by="Accession",incomparables=NA,all=TRUE) AllMerged<-merge(Merge1234,Sorted5,by="Accession",incomparables=NA,all=TRUE) ##Clean data of duplicates caused by White spaces that where present in some files### Accession<-AllMerged$Accession ##Separates Accession Accession<-trimws(Accession) ##Removes white spaces Name<-AllMerged$Name ##Spearates Name Name<-trimws(Name) ##Removes white spaces minusID<-AllMerged[c(3:17)] ##Removes ID wiht white spaces from dataframe Trimeddata<-cbind(Accession, Name, minusID) ## Replaced ID data without white spaces uniqueheatdata<-unique(Trimeddata) ## Removes duplicates heatdata<-uniqueheatdata[complete.cases(uniqueheatdata), ] heatmapdata<-as.matrix(heatdata[c(3:17)]) tiff("JHdataheatmap.tiff",compression="lzw",width=180, height=180,units="mm",res=600) par(oma=c(2,2,2,2)) heatmap(heatmapdata,labRow="") dev.off() ################################### uniquedata<-uniqueheatdata ##new object of unique and clean data #### Add 1 values for 3 Fresh samples to eable stats#### uniquedata$Fresh1 <- rep(1,nrow(uniquedata)) uniquedata$Fresh2 <- rep(1,nrow(uniquedata)) uniquedata$Fresh3 <- rep(1,nrow(uniquedata)) data<-uniquedata[c(1,2,18:20,3:17)] ctrldata<-data[c(3:5)] data24h<-data[c(6,9,12,15,18)] data72h<-data[c(7,10,13,16,19)] data168h<-data[c(8,11,14,17,20)] completedata<-data[complete.cases(data), ] ###limmadata### ################################################################################ ### Statistical analysis of proteins quantified in every sample; Liner model ### ################################################################################ library(limma) lm.data<-completedata prots<-lm.data[,1:2] lm.data<-lm.data[,-(1:2)] lglm.data<-log2(lm.data) treat<-as.factor(c("Control","Control","Control","D1","D3","D7","D1","D3","D7","D1","D3","D7","D1","D3","D7","D1","D3","D7")) design<-model.matrix(~0+treat) colnames(design)<-c("Control","D1", "D3", "D7") fit<-lmFit(lglm.data,design) contrasts<-makeContrasts("D1-Control","D3-Control", "D7-Control", levels=design) fit2<-contrasts.fit(fit, contrasts) rawt<- fit2$coef / fit2$stdev.unscaled / fit2$sigma rawp<- 2 * pt( abs(rawt), df=fit2$df.residual, lower.tail=FALSE) bh<-matrix(nrow=nrow(rawp), ncol=3) bh[,1]<-p.adjust(rawp[,1], method="BH") bh[,2]<-p.adjust(rawp[,2], method="BH") bh[,3]<-p.adjust(rawp[,3], method="BH") ##subset data with +/- 20% change in quantity and rawp or bh ajusted p <0.05 ##### sub1<-which((rawp[,1]<0.05)&(fit2$coef[,1]>0.26|fit2$coef[,1]<(-0.26))) sub1a<-which((bh[,1]<0.05)&(fit2$coef[,1]>0.26|fit2$coef[,1]<(-0.26))) sub2<-which((rawp[,2]<0.05)&(fit2$coef[,2]>0.26|fit2$coef[,2]<(-0.26))) sub2a<-which((bh[,2]<0.05)&(fit2$coef[,2]>0.26|fit2$coef[,2]<(-0.26))) sub3<-which((rawp[,3]<0.05)&(fit2$coef[,3]>0.26|fit2$coef[,3]<(-0.26))) sub3a<-which((bh[,3]<0.05)&(fit2$coef[,3]>0.26|fit2$coef[,3]<(-0.26))) ##Volcanoplots### tiff("Control 24h volcano.tiff",compression="lzw",width=180, height=180,units="mm",res=600) par(ps=14,cex=1.5,family="serif") plot(fit2$coef[,1], rawp[,1], log="y",ylim=c(1,1e-10),xlim=c(-5,5),xlab="logFc", ylab="p val", main="1 Day") points(fit2$coef[sub1,1], rawp[sub1,1], col="blue") points(fit2$coef[sub1a,1], rawp[sub1a,1], col="red") dev.off() tiff("Control 72h volcano.tiff",compression="lzw",width=180, height=180,units="mm",res=600) par(ps=14,cex=1.5,family="serif") plot(fit2$coef[,2], rawp[,2], log="y",ylim=c(1,1e-10),xlim=c(-5,5),xlab="logFc", ylab="p val", main="3 Days") points(fit2$coef[sub2,2], rawp[sub2,2], col="blue") points(fit2$coef[sub2a,2], rawp[sub2a,2], col="red") dev.off() tiff("Control 7Day volcano.tiff",compression="lzw",width=180, height=180,units="mm",res=600) par(ps=14,cex=1.5,family="serif") plot(fit2$coef[,3], rawp[,3], log="y",ylim=c(1,1e-10),xlim=c(-5,5),xlab="logFc", ylab="p val", main="7 Days") points(fit2$coef[sub3,3], rawp[sub3,3], col="blue") points(fit2$coef[sub3a,3], rawp[sub3a,3], col="red") dev.off() output<-cbind(prots,lm.data,fit2$coef,rawp,bh) write.csv(output,file="JHstatistics.csv") ###################