[CHNOSZ-commits] r250 - in pkg/CHNOSZ: . R demo inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 10 17:22:41 CEST 2017


Author: jedick
Date: 2017-10-10 17:22:41 +0200 (Tue, 10 Oct 2017)
New Revision: 250

Added:
   pkg/CHNOSZ/demo/TCA.R
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/R/util.plot.R
   pkg/CHNOSZ/demo/00Index
   pkg/CHNOSZ/demo/DEW.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/examples.Rd
   pkg/CHNOSZ/man/util.plot.Rd
Log:
add TCA.R demo (citric acid cycle; Canovas and Shock, 2016)


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-10-09 15:16:40 UTC (rev 249)
+++ pkg/CHNOSZ/DESCRIPTION	2017-10-10 15:22:41 UTC (rev 250)
@@ -1,6 +1,6 @@
-Date: 2017-10-09
+Date: 2017-10-10
 Package: CHNOSZ
-Version: 1.1.0-48
+Version: 1.1.0-49
 Title: Thermodynamic Calculations for Geobiochemistry
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R	2017-10-09 15:16:40 UTC (rev 249)
+++ pkg/CHNOSZ/R/diagram.R	2017-10-10 15:22:41 UTC (rev 250)
@@ -72,8 +72,10 @@
     })
     plotvar <- eout$property
     # we change 'A' to 'A/2.303RT' so the axis label is made correctly
-    if(plotvar=="A") plotvar <- "A/2.303RT"
-    message(paste("diagram: plotting", plotvar, "from affinity(), divided by balancing coefficients"))
+    if(plotvar=="A") {
+      plotvar <- "A/2.303RT"
+      message("diagram: plotting A/2.303RT / n.balance (maximum affinity method for 2-D diagrams)")
+    } else message(paste("diagram: plotting", plotvar, " / n.balance"))
   }
 
   ## number of dimensions (T, P or chemical potentials that are varied)
@@ -498,7 +500,7 @@
         if(is.null(xlab)) xlab <- axis.label(eout$vars[1], basis=eout$basis)
         if(is.null(ylab)) ylab <- axis.label(eout$vars[2], basis=eout$basis)
         if(tplot) thermo.plot.new(xlim=xlim, ylim=ylim, xlab=xlab, ylab=ylab,
-          cex=cex, cex.axis=cex.axis, mar=mar, yline=yline, side=side)
+          cex=cex, cex.axis=cex.axis, mar=mar, yline=yline, side=side, ...)
         else plot(0, 0, type="n", xlim=xlim, ylim=ylim, xlab=xlab, ylab=ylab, ...)
         # add a title
         if(!is.null(main)) title(main=main)

Modified: pkg/CHNOSZ/R/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R	2017-10-09 15:16:40 UTC (rev 249)
+++ pkg/CHNOSZ/R/examples.R	2017-10-10 15:22:41 UTC (rev 250)
@@ -29,7 +29,7 @@
 demos <- function(which=c("sources", "protein.equil", "affinity", "NaCl", "density", 
   "ORP", "revisit", "findit", "ionize", "buffer", "protbuff", "yeastgfp", "mosaic",
   "copper", "solubility", "wjd", "dehydration", "bugstab", "Shh", "activity_ratios",
-  "adenine", "DEW", "lambda"), to.file=FALSE) {
+  "adenine", "DEW", "lambda", "TCA"), to.file=FALSE) {
   # run one or more demos from CHNOSZ with ask=FALSE, and return the value of the last one
   for(i in 1:length(which)) {
     # say something so the user sees where we are

Modified: pkg/CHNOSZ/R/util.plot.R
===================================================================
--- pkg/CHNOSZ/R/util.plot.R	2017-10-09 15:16:40 UTC (rev 249)
+++ pkg/CHNOSZ/R/util.plot.R	2017-10-10 15:22:41 UTC (rev 250)
@@ -165,12 +165,12 @@
   return(invisible(list(xpoints=xpoints, y.oxidation=y.oxidation, y.reduction=y.reduction, swapped=swapped)))
 }
 
-mtitle <- function(main, line=0, ...) {
+mtitle <- function(main, line=0, spacing=1, ...) {
   # make a possibly multi-line plot title 
   # useful for including expressions on multiple lines 
   # 'line' is the margin line of the last (bottom) line of the title
-  l <- length(main)
-  for(i in 1:l) mtext(main[i], line=line+l-i, ...)
+  len <- length(main)
+  for(i in 1:len) mtext(main[i], line = line + (len - i)*spacing, ...)
 }
 
 # get colors for range of ZC values 20170206

Modified: pkg/CHNOSZ/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index	2017-10-09 15:16:40 UTC (rev 249)
+++ pkg/CHNOSZ/demo/00Index	2017-10-10 15:22:41 UTC (rev 250)
@@ -21,3 +21,4 @@
 adenine         HKF parameters regressed from heat capacity and volume of aqueous adenine
 DEW             Deep Earth Water (DEW) model for high pressures
 lambda          Effects of lambda transtion on thermodynamic properties of quartz
+TCA             Standard Gibbs energies of steps of the tricarboxylic acid cycle

Modified: pkg/CHNOSZ/demo/DEW.R
===================================================================
--- pkg/CHNOSZ/demo/DEW.R	2017-10-09 15:16:40 UTC (rev 249)
+++ pkg/CHNOSZ/demo/DEW.R	2017-10-10 15:22:41 UTC (rev 250)
@@ -132,7 +132,10 @@
 # P = 5.0GPa (50000 bar)
 # fO2 = QFM - 2
 # pH set by jadeite + kyanite + coesite (approximated here as constant)
-# dissolved carbon 0.03, 0.2, 1, 4, 20 molal
+# output from EQ3 calculations:
+# dissolved carbon: 0.03, 0.2, 1, 4, 20 molal
+# ionic strength: 0.39, 0.57, 0.88, 1.45, 2.49
+# activity coefficient (log gamma for singly charged species): -0.15, -0.18, -0.22, -0.26, -0.31
 
 T <- seq(600, 1000, 5)
 

Added: pkg/CHNOSZ/demo/TCA.R
===================================================================
--- pkg/CHNOSZ/demo/TCA.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/TCA.R	2017-10-10 15:22:41 UTC (rev 250)
@@ -0,0 +1,95 @@
+# TCA.R 20171010
+# Reproduce Fig. 6 in Canovas and Shock, 2016:
+# Plots of the standard partial molal Gibbs energy of reaction for each step in
+# the citric acid cycle for temperatures to 500 degrees C and pressures to 5 kbar.
+
+data(thermo)
+
+# species in reactions
+NADox <- "NAD(ox)-"; NADred <- "NAD(red)-2"
+ADP <- "ADP-3"; ATP <- "ATP-4"
+species <- list(
+  c("oxaloacetate-2", "pyruvate", "H2O", NADox, "citrate-3", NADred, "CO2", "H+"),
+  c("citrate-3", "cis-aconitate-3", "H2O"),
+  c("cis-aconitate-3", "H2O", "isocitrate-3"),
+  c("isocitrate-3", NADox, "a-ketoglutarate-2", NADred, "CO2"),
+  c("a-ketoglutarate-2", ADP, "HPO4-2", NADox, "succinate-2", ATP, NADred, "CO2"),
+  c("succinate-2", "fumarate-2", "H2"),
+  c("fumarate-2", "H2O", "malate-2"),
+  c("malate-2", NADox, "oxaloacetate-2", NADred, "H+"),
+  c("pyruvate", NADox, ADP, "HPO4-2", "H2O", "CO2", NADred, "H+", ATP, "H2")
+)
+# reaction coefficients
+coeffs <- list(
+  c(-1, -1, -1, -1, 1, 1, 1, 1),
+  c(-1, 1, 1),
+  c(-1, -1, 1),
+  c(-1, -1, 1, 1, 1),
+  c(-1, -1, -1, -1, 1, 1, 1, 1),
+  c(-1, 1, 1),
+  c(-1, -1, 1),
+  c(-1, -1, 1, 1, 1),
+  c(-1, -4, -1, -1, -2, 3, 4, 2, 1, 1)
+)
+# species names
+oxal <- quote(Oxaloacetate^-2)
+pyr <- quote(Pyruvate^-"")
+h2o <- quote(H[2]*O)
+nox <- quote(NAD[ox]^-"")
+cit <- quote(Citrate^-3)
+nred <- quote(NAD[red]^-2)
+co2 <- quote(CO[2*(italic(aq))])
+hplus <- quote(H^+"")
+iso <- quote(Isocitrate^-3)
+aco <- quote(italic(cis)*"-Aconitate"^-3)
+ket <- quote(alpha*"-Ketoglutarate"^-2)
+adp <- quote(ADP^-3)
+hpo4 <- quote(HPO[4]^-2)
+suc <- quote(Succinate^-2)
+atp <- quote(ATP^-4)
+fum <- quote(Fumarate^-2)
+h2 <- quote(H[2*(italic(aq))])
+mal <- quote(Malate^-2)
+sublist <- list(oxal=oxal, pyr=pyr, h2o=h2o, nox=nox, cit=cit, nred=nred,
+                co2=co2, hplus=hplus, aco=aco, iso=iso, ket=ket, adp=adp,
+                hpo4=hpo4, suc=suc, atp=atp, fum=fum, h2=h2, mal=mal)
+# reaction titles
+rtitle <- list(
+  c(substitute("       "*oxal + pyr + h2o + nox == "", sublist), substitute(cit + nred + co2 + hplus, sublist)),
+  substitute(cit == aco + h2o, sublist),
+  substitute(aco + h2o == iso*"   ", sublist),
+  c(substitute(iso + nox == "", sublist), substitute(ket + nred + co2*"   ", sublist)),
+  c(substitute(ket + adp + hpo4 + nox == "", sublist), substitute(suc + atp + nred + co2, sublist)),
+  substitute(suc == fum + h2, sublist),
+  substitute(fum + h2o == mal, sublist),
+  c(substitute(mal + nox == "                 ", sublist), substitute(oxal + nred + hplus * "             ", sublist)),
+  c(substitute(pyr + 4*nox + adp + hpo4 + 2*h2o == "                  ", sublist),
+    substitute(3*co2 + 4*nred + 2*hplus + atp + h2 * "           ", sublist))
+)
+# set up plot
+par(mfrow=c(3, 3))
+ylims <- list(
+  c(-10, 45), c(1, 6),   c(-2.5, 7.5),
+  c(-35, 5),  c(-9, 5),  c(5, 28),
+  c(-1.5, 6),   c(14, 18), c(20, 80)
+)
+# loop over reactions
+for(i in seq_along(species)) {
+  thermo.plot.new(xlim=c(0, 500), ylim=ylims[[i]], xlab=axis.label("T"),
+                  ylab=axis.label("DrG0", prefix="k"), mar=c(3.0, 3.5, 3.5, 2.0))
+  # loop over isobars
+  for(P in seq(500, 5000, 500)) {
+    T <- seq(0, 500, 10)
+    if(P==500) T <- seq(0, 350, 10)
+    if(P==5000) T <- seq(100, 500, 10)
+    # calculate and plot standard Gibbs energy
+    sout <- subcrt(species[[i]], coeffs[[i]], T=T, P=P)$out
+    lines(T, sout$G/1000)
+  }
+  if(is.list(rtitle[[i]])) mtitle(as.expression(rtitle[[i]]), spacing = 1.6, cex=0.8)
+  else mtitle(as.expression(rtitle[[i]]), line=0.4, cex=0.8)
+}
+# make an overall title
+opar <- par(xpd=NA)
+text(-70, 284, "Citric Acid Cycle, after Canovas and Shock, 2016", font=2, cex=1.5)
+par(opar)

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-10-09 15:16:40 UTC (rev 249)
+++ pkg/CHNOSZ/inst/NEWS	2017-10-10 15:22:41 UTC (rev 250)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.1.0-48 (2017-10-09)
+CHANGES IN CHNOSZ 1.1.0-49 (2017-10-10)
 ---------------------------------------
 
 MAJOR CHANGES:
@@ -117,6 +117,9 @@
 - Add maxdiff() and expect_maxdiff() for calculating and testing the
   maximum absolute pairwise difference between two objects.
 
+- Add demo TCA.R for standard Gibbs energies of steps of the
+  citric acid cycle (Canovas and Shock, 2016).
+
 CLEANUP:
 
 - To save space, taxid_names.csv has been trimmed to hold only those

Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd	2017-10-09 15:16:40 UTC (rev 249)
+++ pkg/CHNOSZ/man/examples.Rd	2017-10-10 15:22:41 UTC (rev 250)
@@ -18,7 +18,7 @@
     "density", "ORP", "revisit", "findit", "ionize", "buffer",
     "protbuff", "yeastgfp", "mosaic", "copper", "solubility",
     "wjd", "dehydration", "bugstab", "Shh", "activity_ratios",
-    "adenine", "DEW", "lambda"),
+    "adenine", "DEW", "lambda", "TCA"),
     to.file=FALSE)
 }
 
@@ -58,6 +58,7 @@
     \code{adenine} \tab * HKF parameters regressed from heat capacity and volume of aqueous adenine (Lowe et al., 2017) \cr
     \code{DEW} \tab * Deep Earth Water (DEW) model for high pressures (Sverjensky et al., 2014a and 2014b) \cr
     \code{lambda} \tab * Effects of lambda transition on thermodynamic properties of quartz (Berman, 1988) \cr
+    \code{TCA} \tab * Standard Gibbs energies of the tricarboxylic (citric) acid cycle (Canovas and Shock, 2016) \cr
   }
 
 }
@@ -71,6 +72,8 @@
 
 Berman, R. G. (1988) Internally-consistent thermodynamic data for minerals in the system Na{\s2}O–K{\s2}O–CaO–MgO–FeO–Fe{\s2}O{\s3}–Al{\s2}O{\s3}–SiO{\s2}–TiO{\s2}–H{\s2}O–CO{\s2}. \emph{J. Petrol.} \bold{29}, 445-522. \url{https://doi.org/10.1093/petrology/29.2.445}
 
+Canovas, P. A., III and Shock, E. L. (2016) Geobiochemistry of metabolism: Standard state thermodynamic properties of the citric acid cycle. \emph{Geochim. Cosmochim. Acta} \bold{195}, 293--322. \url{https://doi.org/10.1016/j.gca.2016.08.028}
+
 Dayhoff, M. O. and Lippincott, E. R. and Eck, R. V. (1964) Thermodynamic Equilibria In Prebiological Atmospheres. \emph{Science} \bold{146}, 1461--1464. \url{https://doi.org/10.1126/science.146.3650.1461}
 
 Dick, J. M. (2009) Calculation of the relative metastabilities of proteins in subcellular compartments of \emph{Saccharomyces cerevisiae}. \emph{BMC Syst. Biol.} \bold{3}:75. \url{https://doi.org/10.1186/1752-0509-3-75}

Modified: pkg/CHNOSZ/man/util.plot.Rd
===================================================================
--- pkg/CHNOSZ/man/util.plot.Rd	2017-10-09 15:16:40 UTC (rev 249)
+++ pkg/CHNOSZ/man/util.plot.Rd	2017-10-10 15:22:41 UTC (rev 250)
@@ -27,7 +27,7 @@
     italic = FALSE, ...)
   water.lines(eout, which = c("oxidation","reduction"),
     lty = 2, lwd=1, col = par("fg"), plot.it = TRUE)
-  mtitle(main, line=0, ...)
+  mtitle(main, line=0, spacing=1, ...)
   ZC.col(z)
 }
 
@@ -60,6 +60,7 @@
   \item{plot.it}{logical, plot the lines?}
   \item{main}{character, text for plot title}
   \item{line}{numeric, margin line to place title}
+  \item{spacing}{numeric, spacing between multiple lines}
   \item{z}{numeric, set of values}
 }
 



More information about the CHNOSZ-commits mailing list