# Additional File 1: Program listing # gt/plot.R 20080814 jmd # plot protein metastability diagrams # # to use, load CHNOSZ and source this file: # library(CHNOSZ) # source("plot.R.txt") # # then run one of the following commands: # figure(3,do.ps=TRUE) # 50s # figure(4,do.ps=TRUE) # 10s # figure(5,do.ps=TRUE) # 14s # figure(6,do.ps=TRUE) # 49s # figure(7,do.ps=TRUE) # 2m46s # set do.ps=FALSE (the default) to show # the plots on screen # # to make Fig. 7a in less time at lower resolution, do # res <- 40; plot.PT.buffer() # 33s # # timings were obtained with res=300 on a P4 2.4GHz # running Linux 2.6.24, R 2.7.1 and CHNOSZ 0.7 # plot resolution res <- 300 # protein settings organisms <- c("METSC","METJA","METFE","HALJP","METVO", "METBU","ACEKI","BACST","BACLI","AERSA") proteins <- c(rep("CSG",6),rep("SLAP",4)) proteins <- paste(proteins,organisms,sep="_") lwd <- c(rep(3,6),rep(1,4)) lty <- c(1:6,1:4) plot.logfO2pH.1 <- function() { basis("CHNOS+") species(proteins) a <- affinity(pH=c(0,14,res),O2=c(-85,-60,res)) diagram(a) # water line abline(h=-83.1,lty=2) label.plot("a") } plot.logfO2pH.2 <- function() { basis("CHNOS+") species(proteins) a <- affinity(pH=c(0,14,res),O2=c(-85,-60,res)) ispecies <- c(1,3,6,7,8,9,10) names <- proteins[ispecies] diagram(a,ispecies=ispecies,names=names) # water line abline(h=-83.1,lty=2) label.plot("b") } plot.ZpH <- function() { basis("CHNOS+") species(metproteins <- proteins[1:6]) # archaeal proteins pl <- protein.length(metproteins) ionize() pHlim <- c(0,14) a <- affinity(pH=c(pHlim,res)) z <- ionize(a$values,a$values) ylab=as.expression(quote(italic(Z[j])/residue)) thermo.plot.new(xlab="pH",ylab=ylab,xlim=pHlim,ylim=c(-0.3,0.2), yline=2,mar=c(3,3.5,2,1),lwd=2,cex=2) pHs <- seq(pHlim[1],pHlim[2],length.out=res) for(i in 1:length(pl)) { Zs <- z[[i]]/pl[i] lines(pHs,Zs,lty=i) } text(7,-0.25,"HALJP") text(7,-0.05,"METBU") text(7,-0.13,"METJA") text(7,-0.19,"METVO") lines(c(8.5,9.8),c(-0.19,-0.17)) text(7,0.03,"METFE") text(9.6,-0.025,"/METSC",srt=-40) label.plot("a") } plot.GpH <- function() { basis("CHNOS+") species(metproteins <- proteins[1:6]) # archaeal proteins pl <- protein.length(metproteins) ionize() pHlim <- c(0,14) a <- affinity(pH=c(pHlim,res)) g <- affinity(pH=c(pHlim,res),property="G") G <- ionize(a$values,g$values) ylab=as.expression(quote(list(Delta*italic(G*degree[j])/residue,kcal/mol))) thermo.plot.new(xlab="pH",ylab=ylab,xlim=pHlim,ylim=c(-55,-35), yline=2,mar=c(3,3.5,2,1),lwd=2,cex=2) pHs <- seq(pHlim[1],pHlim[2],length.out=res) for(i in 1:length(pl)) { Gs <- G[[i]]/pl[i]/1000 lines(pHs,Gs,lty=i) } text(7,-52.5,"HALJP") text(7,-47.5,"METJA") text(2,-42.3,"METBU") text(7,-44,"METVO") text(7,-40,"METSC") text(7,-38,"METFE") label.plot("b",xfrac=0.1) } plot.logfO2.1 <- function() { basis("CHNOS+") species(proteins) a <- affinity(O2=c(-90,-65,res)) diagram(a,ylim=c(-5,-1),legend.x=NULL,lwd=lwd, ylab=as.expression(quote(log~italic(a[j]))),yline=1.7) text(-80,-1.7,"METJA") text(-74.5,-1.7,"METVO") text(-69,-1.8,"HALJP") # water line abline(v=-83.1,lty=2) label.plot("a") } plot.logfO2.2 <- function() { basis("CHNOS+") species(proteins) a <- affinity(O2=c(-90,-65,res)) diagram(a,ylim=c(-5,-1),residue=TRUE,legend.x=NULL,lwd=lwd, ylab=as.expression(quote(log~italic(a[j]))),yline=1.7) text(-80,-1.9,"METJA") text(-74.5,-1.9,"METVO") text(-69,-1.9,"HALJP") text(-78,-2.85,"METBU",cex=0.8,srt=-22) text(-79,-3.15,"ACEKI",cex=0.8,srt=-25) text(-81,-3.3,"METSC",cex=0.8,srt=-25) text(-87,-3.1,"METFE",cex=0.8,srt=-17) text(-79,-4.3,"BACST",cex=0.8) text(-85.5,-4.7,"AERSA",cex=0.8,srt=38) text(-87,-4.25,"BACLI",cex=0.8,srt=30) # water line abline(v=-83.1,lty=2) label.plot("b") } plot.logfO2T <- function() { basis("CHNOS+") species(proteins) a <- affinity(T=c(0,150,res),O2=c(-85,-55,res)) diagram(a,names=NULL) text(43,-58,"CSG_HALJP") text(60,-67,"CSG_METVO",srt=32) text(75,-74,"CSG_METJA",srt=35) text(100,-77,"SLAP_ACEKI",srt=30) text(120,-82,"CSG_METFE") label.plot("a",xfrac=0.1) # water line T <- seq(0,150,length.out=res) TK <- convert(T,'K') water.lines(xaxis='T',yaxis='O2',T=TK,xpoints=T) } plot.logfO2P <- function() { basis("CHNOS+") species(proteins) a <- affinity(P=c(1,3000,res),O2=c(-85,-65,res)) proteins[2] <- "" diagram(a,names=proteins) text(1500,-80,"CSG_METJA") label.plot("b",xfrac=0.1) P <- seq(1,3000,length.out=res) water.lines(xaxis='P',yaxis='O2',T=298.15,P=P) } plot.PT.buffer <- function() { basis("CHNOS+") myprot <- proteins[c(2,1,5,6,3)] # METXX proteins basis("O2",-58) # buffer specification mod.buffer("s-layer",myprot) basisnames <- c("CO2","NH3","H2S","H2O") basis(basisnames,"s-layer") # buffer calculation species(myprot) b <- affinity(return.buffer=TRUE,T=100,P=1000) basis(basisnames,as.numeric(b)[match(basisnames,names(b))]) # plot calculation a <- affinity(T=c(95,105,res),P=c(10,3000,res)) myprot[c(1,2)] <- "" diagram(a,names=myprot) text(100.8,2200,"CSG_METJA") lines(c(99,98),c(2200,2000)) label.plot("a") } plot.logfO2pH.buffer <- function() { basis("CHNOS+") myprot <- proteins[c(2,1,5,6,3)] # METXX proteins basis("O2",-58) # buffer specification mod.buffer("s-layer",myprot) basisnames <- c("CO2","NH3","H2S","H2O") basis(basisnames,"s-layer") # buffer calculation species(myprot) b <- affinity(return.buffer=TRUE,T=100,P=1000) basis(basisnames,as.numeric(b)[match(basisnames,names(b))]) # plot calculation a <- affinity(pH=c(0,14,res),O2=c(-64,-54,res),T=100,P=1000) myprot[c(1,4)] <- "" diagram(a,names=myprot) text(11.2,-58.5,"CSG_METJA") text(4.2,-59,"CSG_METBU") lines(c(6.7,7.7),c(-59,-58.5)) # water stability line s <- subcrt(c("H2O","O2","H2"),c(-1,0.5,1),T=100,P=1000) abline(h=2*s$out$logK,lty=2) label.plot("b") } figure <- function(n,do.ps=FALSE) { if(do.ps) thermo.postscript(paste(n,"ps",sep="."),width=8,height=12) layout(matrix(1:2,nrow=2)) par(mar=c(3,3.5,2,1)) if(do.ps) par(cex=2,lwd=2) if(n==1) { # fig 1 is a flowchart for the package # (not done here) } else if(n==2) { # fig 2 is program interaction text # (not done here) } else if(n==3) { plot.logfO2pH.1() plot.logfO2pH.2() } else if(n==4) { plot.ZpH() plot.GpH() } else if(n==5) { plot.logfO2.1() plot.logfO2.2() } else if(n==6) { plot.logfO2T() plot.logfO2P() } else if(n==7) { plot.PT.buffer() plot.logfO2pH.buffer() } if(do.ps) dev.off() }