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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 14 12:37:02 CET 2017


Author: jedick
Date: 2017-02-14 12:37:01 +0100 (Tue, 14 Feb 2017)
New Revision: 150

Added:
   pkg/CHNOSZ/demo/add.obigt.R
   pkg/CHNOSZ/demo/affinity.R
   pkg/CHNOSZ/demo/protein.equil.R
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/demo/00Index
   pkg/CHNOSZ/demo/yeastgfp.R
   pkg/CHNOSZ/inst/CHECKLIST
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/CHNOSZ-package.Rd
   pkg/CHNOSZ/man/affinity.Rd
   pkg/CHNOSZ/man/diagram.Rd
   pkg/CHNOSZ/man/examples.Rd
   pkg/CHNOSZ/man/protein.info.Rd
   pkg/CHNOSZ/man/read.expr.Rd
   pkg/CHNOSZ/man/revisit.Rd
   pkg/CHNOSZ/vignettes/anintro.Rmd
   pkg/CHNOSZ/vignettes/equilibrium.Rnw
   pkg/CHNOSZ/vignettes/equilibrium.lyx
   pkg/CHNOSZ/vignettes/vig.bib
Log:
reduce R CMD check time


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/DESCRIPTION	2017-02-14 11:37:01 UTC (rev 150)
@@ -1,6 +1,6 @@
 Date: 2017-02-14
 Package: CHNOSZ
-Version: 1.0.8-39
+Version: 1.0.8-40
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/R/examples.R	2017-02-14 11:37:01 UTC (rev 150)
@@ -29,9 +29,8 @@
   cat("Time elapsed: ", proc.time() - .ptime, "\n")
 }
 
-demos <- function(which=c("sources", "NaCl", "density", 
-  "ORP", "revisit", "findit",
-  "ionize", "buffer", "protbuff", "yeastgfp", "mosaic",
+demos <- function(which=c("sources", "protein.equil", "add.obigt", "affinity", "NaCl", "density", 
+  "ORP", "revisit", "findit", "ionize", "buffer", "protbuff", "yeastgfp", "mosaic",
   "copper", "solubility", "wjd", "dehydration", "bugstab"), 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)) {

Modified: pkg/CHNOSZ/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/demo/00Index	2017-02-14 11:37:01 UTC (rev 150)
@@ -1,4 +1,7 @@
 sources         cross-check the reference list with the thermodynamic database
+protein.equil   chemical activities of two proteins in metastable equilibrium
+add.obigt       a couple of diagrams using the secondary thermodynamic database
+affinity        affinities of metabolic reactions and amino acid synthesis
 NaCl            equilibrium constant for aqueous NaCl dissociation
 density         density of H2O, inverted from IAPWS-95 equations
 ORP             oxidation-reduction potential of redox standards as a function of temperature

Added: pkg/CHNOSZ/demo/add.obigt.R
===================================================================
--- pkg/CHNOSZ/demo/add.obigt.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/add.obigt.R	2017-02-14 11:37:01 UTC (rev 150)
@@ -0,0 +1,37 @@
+## pe-pH diagram for hydrated iron sulfides,
+## goethite and pyrite, after Majzlan et al., 2006
+##  Majzlan, J., Navrotsky, A., McClesky, R. B. and Alpers, C. N. (2006) Thermodynamic properties and crystal structure refinement of ferricopiapite, coquimbite, rhomboclase, and Fe2(SO4)3(H2O)5. \emph{Eur. J. Mineral.} \bold{18}, 175--186. \url{http://dx.doi.org/10.1127/0935-1221/2006/0018-0175}
+# add some of these species to the database
+add.obigt()
+basis(c("Fe+2", "SO4-2", "H2O", "H+", "e-"), 
+  c(0, log10(3), log10(0.75), 999, 999))
+species(c("rhomboclase", "ferricopiapite", "hydronium jarosite",
+  "goethite", "melanterite", "pyrite"))
+a <- affinity(pH=c(-1, 4, 256), pe=c(-5, 23, 256))
+d <- diagram(a, main="Fe-S-O-H, after Majzlan et al., 2006")
+# the first four species show up along the top of the diagram
+stopifnot(all.equal(unique(t(d$predominant)[256,]), 1:4))
+water.lines(yaxis="pe")
+text(3, 22, describe.basis(thermo$basis[2:3,], digits=2, oneline=TRUE))
+text(3, 21, describe.property(c("T", "P"), c(25, 1), oneline=TRUE))
+# reset the database
+data(thermo)
+
+## Aqueous Aluminum Species F-/OH-, after Tagirov and Schott, 2001
+##  Tagirov, B. and Schott, J. (2001) Aluminum speciation in crustal fluids revisited. \emph{Geochim. Cosmochim. Acta} \bold{65}, 3965--3992. \url{http://dx.doi.org/10.1016/S0016-7037(01)00705-0}
+# some of the species are not in the default databse
+add.obigt()
+# the 999s have no effect on the diagram:
+# pH and log_a(F-) are plotting variables
+# O2 is not in the formation reactions
+# Al+3 is the balanced quantity
+basis(c("Al+3", "F-", "H+", "O2", "H2O"), c(rep(999, 4), 0))
+species(c("Al+3", "Al(OH)4-", "AlOH+2", "Al(OH)2+", "Al(OH)3",
+  "AlF+2", "AlF2+", "AlF3", "AlF4-", "Al(OH)2F2-", "Al(OH)2F",
+  "AlOHF2"), "aq")
+a <- affinity(pH=c(0, 10), "F-"=c(-1, -9), T=200)
+diagram(a, fill="heat")
+title(main=paste("Aqueous aluminium species, T=200 C, P=Psat\n",
+  "after Tagirov and Schott, 2001"))
+# restore thermodynamic database to default
+data(thermo)

Added: pkg/CHNOSZ/demo/affinity.R
===================================================================
--- pkg/CHNOSZ/demo/affinity.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/affinity.R	2017-02-14 11:37:01 UTC (rev 150)
@@ -0,0 +1,90 @@
+## affinities of metabolic reactions
+## after Amend and Shock, 2001, Fig. 7
+##  Amend, J. P. and Shock, E. L. (2001) Energetics of overall metabolic reactions of thermophilic and hyperthermophilic Archaea and Bacteria. \emph{FEMS Microbiol. Rev.} \bold{25}, 175--243. \url{http://dx.doi.org/10.1016/S0168-6445(00)00062-0}
+# use aq state for all basis species (including O2)
+basis(c("CO2", "H2", "NH3", "O2", "H2S", "H+"), "aq")
+# we're going to make H2O
+species("H2O")
+# a function to create the plots
+doplot <- function(T) {
+  res <- 20
+  # calculate affinity/2.303RT as a function of loga(H2) and loga(O2)
+  a <- affinity(H2=c(-10, 0, res), O2=c(-10, 0, res), T=T)
+  T.K <- convert(T, "K")                   # temperature in Kelvin
+  acal <- convert(a$values[[1]], "G", T.K) # affinity (cal/mol)
+  akJ <- convert(acal, "J")/1000           # affinity (kJ/mol)
+  # now contour the values
+  xyvals <- seq(-10, 0, length.out=res)
+  contour(x=xyvals, y=xyvals, z=t(akJ), levels=seq(-150, -250, -20),
+    labcex=1, xlab=axis.label("H2"), ylab=axis.label("O2"))
+  # show the temperature
+  legend("topleft", bg="white", cex=1,
+    legend=describe.property("T", T, digits=0, ret.val=TRUE) )
+}
+# plot layout with space for title at top
+layout(matrix(c(1, 1, 2, 3, 4, 5), ncol=2, byrow=TRUE), heights=c(1, 4, 4))
+opar <- par(mar=c(0, 0, 0, 0))
+plot.new()
+# we use subcrt() to generate a reaction for titling the plot
+rxnexpr <- describe.reaction(subcrt("H2O", 1)$reaction, states="all")
+# also in the title is the property with its units
+E.units("J")
+Gexpr <- axis.label("DGr", prefix="k")[[2]]
+text(0.5, 0.6, substitute(paste(G~~"for"~~r), list(G=Gexpr, r=rxnexpr)), cex=2)
+text(0.5, 0.2, "after Amend and Shock, 2001 Figure 7", cex=2)
+# now make the plots
+par(mar=c(3, 3, 0.5, 0.5), cex=1.3, mgp=c(2, 1, 0))
+sapply(c(25, 55, 100, 150), doplot)
+# affinity() can handle the three dimensions simultaneously
+print(affinity(H2=c(-10, 0, 3), O2=c(-10, 0, 3), T=c(25, 150, 4))$values)
+# this is so the plots in the next examples show up OK
+E.units("cal")
+layout(matrix(1))
+par(opar)
+
+## amino acid synthesis at low and high temperatures
+## after Amend and Shock, 1998
+##  Amend, J. P. and Shock, E. L. (1998) Energetics of amino acid synthesis in hydrothermal ecosystems. \emph{Science} \bold{281}, 1659--1662. \url{http://dx.doi.org/10.1126/science.281.5383.1659}
+# select the basis species and species of interest
+# and set their activities, first for the 18 degree C case
+basis(c("H2O", "CO2", "NH4+", "H2", "H+", "H2S"),
+  log10(c(1, 1e-4, 5e-8, 2e-9, 5e-9, 1e-15)))
+species(sort(aminoacids("Z")),
+  log10(c(3.9, 0.7, 1.1, 3.3, 0.5, 3.8, 1.0, 5.8, 1.2, 0.7,
+  0.8, 1.0, 2.8, 0.5, 0.5, 4.6, 5.8, 0.6, 0.9, 2.8)/1e9))
+T <- 18
+TK <- convert(T, "K")
+# calculate A/2.303RT (dimensionless), convert to G of reaction (cal/mol)
+a <- affinity(T=T)
+G.18.cal <- convert(unlist(a$values), "G", T=TK)
+# covvert to kJ/mol
+G.18.kJ <- convert(G.18.cal, "J")/1000
+# the 100 degree C case
+basis(c("H2O", "CO2", "NH4+", "H2", "H+", "H2S"),
+  log10(c(1, 2.2e-3, 2.9e-6, 3.4e-4, 1.9e-6, 1.6e-3)))
+species(1:20, log10(c(2.8e-9, 5.0e-10, 7.9e-10, 2.4e-9, 3.6e-10,
+  2.7e-9, 7.2e-10, 4.2e-9, 8.6e-10, 5.0e-10, 5.7e-10, 7.2e-10, 2.0e-9,
+  3.6e-10,3.6e-10, 3.3e-9, 4.2e-9, 4.3e-10, 6.5e-10, 2.0e-9)))
+T <- 100
+TK <- convert(T, "K")
+a <- affinity(T=T)
+G.100.cal <- convert(unlist(a$values), "G", T=TK)
+G.100.kJ <- convert(G.100.cal, "J")/1000
+# the average oxidation states of carbon
+Z.C <- ZC(thermo$obigt$formula[thermo$species$ispecies])
+# put everything together a la Table 3 in the paper
+print(out <- data.frame(G.18=G.18.kJ, G.100=G.100.kJ, Z.C=Z.C))
+# make a plot; set units to get correct label
+E.units("J")
+plot(out$Z.C, out$G.18, pch=20, xlim=c(-1.1, 1.1), ylim=c(-200, 500), 
+  xlab=axis.label("ZC"), ylab=axis.label("DGr"))
+points(out$Z.C, out$G.100, col="red", pch=20)
+legend("topleft", pch=c(20, 20), col=c("black", "red"),
+  legend=describe.property(c("T", "T"), c(18, 100)))
+title(main="Amino acid synthesis, after Amend and Shock, 1998")
+# 9 amino acids have negative delta Gr under hydrothermal conditions
+# (cf. AS98 with 11; we are using more recent thermodynamic data)
+stopifnot(sum(out$G.100 < 0)==9)
+# reset units and species to run next examples
+E.units("cal")
+species(delete=TRUE)

Added: pkg/CHNOSZ/demo/protein.equil.R
===================================================================
--- pkg/CHNOSZ/demo/protein.equil.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/protein.equil.R	2017-02-14 11:37:01 UTC (rev 150)
@@ -0,0 +1,27 @@
+## steps in calculation of chemical activities of two proteins
+## in metastable equilibrium, after Dick and Shock, 2011
+protein <- iprotein(c("CSG_METVO", "CSG_METJA"))
+# clear out amino acid residues loaded by the example above
+# ( in affinity(iprotein=ip) )
+data(thermo)
+# use properties of the "old" [Met] sidechain group (Dick et al., 2006)
+mod.obigt("[Met]", G=-35245, H=-59310)
+# set up the basis species to those used in DS11
+basis("CHNOS+")
+# note this yields logaH2 = -4.657486
+swap.basis("O2", "H2")
+# demonstrate the steps of the equilibrium calculation
+protein.equil(protein, loga.protein=-3)
+## we can also look at the affinities
+# (Reaction 7, Dick and Shock, 2011)
+# A/2.303RT for protein at unit activity (A-star for the protein)
+a <- affinity(iprotein=protein[1], loga.protein=0)
+Astar.protein <- a$values[[1]]
+# divide affinity by protein length (A-star for the residue)
+pl <- protein.length(protein[1])
+Astar.residue <- a$values[[1]]/pl  # 0.1893, Eq. 11
+# A/2.303RT per residue corresponding to protein activity of 10^-3
+loga.residue <- log10(pl*10^-3)
+Aref.residue <- Astar.residue - loga.residue  # 0.446, after Eq. 16
+# A-star of the residue in natural log units (A/RT)
+log(10) * Astar.residue  # 0.4359, after Eq. 23

Modified: pkg/CHNOSZ/demo/yeastgfp.R
===================================================================
--- pkg/CHNOSZ/demo/yeastgfp.R	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/demo/yeastgfp.R	2017-02-14 11:37:01 UTC (rev 150)
@@ -47,5 +47,27 @@
 # return to plot defaults
 layout(matrix(1))
 par(opar)
+
+## Localizations and abundances of proteins from YeastGFP are used here
+## to calculate an abundance-weighted average of amino acid compositions of proteins
+## in different subcellular compartments of yeast.
+## This figure is similar to Fig. 3 of Dick (2009). 
+locations <- yeastgfp()
+gfp <- yeastgfp(locations)
+aa <- more.aa(gfp$protein, "Sce")
+for(i in 1:length(locations)) {
+  avgaa <- aasum(aa[[i]], gfp$abundance[[i]], average=TRUE, protein=locations[i])
+  add.protein(avgaa)
+}
+basis("CHNOS+")
+species(locations, "Sce")
+a <- affinity(O2=c(-82, -65))
+e <- equilibrate(a, loga.balance=0, normalize=TRUE)
+mycolor <- topo.colors(length(locations))
+diagram(e, names=locations, ylim=c(-5, -3), col=mycolor, lwd=2)
+dp <- describe.property(c("T", "P"), c(25, 1))
+db <- describe.basis(ibasis=(1:6)[-5])
+legend("topright", legend=c(dp, db), bty="n")
+
 # reset thermodynamic database
 data(thermo)

Modified: pkg/CHNOSZ/inst/CHECKLIST
===================================================================
--- pkg/CHNOSZ/inst/CHECKLIST	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/inst/CHECKLIST	2017-02-14 11:37:01 UTC (rev 150)
@@ -7,8 +7,7 @@
 
 - compile vignettes with release version number and date.
 
-- run examples() and demos() to make sure they can be run
-  (that includes \donttest ones that aren't run by R CMD check)
+- run examples() and demos() to check their output and
 
 - check output of demo("sources") to make sure all data sources are cited
 

Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/inst/NEWS	2017-02-14 11:37:01 UTC (rev 150)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.8-39 (2017-02-14)
+CHANGES IN CHNOSZ 1.0.8-40 (2017-02-14)
 ---------------------------------------
 
 DOCUMENTATION:
@@ -9,7 +9,8 @@
 - Add eos-regress.Rmd vignette; update related functions.
 
 - Demos: add bugstab.R, rename buffer.R to protbuff.R, add new buffer.R,
-  remove nucleobase.R.
+  remove nucleobase.R, and add protein.equil.R, add.obigt.R, and
+  affinity.R (examples moved from help pages).
 
 NEW DATA AND FEATURES:
 

Modified: pkg/CHNOSZ/man/CHNOSZ-package.Rd
===================================================================
--- pkg/CHNOSZ/man/CHNOSZ-package.Rd	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/man/CHNOSZ-package.Rd	2017-02-14 11:37:01 UTC (rev 150)
@@ -112,57 +112,4 @@
   Values of activity coefficients may be affected by an unidentified bug in \code{\link{nonideal}}.
 }
 
-\examples{
-### Getting Started
-## the 'thermo' object contains thermodynamic data and is also where
-## user's settings (definition of chemical system) are stored
-data(thermo)
-
-## standard thermodynamic properties of species
-subcrt("H2O")
-subcrt("alanine")
-# names of proteins have an underscore
-subcrt("LYSC_CHICK")  
-# custom temperature range
-T <- seq(0, 500, 100)
-subcrt("H2O", T=T, P=1000)
-# temperature - pressure grid
-P <- seq(1000, 4000, 1000)
-subcrt("H2O", T=T, P=P, grid="P")
-
-## information about species
-# query the database using formulas
-info("C6H12O6")
-info("SiO2")
-# query using names
-info("quartz")
-si <- info(c("glucose", "mannose"))
-# show the equations of state parameters
-info(si)
-# approximate matches for names or formulas
-info("acid ")
-info("SiO2 ")
-
-## standard thermodynamic properties of reactions
-# fermentation example
-info(c("fructose", "ethanol"))
-subcrt(c("fructose", "C2H5OH", "CO2"), c(-1, 2, 2))
-# weathering example -- also see transfer()
-subcrt(c("k-feldspar", "H2O", "H+", "kaolinite", "K+", "SiO2"),
-  c(-2, -1, -2, 1, 2, 4))
-# partial reaction auto-completion is possible
-basis(c("SiO2", "H2O", "K+", "H+", "O2"))
-subcrt(c("k-feldspar", "kaolinite"), c(-2, 1))
-
-## chemical affinities
-# set basis species and their activities or fugacities
-basis(c("CO2", "H2O", "O2"), c(-3, 0, -80))
-# set species of interest
-species(c("CH4", "C2H4O2", "CO2"))
-# chemical affinities of formation reactions
-# take off $values for complete output
-affinity()$values
-affinity(O2=c(-90, -60, 4))$values
-}
-
 \keyword{package}

Modified: pkg/CHNOSZ/man/affinity.Rd
===================================================================
--- pkg/CHNOSZ/man/affinity.Rd	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/man/affinity.Rd	2017-02-14 11:37:01 UTC (rev 150)
@@ -66,6 +66,7 @@
 Usually, \code{\link{equilibrate}} is the next step in calculations of chemical equilibrium.
 The help for \code{\link{buffer}} has some examples of using chemical activity buffers.
 The guts of the calculations provided by \code{affinity} involve \code{\link{energy.args}} and \code{\link{energy}}, which normally are not part of the user interaction.
+Longer examples are in \code{demo{affinity}}.
 }
 
 \examples{
@@ -77,12 +78,8 @@
 affinity()
 # at higher temperature and pressure
 affinity(T=500, P=2000)
-# ten different temperatures at one pressure
-affinity(T=c(500, 1000, 10), P=2000)
 # at 25 temperatures and pressures
 affinity(T=c(500, 1000, 5), P=c(1000, 5000, 5))
-# as a function of logarithm of activity of MgO
-affinity(MgO=c(-10, -5, 10))
 # equilibrium constants of formation reactions
 affinity(property="logK")
 # standard molal Gibbs energies of species,
@@ -93,109 +90,12 @@
 # a T,P-transect
 # (fluid pressure from Helgeson et al., 2009 Fig. 7)
 affinity(T=c(25, 110, 115, 215), P=c(11, 335, 500, 1450))
-
-## affinities of metabolic reactions
-## after Amend and Shock, 2001, Fig. 7
-# use aq state for all basis species (including O2)
-basis(c("CO2", "H2", "NH3", "O2", "H2S", "H+"), "aq")
-# we're going to make H2O
-species("H2O")
-# a function to create the plots
-doplot <- function(T) {
-  res <- 20
-  # calculate affinity/2.303RT as a function of loga(H2) and loga(O2)
-  a <- affinity(H2=c(-10, 0, res), O2=c(-10, 0, res), T=T)
-  T.K <- convert(T, "K")                   # temperature in Kelvin
-  acal <- convert(a$values[[1]], "G", T.K) # affinity (cal/mol)
-  akJ <- convert(acal, "J")/1000           # affinity (kJ/mol)
-  # now contour the values
-  xyvals <- seq(-10, 0, length.out=res)
-  contour(x=xyvals, y=xyvals, z=t(akJ), levels=seq(-150, -250, -20),
-    labcex=1, xlab=axis.label("H2"), ylab=axis.label("O2"))
-  # show the temperature
-  legend("topleft", bg="white", cex=1,
-    legend=describe.property("T", T, digits=0, ret.val=TRUE) )
 }
-# plot layout with space for title at top
-layout(matrix(c(1, 1, 2, 3, 4, 5), ncol=2, byrow=TRUE), heights=c(1, 4, 4))
-par(mar=c(0, 0, 0, 0))
-plot.new()
-# we use subcrt() to generate a reaction for titling the plot
-rxnexpr <- describe.reaction(subcrt("H2O", 1)$reaction, states="all")
-# also in the title is the property with its units
-E.units("J")
-Gexpr <- axis.label("DGr", prefix="k")[[2]]
-text(0.5, 0.6, substitute(paste(G~~"for"~~r), list(G=Gexpr, r=rxnexpr)), cex=2)
-text(0.5, 0.2, "after Amend and Shock, 2001 Figure 7", cex=2)
-# now make the plots
-par(mar=c(3, 3, 0.5, 0.5), cex=1.3, mgp=c(2, 1, 0))
-sapply(c(25, 55, 100, 150), doplot)
-# affinity() can handle the three dimensions simultaneously
-print(affinity(H2=c(-10, 0, 3), O2=c(-10, 0, 3), T=c(25, 150, 4))$values)
-# this is so the plots in the next examples show up OK
-E.units("cal")
-layout(matrix(1))
-par(mar=c(5.1, 4.1, 4.1, 2.1))
 
-## amino acid synthesis at low and high temperatures
-## after Amend and Shock, 1998
-# select the basis species and species of interest
-# and set their activities, first for the 18 degree C case
-basis(c("H2O", "CO2", "NH4+", "H2", "H+", "H2S"),
-  log10(c(1, 1e-4, 5e-8, 2e-9, 5e-9, 1e-15)))
-species(sort(aminoacids("Z")),
-  log10(c(3.9, 0.7, 1.1, 3.3, 0.5, 3.8, 1.0, 5.8, 1.2, 0.7,
-  0.8, 1.0, 2.8, 0.5, 0.5, 4.6, 5.8, 0.6, 0.9, 2.8)/1e9))
-T <- 18
-TK <- convert(T, "K")
-# calculate A/2.303RT (dimensionless), convert to G of reaction (cal/mol)
-a <- affinity(T=T)
-G.18.cal <- convert(unlist(a$values), "G", T=TK)
-# covvert to kJ/mol
-G.18.kJ <- convert(G.18.cal, "J")/1000
-# the 100 degree C case
-basis(c("H2O", "CO2", "NH4+", "H2", "H+", "H2S"),
-  log10(c(1, 2.2e-3, 2.9e-6, 3.4e-4, 1.9e-6, 1.6e-3)))
-species(1:20, log10(c(2.8e-9, 5.0e-10, 7.9e-10, 2.4e-9, 3.6e-10,
-  2.7e-9, 7.2e-10, 4.2e-9, 8.6e-10, 5.0e-10, 5.7e-10, 7.2e-10, 2.0e-9,
-  3.6e-10,3.6e-10, 3.3e-9, 4.2e-9, 4.3e-10, 6.5e-10, 2.0e-9)))
-T <- 100
-TK <- convert(T, "K")
-a <- affinity(T=T)
-G.100.cal <- convert(unlist(a$values), "G", T=TK)
-G.100.kJ <- convert(G.100.cal, "J")/1000
-# the average oxidation states of carbon
-Z.C <- ZC(thermo$obigt$formula[thermo$species$ispecies])
-# put everything together a la Table 3 in the paper
-print(out <- data.frame(G.18=G.18.kJ, G.100=G.100.kJ, Z.C=Z.C))
-# make a plot; set units to get correct label
-E.units("J")
-plot(out$Z.C, out$G.18, pch=20, xlim=c(-1.1, 1.1), ylim=c(-200, 500), 
-  xlab=axis.label("ZC"), ylab=axis.label("DGr"))
-points(out$Z.C, out$G.100, col="red", pch=20)
-legend("topleft", pch=c(20, 20), col=c("black", "red"),
-  legend=describe.property(c("T", "T"), c(18, 100)))
-title(main="Amino acid synthesis, after Amend and Shock, 1998")
-# 9 amino acids have negative delta Gr under hydrothermal conditions
-# (cf. AS98 with 11; we are using more recent thermodynamic data)
-stopifnot(sum(out$G.100 < 0)==9)
-# reset units and species to run next examples
-E.units("cal")
-species(delete=TRUE)
-}
-
 \references{
-  Amend, J. P. and Shock, E. L. (1998) Energetics of amino acid synthesis in hydrothermal ecosystems. \emph{Science} \bold{281}, 1659--1662. \url{http://dx.doi.org/10.1126/science.281.5383.1659}
-
-  Amend, J. P. and Shock, E. L. (2001) Energetics of overall metabolic reactions of thermophilic and hyperthermophilic Archaea and Bacteria. \emph{FEMS Microbiol. Rev.} \bold{25}, 175--243. \url{http://dx.doi.org/10.1016/S0168-6445(00)00062-0}
-
-  Dick, J. M., LaRowe, D. E. and Helgeson, H. C. (2006) Temperature, pressure, and electrochemical constraints on protein speciation: Group additivity calculation of the standard molal thermodynamic properties of ionized unfolded proteins. \emph{Biogeosciences} \bold{3}, 311--336. \url{http://www.biogeosciences.net/3/311/2006/bg-3-311-2006.html}
-
   Helgeson, H. C., Richard, L, McKenzie, W. F., Norton, D. L. and Schmitt, A. (2009) A chemical and thermodynamic model of oil generation in hydrocarbon source rocks. \emph{Geochim. Cosmochim. Acta} \bold{73}, 594--695. \url{http://dx.doi.org/10.1016/j.gca.2008.03.004}
 
   Kondepudi, D. K. and Prigogine, I. (1998) \emph{Modern Thermodynamics: From Heat Engines to Dissipative Structures}, John Wiley & Sons, New York, 486 p. \url{http://www.worldcat.org/oclc/38055900}
-
-  Shock, E. and Canovas, P. (2010) The potential for abiotic organic synthesis and biosynthesis at seafloor hydrothermal systems. \emph{Geofluids} \bold{10}, 161--192. \url{http://dx.doi.org/10.1111/j.1468-8123.2010.00277.x}
 }
 
 

Modified: pkg/CHNOSZ/man/diagram.Rd
===================================================================
--- pkg/CHNOSZ/man/diagram.Rd	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/man/diagram.Rd	2017-02-14 11:37:01 UTC (rev 150)
@@ -161,19 +161,6 @@
 
 ### 1-D diagrams: logarithms of activities
 
-## Aqueous sulfur species (after Seewald, 1997 and 2001)
-basis("CHNOS+")
-basis("pH", 5)
-species(c("H2S", "S2-2", "S3-2", "S2O3-2", "S2O4-2", 
-  "S3O6-2", "S5O6-2", "S2O6-2", "HSO3-", "SO2", "HSO4-"))
-a <- affinity(O2=c(-50, -15), T=325, P=350)
-e <- equilibrate(a, loga.balance=-2)
-diagram(e, ylim=c(-30, 0), legend.x="topleft")
-title(main=paste("Aqueous sulfur speciation, 325 degC, 350 bar\n",
-  "After Seewald, 1997"))
-# try it with and without the loga.balance argument (total activity of 
-# the balanced quantity, in this case H2S aka sulfur) 
-
 ## Degrees of formation of ionized forms of glycine
 ## After Fig. 1 of Aksu and Doyle, 2001 
 basis("CHNOS+")
@@ -234,42 +221,6 @@
 # note: Bowers et al. use different variables (e.g. (a_Ca+2)/(a_H+)^2),
 # so the plot here is not an exact reproduction
 
-## pe-pH diagram for hydrated iron sulfides,
-## goethite and pyrite, after Majzlan et al., 2006
-# add some of these species to the database
-add.obigt()
-basis(c("Fe+2", "SO4-2", "H2O", "H+", "e-"), 
-  c(0, log10(3), log10(0.75), 999, 999))
-species(c("rhomboclase", "ferricopiapite", "hydronium jarosite",
-  "goethite", "melanterite", "pyrite"))
-a <- affinity(pH=c(-1, 4, 256), pe=c(-5, 23, 256))
-d <- diagram(a, main="Fe-S-O-H, after Majzlan et al., 2006")
-# the first four species show up along the top of the diagram
-stopifnot(all.equal(unique(t(d$predominant)[256,]), 1:4))
-water.lines(yaxis="pe")
-text(3, 22, describe.basis(thermo$basis[2:3,], digits=2, oneline=TRUE))
-text(3, 21, describe.property(c("T", "P"), c(25, 1), oneline=TRUE))
-# reset the database
-data(thermo)
-
-## Aqueous Aluminum Species F-/OH-, after Tagirov and Schott, 2001
-# some of the species are not in the default databse
-add.obigt()
-# the 999s have no effect on the diagram:
-# pH and log_a(F-) are plotting variables
-# O2 is not in the formation reactions
-# Al+3 is the balanced quantity
-basis(c("Al+3", "F-", "H+", "O2", "H2O"), c(rep(999, 4), 0))
-species(c("Al+3", "Al(OH)4-", "AlOH+2", "Al(OH)2+", "Al(OH)3",
-  "AlF+2", "AlF2+", "AlF3", "AlF4-", "Al(OH)2F2-", "Al(OH)2F",
-  "AlOHF2"), "aq")
-a <- affinity(pH=c(0, 10), "F-"=c(-1, -9), T=200)
-diagram(a, fill="heat")
-title(main=paste("Aqueous aluminium species, T=200 C, P=Psat\n",
-  "after Tagirov and Schott, 2001"))
-# restore thermodynamic database to default
-data(thermo)
-
 ## Temperature-Pressure: kayanite-sillimanite-andalusite
 # cf. Fig. 49 of Helgeson et al., 1978
 # this is a system of one component (Al2SiO5), but we need the same 
@@ -307,14 +258,10 @@
 
   LaRowe, D. E. and Helgeson, H. C. (2007) Quantifying the energetics of metabolic reactions in diverse biogeochemical systems: electron flow and ATP synthesis. \emph{Geobiology} \bold{5}, 153--168. \url{http://dx.doi.org/10.1111/j.1472-4669.2007.00099.x}
 
-  Majzlan, J., Navrotsky, A., McClesky, R. B. and Alpers, C. N. (2006) Thermodynamic properties and crystal structure refinement of ferricopiapite, coquimbite, rhomboclase, and Fe2(SO4)3(H2O)5. \emph{Eur. J. Mineral.} \bold{18}, 175--186. \url{http://dx.doi.org/10.1127/0935-1221/2006/0018-0175}
-
   Seewald, J. S. (1997) Mineral redox buffers and the stability of organic compounds under hydrothermal conditions. \emph{Mat. Res. Soc. Symp. Proc.} \bold{432}, 317--331. \url{http://dx.doi.org/10.1557/PROC-432-317}
 
   Seewald, J. S. (2001) Aqueous geochemistry of low molecular weight hydrocarbons at elevated temperatures and pressures: Constraints from mineral buffered laboratory experiments \emph{Geochim. Cosmochim. Acta} \bold{65}, 1641--1664. \url{http://dx.doi.org/10.1016/S0016-7037(01)00544-0}
 
-  Tagirov, B. and Schott, J. (2001) Aluminum speciation in crustal fluids revisited. \emph{Geochim. Cosmochim. Acta} \bold{65}, 3965--3992. \url{http://dx.doi.org/10.1016/S0016-7037(01)00705-0}
-
 }
 
 \concept{Primary thermodynamic modeling}

Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/man/examples.Rd	2017-02-14 11:37:01 UTC (rev 150)
@@ -14,9 +14,8 @@
 
 \usage{
   examples(do.png = FALSE)
-  demos(which = c("sources", "NaCl", "density",
-    "ORP", "revisit", "findit", 
-    "ionize", "buffer", "protbuff", "yeastgfp", "mosaic",
+  demos(which = c("sources", "protein.equil", "add.obigt", "affinity", "NaCl", "density",
+    "ORP", "revisit", "findit", "ionize", "buffer", "protbuff", "yeastgfp", "mosaic",
     "copper", "solubility", "wjd", "dehydration", "bugstab"), to.file=FALSE)
 }
 
@@ -33,6 +32,9 @@
 
   \tabular{ll}{
     \code{sources} \tab cross-check the reference list with the thermodynamic database \cr
+    \code{protein.equil} \tab chemical activities of two proteins in metastable equilibrium (Dick and Shock, 2011) \cr
+    \code{add.obigt} \tab a couple of diagrams using the secondary thermodynamic database \cr
+    \code{affinity} \tab affinities of metabolic reactions and amino acid synthesis \cr
     \code{NaCl} \tab equilibrium constant for aqueous NaCl dissociation (Shock et al., 1992) \cr
     \code{density} \tab density of H2O, inverted from IAPWS-95 equations (\code{\link{rho.IAPWS95}}) \cr
     \code{ORP} \tab oxidation-reduction potential of redox standards as a function of temperature \cr
@@ -57,6 +59,8 @@
 
   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{http://dx.doi.org/10.1186/1752-0509-3-75}
 
+  Dick, J. M. and Shock, E. L. (2011) Calculation of the relative chemical stabilities of proteins as a function of temperature and redox chemistry in a hot spring. \emph{PLoS ONE} \bold{6}, e22782. \url{http://dx.doi.org/10.1371/journal.pone.0022782}
+
   Dick, J. M. (2016) Proteomic indicators of oxidation and hydration state in colorectal cancer. \emph{PeerJ} \bold{4}:e2238. \url{http://dx.doi.org/10.7717/peerj.2238}
 
   Garrels, R. M. and Christ, C. L. (1965) \emph{Solutions, Minerals, and Equilibria}, Harper & Row, New York, 450 p. \url{http://www.worldcat.org/oclc/517586}

Modified: pkg/CHNOSZ/man/protein.info.Rd
===================================================================
--- pkg/CHNOSZ/man/protein.info.Rd	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/man/protein.info.Rd	2017-02-14 11:37:01 UTC (rev 150)
@@ -56,7 +56,9 @@
 }
 
 \seealso{
-  \code{\link{ionize.aa}} for an example that compares \code{MP90.cp} with heat capacities calculated in CHNOSZ at different temperatures and pHs. The functions for interacting with the database of amino acid compositions of proteins are documented at \code{\link{iprotein}}, and examples of relative stability calculations can be found on the \code{\link{protein}} help page.
+\code{\link{ionize.aa}} for an example that compares \code{MP90.cp} with heat capacities calculated in CHNOSZ at different temperatures and pHs.
+The functions for interacting with the database of amino acid compositions of proteins are documented at \code{\link{iprotein}}, and examples of relative stability calculations can be found on the \code{\link{protein}} help page.
+See also \code{demo{protein.equil}}.
 }
 
 \examples{\dontshow{data(thermo)}
@@ -93,34 +95,6 @@
 protein.formula(iprotein("P53_PIG"))
 protein.formula(ip2aa(iprotein("P53_PIG")))
 
-## steps in calculation of chemical activities of two proteins
-## in metastable equilibrium, after Dick and Shock, 2011
-protein <- iprotein(c("CSG_METVO", "CSG_METJA"))
-# clear out amino acid residues loaded by the example above
-# ( in affinity(iprotein=ip) )
-data(thermo)
-# use properties of the "old" [Met] sidechain group (Dick et al., 2006)
-mod.obigt("[Met]", G=-35245, H=-59310)
-# set up the basis species to those used in DS11
-basis("CHNOS+")
-# note this yields logaH2 = -4.657486
-swap.basis("O2", "H2")
-# demonstrate the steps of the equilibrium calculation
-protein.equil(protein, loga.protein=-3)
-## we can also look at the affinities
-# (Reaction 7, Dick and Shock, 2011)
-# A/2.303RT for protein at unit activity (A-star for the protein)
-a <- affinity(iprotein=protein[1], loga.protein=0)
-Astar.protein <- a$values[[1]]
-# divide affinity by protein length (A-star for the residue)
-pl <- protein.length(protein[1])
-Astar.residue <- a$values[[1]]/pl  # 0.1893, Eq. 11
-# A/2.303RT per residue corresponding to protein activity of 10^-3
-loga.residue <- log10(pl*10^-3)
-Aref.residue <- Astar.residue - loga.residue  # 0.446, after Eq. 16
-# A-star of the residue in natural log units (A/RT)
-log(10) * Astar.residue  # 0.4359, after Eq. 23
-
 ## using protein.formula: average oxidation state of 
 ## carbon of proteins from different organisms (Dick, 2014)
 # get amino acid compositions of microbial proteins 
@@ -155,8 +129,6 @@
 \references{
   Dick, J. M. (2014) Average oxidation state of carbon in proteins. \emph{J. R. Soc. Interface} \bold{11}, 20131095. \url{http://dx.doi.org/10.1098/rsif.2013.1095}
 
-  Dick, J. M. and Shock, E. L. (2011) Calculation of the relative chemical stabilities of proteins as a function of temperature and redox chemistry in a hot spring. \emph{PLoS ONE} \bold{6}, e22782. \url{http://dx.doi.org/10.1371/journal.pone.0022782}
-
   Makhatadze, G. I. and Privalov, P. L. (1990) Heat capacity of proteins. 1. Partial molar heat capacity of individual amino acid residues in aqueous solution: Hydration effect \emph{J. Mol. Biol.} \bold{213}, 375--384. \url{http://dx.doi.org/10.1016/S0022-2836(05)80197-4}
 }
 

Modified: pkg/CHNOSZ/man/read.expr.Rd
===================================================================
--- pkg/CHNOSZ/man/read.expr.Rd	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/man/read.expr.Rd	2017-02-14 11:37:01 UTC (rev 150)
@@ -86,27 +86,6 @@
 # look for proteins described as "Complement"
 read.expr(file, "name", "log10(pg/ml)", list(description="Complement"))
 
-## Localizations and abundances of proteins from YeastGFP are used here
-## to calculate an abundance-weighted average of amino acid compositions of proteins
-## in different subcellular compartments of yeast.
-## This figure is similar to Fig. 3 of Dick (2009). 
-locations <- yeastgfp()
-gfp <- yeastgfp(locations)
-aa <- more.aa(gfp$protein, "Sce")
-for(i in 1:length(locations)) {
-  avgaa <- aasum(aa[[i]], gfp$abundance[[i]], average=TRUE, protein=locations[i])
-  add.protein(avgaa)
-}
-basis("CHNOS+")
-species(locations, "Sce")
-a <- affinity(O2=c(-82, -65))
-e <- equilibrate(a, loga.balance=0, normalize=TRUE)
-mycolor <- topo.colors(length(locations))
-diagram(e, names=locations, ylim=c(-5, -3), col=mycolor, lwd=2)
-dp <- describe.property(c("T", "P"), c(25, 1))
-db <- describe.basis(ibasis=(1:6)[-5])
-legend("topright", legend=c(dp, db), bty="n")
-
 #############################
 ## examples using stress() ##
 #############################

Modified: pkg/CHNOSZ/man/revisit.Rd
===================================================================
--- pkg/CHNOSZ/man/revisit.Rd	2017-02-14 07:16:39 UTC (rev 149)
+++ pkg/CHNOSZ/man/revisit.Rd	2017-02-14 11:37:01 UTC (rev 150)
@@ -112,7 +112,7 @@
 title(main="amino acids with metastable log activities > -5")
 
 # can also make a 2-D plot
-a <- affinity(O2=c(-74, -60, 64), H2O=c(-3, 3, 64))
+a <- affinity(O2=c(-74, -60, 25), H2O=c(-3, 3, 25))
 e <- equilibrate(a)
 r <- revisit(e, "count", -5, style.2D="image", plot.optval=FALSE)
 title(main="amino acids with metastable log activities > -5")

[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/chnosz -r 150


More information about the CHNOSZ-commits mailing list