[CHNOSZ-commits] r137 - in pkg/CHNOSZ: . R demo inst inst/extdata/cpetc man tests/testthat vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Feb 9 13:58:00 CET 2017
Author: jedick
Date: 2017-02-09 13:58:00 +0100 (Thu, 09 Feb 2017)
New Revision: 137
Added:
pkg/CHNOSZ/inst/extdata/cpetc/SS98_Fig5a.csv
pkg/CHNOSZ/inst/extdata/cpetc/SS98_Fig5b.csv
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/diagram.R
pkg/CHNOSZ/R/equilibrate.R
pkg/CHNOSZ/R/util.plot.R
pkg/CHNOSZ/demo/buffer.R
pkg/CHNOSZ/demo/copper.R
pkg/CHNOSZ/demo/yeastgfp.R
pkg/CHNOSZ/inst/NEWS
pkg/CHNOSZ/man/diagram.Rd
pkg/CHNOSZ/man/extdata.Rd
pkg/CHNOSZ/man/protein.Rd
pkg/CHNOSZ/man/read.expr.Rd
pkg/CHNOSZ/man/util.plot.Rd
pkg/CHNOSZ/tests/testthat/test-diagram.R
pkg/CHNOSZ/vignettes/anintro.Rmd
pkg/CHNOSZ/vignettes/eos-regress.Rmd
pkg/CHNOSZ/vignettes/vig.bib
Log:
ainintro.Rmd: add groups of species
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/DESCRIPTION 2017-02-09 12:58:00 UTC (rev 137)
@@ -1,6 +1,6 @@
-Date: 2017-02-06
+Date: 2017-02-09
Package: CHNOSZ
-Version: 1.0.8-26
+Version: 1.0.8-27
Title: Chemical Thermodynamics and Activity Diagrams
Author: Jeffrey Dick
Maintainer: Jeffrey Dick <j3ffdick at gmail.com>
Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/R/diagram.R 2017-02-09 12:58:00 UTC (rev 137)
@@ -89,13 +89,15 @@
else message("diagram: using 'as.residue' in calculation of predominant species")
}
- ## sum activities of species together in groups 20090524
+ ## sum affinities or activities of species together in groups 20090524
# using lapply/Reduce 20120927
if(!missing(groups)) {
# loop over the groups
plotvals <- lapply(groups, function(ispecies) {
# remove the logarithms
- act <- lapply(plotvals[ispecies], function(x) 10^x)
+ if(eout.is.aout) act <- lapply(plotvals[ispecies], function(x) 10^x)
+ # and, for activity, multiply by n.balance 20170207
+ else act <- lapply(seq_along(ispecies), function(i) eout$n.balance[ispecies[i]] * 10^plotvals[[ispecies[i]]])
# sum the activities
return(Reduce("+", act))
})
@@ -123,11 +125,11 @@
plotvar <- what
}
- ## alpha: plot fractional degree of formation instead of logarithms of activities
+ ## alpha: plot fractional degree of formation
## scale the activities to sum=1 ... 20091017
if(alpha) {
# remove the logarithms
- act <- lapply(eout$loga.equil, function(x) 10^x)
+ act <- lapply(plotvals, function(x) 10^x)
# sum the activities
sumact <- Reduce("+", act)
# divide activities by the total
@@ -252,7 +254,8 @@
adj <- 0.5
if(xvalues[imax] > xlim[1] + 0.8*diff(xlim)) adj <- 1
if(xvalues[imax] < xlim[1] + 0.2*diff(xlim)) adj <- 0
- text(xvalues[imax], plotvals[[i]][imax], labels=names[i], adj=adj)
+ # also include y-adjustment (labels bottom-aligned with the line)
+ text(xvalues[imax], plotvals[[i]][imax], labels=names[i], adj=c(adj, 0))
}
} else legend(x=legend.x, lty=lty, legend=names, col=col, cex=cex.names, lwd=lwd, ...)
}
@@ -462,6 +465,8 @@
pn <- plot.names(zs, xs, ys, names)
if(!is.null(dotted)) plot.line(zs, xlim, ylim, dotted, col, lwd, xrange=xrange)
else contour.lines(predominant, xlim, ylim, lty=lty, col=col, lwd=lwd)
+ # re-draw the tick marks and axis lines in case the fill obscured them
+ if(tplot & !identical(fill, "transparent")) thermo.axis()
} # done with the 2D plot!
out2D <- list(lx=pn$lx, ly=pn$ly, is=pn$is)
} # end if(nd==2)
Modified: pkg/CHNOSZ/R/equilibrate.R
===================================================================
--- pkg/CHNOSZ/R/equilibrate.R 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/R/equilibrate.R 2017-02-09 12:58:00 UTC (rev 137)
@@ -269,7 +269,7 @@
# is the balance the name of a basis species?
if(length(ibalance)==0) {
ibalance <- match(balance, rownames(aout$basis))
- if(is.na(ibalance)) stop("basis species (", balance, ") not available to balance transformations")
+ if(is.na(ibalance)) stop("basis species (", balance, ") not available to balance reactions")
}
# the name of the basis species (need this if we got ibalance which which.balance, above)
balance <- colnames(aout$species)[ibalance[1]]
Modified: pkg/CHNOSZ/R/util.plot.R
===================================================================
--- pkg/CHNOSZ/R/util.plot.R 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/R/util.plot.R 2017-02-09 12:58:00 UTC (rev 137)
@@ -2,7 +2,7 @@
# Functions to create and modify plots
thermo.plot.new <- function(xlim,ylim,xlab,ylab,cex=par('cex'),mar=NULL,lwd=par('lwd'),side=c(1,2,3,4),
- mgp=c(1.5,0.3,0),cex.axis=par('cex'),col=par('col'),yline=NULL,axs='i',do.box=TRUE,ticks=NULL,
+ mgp=c(1.5,0.3,0),cex.axis=par('cex'),col=par('col'),yline=NULL,axs='i',do.box=TRUE,
las=1,xline=NULL, ...) {
# start a new plot with some customized settings
thermo <- get("thermo")
@@ -11,9 +11,6 @@
thermo$opar <- par(no.readonly=TRUE)
assign("thermo", thermo, "CHNOSZ")
}
- # 20091108 changed argument name from 'ticks' to 'side' but
- # keep 'ticks' for backward compatibility
- if(!is.null(ticks)) side <- ticks
# 20090324 mar handling: NULL - a default setting; NA - par's setting
# 20090413 changed mar of top side from 2 to 2.5
if(is.null(mar)) mar <- c(3,3.5,2.5,1) else if(is.na(mar[1])) mar <- par('mar')
@@ -33,7 +30,7 @@
if(4 %in% side) thermo.axis(NULL,side=4,lwd=lwd)
}
-thermo.axis <- function(lab='x-axis',side=1,line=1.5,cex=par('cex'),lwd=par('lwd'),T=NULL,col=par('col')) {
+thermo.axis <- function(lab=NULL,side=1:4,line=1.5,cex=par('cex'),lwd=par('lwd'),T=NULL,col=par('col')) {
# if T isn't NULL, looks like we want make a second
# oxidation scale corresponding to one already plotted.
# e.g., Eh-pe, Eh-logfO2, or logfO2-Eh
@@ -52,53 +49,56 @@
}
if(!is.null(lwd)) {
## plot major tick marks and numeric labels
- do.label <- TRUE
- if(missing(cex) & side %in% c(3,4) & is.null(T)) do.label <- FALSE
- at <- axis(side,labels=do.label,tick=TRUE,lwd=lwd,col=col,col.axis=col)
- ## plot minor tick marks
- # the distance between major tick marks
- da <- abs(diff(at[1:2]))
- # distance between minor tick marks
- di <- da / 4
- if(da %% 2 | !(da %% 10)) di <- da / 5
- # number of minor tick marks
- if(side %in% c(1,3)) {
- ii <- c(1,2)
- myasp <- par('xaxp')
- } else {
- ii <- c(3,4)
- myasp <- par('yaxp')
+ for(thisside in side) {
+ do.label <- TRUE
+ if(missing(side) | (missing(cex) & thisside %in% c(3,4) & is.null(T))) do.label <- FALSE
+ at <- axis(thisside,labels=do.label,tick=TRUE,lwd=lwd,col=col,col.axis=col)
+ ## plot minor tick marks
+ # the distance between major tick marks
+ da <- abs(diff(at[1:2]))
+ # distance between minor tick marks
+ di <- da / 4
+ if(da %% 2 | !(da %% 10)) di <- da / 5
+ # number of minor tick marks
+ if(thisside %in% c(1,3)) {
+ ii <- c(1,2)
+ myasp <- par('xaxp')
+ } else {
+ ii <- c(3,4)
+ myasp <- par('yaxp')
+ }
+ myusr <- par('usr')[ii]
+ daxis <- abs(diff(myusr))
+ nt <- daxis / di + 1
+ ## if nt isn't an integer, it probably
+ ## means the axis limits don't correspond
+ ## to major tick marks (expect problems)
+ ##at <- seq(myusr[1],myusr[2],length.out=nt)
+ # start from (bottom/left) of axis?
+ bl <- 1
+ #if(myasp[2]==myusr[2]) bl <- 2
+ # is forward direction (top/right)?
+ tr <- 1
+ if(xor(myusr[2] < myusr[1] , bl==2)) tr <- -1
+ #at <- myusr[bl] + tr * di * seq(0:(nt-1))
+ # well all of that doesn't work in a lot of cases,
+ # where none of the axis limits correspond to
+ # major tick marks. perhaps the following will work
+ at <- myusr[1] + tr * di * (0:(nt-1))
+ # apply an offset
+ axt <- axTicks(thisside)[1]
+ daxt <- (axt - myusr[1])/di
+ daxt <- (daxt-round(daxt))*di
+ at <- at + daxt
+ tcl <- par('tcl') * 0.5
+ axis(thisside,labels=FALSE,tick=TRUE,lwd=lwd,col=col,col.axis=col,at=at,tcl=tcl)
}
- myusr <- par('usr')[ii]
- daxis <- abs(diff(myusr))
- nt <- daxis / di + 1
- ## if nt isn't an integer, it probably
- ## means the axis limits don't correspond
- ## to major tick marks (expect problems)
- ##at <- seq(myusr[1],myusr[2],length.out=nt)
- # start from (bottom/left) of axis?
- bl <- 1
- #if(myasp[2]==myusr[2]) bl <- 2
- # is forward direction (top/right)?
- tr <- 1
- if(xor(myusr[2] < myusr[1] , bl==2)) tr <- -1
- #at <- myusr[bl] + tr * di * seq(0:(nt-1))
- # well all of that doesn't work in a lot of cases,
- # where none of the axis limits correspond to
- # major tick marks. perhaps the following will work
- at <- myusr[1] + tr * di * (0:(nt-1))
- # apply an offset
- axt <- axTicks(side)[1]
- daxt <- (axt - myusr[1])/di
- daxt <- (daxt-round(daxt))*di
- at <- at + daxt
- tcl <- par('tcl') * 0.5
- axis(side,labels=FALSE,tick=TRUE,lwd=lwd,col=col,col.axis=col,at=at,tcl=tcl)
}
-
# rotate labels on side axes
- if(side %in% c(2,4)) las <- 0 else las <- 1
- if(!is.null(lab)) mtext(lab,side=side,line=line,cex=cex,las=las)
+ for(thisside in side) {
+ if(thisside %in% c(2,4)) las <- 0 else las <- 1
+ if(!is.null(lab)) mtext(lab,side=thisside,line=line,cex=cex,las=las)
+ }
# reset limits if we were plotting a second axis
if(!is.null(T)) par(opar)
}
Modified: pkg/CHNOSZ/demo/buffer.R
===================================================================
--- pkg/CHNOSZ/demo/buffer.R 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/demo/buffer.R 2017-02-09 12:58:00 UTC (rev 137)
@@ -29,4 +29,5 @@
}
# add legend
legend("topright", legend = c(describe.property("P", 300), describe.basis(ibasis=c(2,4)),
- "minerals", "formaldehyde", "HCN"), lty=c(NA, NA, NA, 1, 3, 2), col=c(NA, NA, NA, 3, 1, 1), bg="white")
+ "minerals", "formaldehyde", "HCN"), lty=c(NA, NA, NA, 1, 3, 2), col=c(NA, NA, NA, 3, 1, 1),
+ bg="white", cex=0.9)
Modified: pkg/CHNOSZ/demo/copper.R
===================================================================
--- pkg/CHNOSZ/demo/copper.R 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/demo/copper.R 2017-02-09 12:58:00 UTC (rev 137)
@@ -38,7 +38,7 @@
# mosaic diagram with to speciate glycine as a function of pH
m <- mosaic(bases=Gly, pH=c(0, 16, 300), Eh=c(-0.6, 1.0, 300))
fill <- c(rep("lightgrey", 3), rep("white", 4), rep("lightblue", 4))
-d <- diagram(m$A.species, fill=fill, names=NULL, tplot=FALSE, xaxs="i", yaxs="i")
+d <- diagram(m$A.species, fill=fill, names=NULL, xaxs="i", yaxs="i")
# to make the labels look nicer
names <- names[sort(unique(as.numeric(d$predominant)))]
for(i in 1:length(names)) {
@@ -57,10 +57,8 @@
d <- diagram(m$A.bases, add=TRUE, col="darkblue", lty=3, names=NULL)
text(d$lx, -0.5, Gly, col="darkblue")
-# add water lines and title and re-draw a box around the plot
-# because the filling of fields masks it
+# add water lines and title
water.lines()
-box()
mtitle(expression("Copper-water-glycine at 25"~degree*"C and 1 bar",
"After Aksu and Doyle, 2001 (Fig. 2b)"), line=0.5)
Modified: pkg/CHNOSZ/demo/yeastgfp.R
===================================================================
--- pkg/CHNOSZ/demo/yeastgfp.R 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/demo/yeastgfp.R 2017-02-09 12:58:00 UTC (rev 137)
@@ -1,8 +1,8 @@
## Oxygen fugacity - activity of H2O predominance
## diagrams for proteologs for 23 YeastGFP localizations
-# use old properties of [Met] to reproduce this example
+# use old properties of [Met] (Dick et al., 2006) to reproduce this example
data(thermo)
-add.obigt()
+mod.obigt("[Met]", G=-35245, H=-59310)
# arranged by decreasing metastability:
# order of this list of locations is based on the
# (dis)appearance of species on the current set of diagrams
Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/inst/NEWS 2017-02-09 12:58:00 UTC (rev 137)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.8-26 (2017-02-06)
+CHANGES IN CHNOSZ 1.0.8-27 (2017-02-09)
---------------------------------------
- Add "AA" as a keyword for preset species in basis() (cysteine,
@@ -52,6 +52,12 @@
- Add ZC.col() for generating a red-grey-blue color scale from
numeric values.
+- For the `groups` argument in diagram(), activities are now multiplied
+ by the balance coefficients before the summation.
+
+- With new default arguments, thermo.axis() only plots the axis tick
+ marks and lines (useful for redrawing the axis on filled diagrams).
+
CHANGES IN CHNOSZ 1.0.8 (2016-05-28)
------------------------------------
Added: pkg/CHNOSZ/inst/extdata/cpetc/SS98_Fig5a.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/cpetc/SS98_Fig5a.csv (rev 0)
+++ pkg/CHNOSZ/inst/extdata/cpetc/SS98_Fig5a.csv 2017-02-09 12:58:00 UTC (rev 137)
@@ -0,0 +1,81 @@
+T,logfO2
+7.37714269416,-79.8759305211
+10.0691176331,-79.1315136476
+13.4332544232,-78.2630272953
+17.4695530647,-77.270471464
+20.8353536218,-76.2779156328
+24.8699884962,-75.4094292804
+28.2324615194,-74.6650124069
+32.9375944782,-73.7965260546
+36.9705655857,-73.0521091811
+41.0035366932,-72.3076923077
+43.6921840982,-71.8114143921
+47.7234914387,-71.1910669975
+51.7547987793,-70.570719603
+55.7827785859,-70.1985111663
+59.1402603082,-69.8263027295
+62.4977420306,-69.4540942928
+67.1995474554,-68.8337468983
+71.8980253463,-68.4615384615
+76.5998307711,-67.841191067
+80.6311381117,-67.2208436725
+86.0067691547,-66.3523573201
+91.3807364308,-65.6079404467
+94.741545687,-64.9875930521
+98.1006911763,-64.4913151365
+101.461500433,-63.8709677419
+104.822309689,-63.2506203474
+108.855280796,-62.5062034739
+112.216090053,-61.8858560794
+116.24906116,-61.141439206
+119.608206649,-60.6451612903
+122.969015906,-60.0248138958
+125.657663311,-59.5285359801
+129.018472567,-58.9081885856
+132.377618056,-58.41191067
+135.066265461,-57.9156327543
+139.097572802,-57.2952853598
+143.80270576,-56.4267990074
+148.506174952,-55.682382134
+151.866984208,-55.0620347395
+156.5704534,-54.317617866
+160.600096974,-53.8213399504
+164.631404314,-53.2009925558
+168.664375422,-52.4565756824
+172.694018995,-51.9602977667
+178.740148123,-51.0918114144
+182.771455463,-50.4714640199
+188.145422739,-49.7270471464
+192.175066313,-49.2307692308
+196.878535505,-48.4863523573
+202.923000865,-47.7419354839
+207.623142523,-47.2456575682
+212.324947948,-46.6253101737
+217.026753373,-46.0049627792
+221.726895031,-45.5086848635
+225.756538604,-45.0124069479
+231.128842113,-44.3920595533
+236.501145622,-43.7717121588
+241.873449132,-43.1513647643
+245.903092705,-42.6550868486
+250.601570596,-42.2828784119
+255.303376021,-41.6625310174
+260.674015763,-41.1662531017
+264.70199557,-40.794044665
+270.072635312,-40.2977667494
+273.430117034,-39.9255583127
+278.128594925,-39.5533498759
+282.828736583,-39.0570719603
+288.199376325,-38.5607940447
+293.570016067,-38.064516129
+298.270157725,-37.5682382134
+305.653955487,-36.9478908189
+311.696757081,-36.3275434243
+317.737894907,-35.8312655087
+323.108534649,-35.3349875931
+329.149672476,-34.8387096774
+335.862972153,-34.2183622829
+340.561450044,-33.8461538462
+345.259927935,-33.4739454094
+348.617409657,-33.1017369727
+350.630567677,-32.9776674938
Added: pkg/CHNOSZ/inst/extdata/cpetc/SS98_Fig5b.csv
===================================================================
--- pkg/CHNOSZ/inst/extdata/cpetc/SS98_Fig5b.csv (rev 0)
+++ pkg/CHNOSZ/inst/extdata/cpetc/SS98_Fig5b.csv 2017-02-09 12:58:00 UTC (rev 137)
@@ -0,0 +1,84 @@
+T,pH
+5.38461538462,7.00497512438
+8.07692307692,6.99502487562
+10.7692307692,6.97512437811
+14.1346153846,6.9552238806
+18.8461538462,6.93532338308
+22.8846153846,6.91542288557
+27.5961538462,6.8855721393
+32.3076923077,6.84577114428
+37.0192307692,6.81592039801
+42.4038461538,6.77611940299
+45.7692307692,6.75621890547
+49.1346153846,6.74626865672
+53.8461538462,6.74626865672
+57.8846153846,6.74626865672
+62.5961538462,6.75621890547
+66.6346153846,6.74626865672
+70,6.7263681592
+72.6923076923,6.69651741294
+76.0576923077,6.66666666667
+78.75,6.62686567164
+81.4423076923,6.57711442786
+84.1346153846,6.53731343284
+87.5,6.4776119403
+90.1923076923,6.42786069652
+92.8846153846,6.37810945274
+95.5769230769,6.32835820896
+98.9423076923,6.26865671642
+102.307692308,6.20895522388
+105.673076923,6.14925373134
+109.711538462,6.08955223881
+113.75,6.02985074627
+117.788461538,5.96019900498
+120.480769231,5.93034825871
+123.846153846,5.87064676617
+127.884615385,5.82089552239
+133.269230769,5.74129353234
+137.307692308,5.69154228856
+142.692307692,5.62189054726
+147.403846154,5.56218905473
+152.115384615,5.50248756219
+156.826923077,5.44278606965
+161.538461538,5.38308457711
+167.596153846,5.30348258706
+172.980769231,5.24378109453
+178.365384615,5.16417910448
+183.75,5.10447761194
+189.807692308,5.01492537313
+193.846153846,4.9552238806
+197.884615385,4.89552238806
+201.923076923,4.84577114428
+204.615384615,4.81592039801
+207.307692308,4.77611940299
+212.019230769,4.71641791045
+216.057692308,4.66666666667
+219.423076923,4.62686567164
+222.788461538,4.59701492537
+226.153846154,4.5671641791
+229.519230769,4.53731343284
+232.884615385,4.50746268657
+236.923076923,4.4776119403
+241.634615385,4.44776119403
+247.019230769,4.41791044776
+253.75,4.38805970149
+260.480769231,4.35820895522
+266.538461538,4.34825870647
+271.25,4.32835820896
+277.307692308,4.3184079602
+282.692307692,4.3184079602
+286.057692308,4.30845771144
+290.769230769,4.30845771144
+294.807692308,4.30845771144
+299.519230769,4.30845771144
+304.230769231,4.30845771144
+308.269230769,4.30845771144
+312.980769231,4.3184079602
+319.038461538,4.3184079602
+323.75,4.32835820896
+330.480769231,4.33830845771
+335.192307692,4.34825870647
+339.903846154,4.35820895522
+343.269230769,4.36815920398
+346.634615385,4.36815920398
+350,4.36815920398
Modified: pkg/CHNOSZ/man/diagram.Rd
===================================================================
--- pkg/CHNOSZ/man/diagram.Rd 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/man/diagram.Rd 2017-02-09 12:58:00 UTC (rev 137)
@@ -74,8 +74,8 @@
The allowed variables are any that \code{\link{affinity}} accepts: temperature, pressure, or the chemical activities of the basis species
If \code{alpha} is TRUE, the fractional degrees of formation (ratios of activities to total activity) are plotted.
-This setting is useful for visualizing the molalities (activities for ideal interactions) of monomer groups in a system of biopolymers (e.g. proteins).
-If \code{groups} is supplied, the activities of the species identified in each numeric vector of this list are summed together and subsequently treated as a single species; the names of the new species are taken from the names of this list.
+If \code{groups} is supplied, the activities of the species identified in each numeric element of this list are multiplied by the balance coefficients of the species, then summed together.
+The names of the list are used to label the lines or fields for the summed activities of the resulting groups.
For 1-D diagrams, the default setting for the y-axis is a logarithmic scale (unless \code{alpha} is TRUE) with limits corresponding to the range of logarithms of activities (or 0,1 if \code{alpha} is TRUE); these actions can be overridden by \code{ylog} and \code{ylim}.
A \code{\link{legend}} is placed at the location identified by \code{legend.x}, or omitted if \code{legend.x} is \code{FALSE}.
Modified: pkg/CHNOSZ/man/extdata.Rd
===================================================================
--- pkg/CHNOSZ/man/extdata.Rd 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/man/extdata.Rd 2017-02-09 12:58:00 UTC (rev 137)
@@ -26,7 +26,7 @@
}
- Files in \code{cpetc} contain heat capacity data and other thermodynamic properties:
+ Files in \code{cpetc} contain heat capacity and other thermodynamic data and parameters:
\itemize{
\item \code{PM90.csv} Heat capacities of four unfolded aqueous proteins taken from Privalov and Makhatadze, 1990. Names of proteins are in the first column, temperature in \eqn{^{\circ}}{°}C in the second, and heat capacities in J mol\eqn{^{-1}}{^-1} K\eqn{^{-1}}{^-1} in the third. See \code{\link{ionize.aa}} for an example that uses this file.
\item \code{RH95.csv} Heat capacity data for iron taken from Robie and Hemingway, 1995. Temperature in Kelvin is in the first column, heat capacity in J K\eqn{^{-1}}{^-1} mol\eqn{^{-1}}{^-1} in the second. See \code{\link{subcrt}} for an example that uses this file.
@@ -35,6 +35,7 @@
\item \code{Cp.CH4.HW97.csv}, \code{V.CH4.HWM96.csv} Apparent molar heat capacities and volumes of CH4 in dilute aqueous solutions reported by Hnedkovsky and Wood, 1997 and Hnedkovsky et al., 1996. See \code{\link{EOSregress}} for examples that use these files.
\item \code{BKM60_Fig7.dat} Eh-pH values for normal, wet and waterlogged soils from Fig. 7 of Baas Becking et al., 1960. See the \sQuote{anintro} vignette for an example that uses this file.
\item \code{SC10_Rainbow.csv} Values of temperature (\eqn{^{\circ}}{°}C), pH and logarithms of activity of \eqn{\mathrm{CO_2}}{CO2}, \eqn{\mathrm{H_2}}{H2}, \eqn{\mathrm{NH_4^+}}{NH4+}, \eqn{\mathrm{H_2S}}{H2S} and \eqn{\mathrm{CH_4}}{CH4} for mixing of seawater and hydrothermal fluid at Rainbow field (Mid-Atlantic Ridge), taken from Shock and Canovas, 2010.
+ \item \code{SS98_Fig5a.csv}, \code{SS98_Fig5b.csv} Values of logarithm of fugacity of \eqn{\mathrm{O_2}}{O2} and pH as a function of temperature for mixing of seawater and hydrothermal fluid, digitized from Figs. 5a and b of Shock and Schulte, 1998.
}
Files in \code{fasta} contain protein sequences:
@@ -148,9 +149,11 @@
SGD project. \emph{Saccharomyces} Genome Database, \url{http://www.yeastgenome.org}
+ 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}
+
Shock, E. L., Oelkers, E. H., Johnson, J. W., Sverjensky, D. A. and Helgeson, H. C. (1992) Calculation of the thermodynamic properties of aqueous species at high pressures and temperatures: Effective electrostatic radii, dissociation constants and standard partial molal properties to 1000 \eqn{^{\circ}}{°}C and 5 kbar. \emph{J. Chem. Soc. Faraday Trans.} \bold{88}, 803--826. \url{http://dx.doi.org/10.1039/FT9928800803}
- 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}
+ Shock, E. L. and Schulte, M. D. (1998) Organic synthesis during fluid mixing in hydrothermal systems. \emph{J. Geophys. Res.} \bold{103}, 28513--28527. \url{http://dx.doi.org/10.1029/98JE02142}
YeastGFP project. Yeast GFP Fusion Localization Database, http://yeastgfp.ucsf.edu; Current location: \url{http://yeastgfp.yeastgenome.org}
Modified: pkg/CHNOSZ/man/protein.Rd
===================================================================
--- pkg/CHNOSZ/man/protein.Rd 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/man/protein.Rd 2017-02-09 12:58:00 UTC (rev 137)
@@ -55,7 +55,7 @@
## surface-layer proteins from Methanococcus and others
## as a function of oxygen fugacity, after Dick, 2008, Fig. 5b
-# use old properties of [Met] to reproduce this example
+# use old properties of [Met] (Dick et al., 2006) to reproduce this example
data(thermo)
mod.obigt("[Met]", G=-35245, H=-59310)
# make our protein list
Modified: pkg/CHNOSZ/man/read.expr.Rd
===================================================================
--- pkg/CHNOSZ/man/read.expr.Rd 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/man/read.expr.Rd 2017-02-09 12:58:00 UTC (rev 137)
@@ -88,7 +88,7 @@
## speciation diagram for ER.to.Golgi proteins (COPII coat
## proteins) as a function of logfO2, after Dick, 2009
-# use old parameters for [Met] sidechain group
+# use old parameters for [Met] (Dick et al., 2006)
mod.obigt("[Met]", G=-35245, H=-59310)
y <- yeastgfp("ER.to.Golgi")
# don't use those with NA abundance
Modified: pkg/CHNOSZ/man/util.plot.Rd
===================================================================
--- pkg/CHNOSZ/man/util.plot.Rd 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/man/util.plot.Rd 2017-02-09 12:58:00 UTC (rev 137)
@@ -20,9 +20,9 @@
thermo.plot.new(xlim, ylim, xlab, ylab, cex = par("cex"),
mar = NULL, lwd = par("lwd"), side = c(1,2,3,4),
mgp = c(1.5, 0.3, 0), cex.axis = par("cex"), col = par("col"),
- yline = NULL, axs = "i", do.box = TRUE, ticks = NULL, las = 1,
+ yline = NULL, axs = "i", do.box = TRUE, las = 1,
xline = NULL, ...)
- thermo.axis(lab = "x-axis", side = 1, line = 1.5, cex = par("cex"),
+ thermo.axis(lab = NULL, side = 1:4, line = 1.5, cex = par("cex"),
lwd = par("lwd"), T = NULL, col = par("col"))
label.plot(x, xfrac = 0.05, yfrac = 0.95, paren = FALSE,
italic = FALSE, ...)
@@ -52,7 +52,6 @@
\item{yline}{numeric, margin line on which to plot \eqn{y}{y}-axis name}
\item{axs}{character, setting for axis limit calculation}
\item{do.box}{logical, draw a box around the plot?}
- \item{ticks}{numeric, same effect as \code{side} (retained for backwards compatibility)}
\item{las}{numeric, style for axis labels}
\item{xline}{numeric, margin line on which to plot \eqn{x}{x}-axis name}
\item{...}{further arguments passed to \code{par} or \code{mtext}}
@@ -81,7 +80,7 @@
\details{
- \code{thermo.plot.new} sets parameters for a new plot, creates a new plot using \code{\link{plot.new}}, and adds axes and major and minor ticks to the plot. Plot parameters (see \code{\link{par}}) including \code{cex}, \code{mar}, \code{lwd}, \code{mgp} and \code{axs} can be given, as well as a numeric vector in \code{ticks} identifying which sides of the plot receive tick marks. \code{yline}, if present, denotes the margin line (default \code{\link{par}('mgp')[1]}) where the y-axis name is plotted. The very first time \code{thermo.plot.new} is called, it stores the existing value of \code{par(no.readonly=TRUE)} in \code{thermo$opar} so that the plot device can be reset to the previous state later on.
+ \code{thermo.plot.new} sets parameters for a new plot, creates a new plot using \code{\link{plot.new}}, and adds axes and major and minor tick marks to the plot. Plot parameters (see \code{\link{par}}) including \code{cex}, \code{mar}, \code{lwd}, \code{mgp} and \code{axs} can be given, as well as a numeric vector in \code{side} identifying which sides of the plot receive tick marks. \code{yline}, if present, denotes the margin line (default \code{\link{par}('mgp')[1]}) where the y-axis name is plotted. The very first time \code{thermo.plot.new} is called, it stores the existing value of \code{par(no.readonly=TRUE)} in \code{thermo$opar} so that the plot device can be reset to the previous state later on.
\code{water.lines} plots lines representing the oxidation and reduction stability limits of water on \code{yaxis}-\code{xaxis} diagrams, where \code{yaxis} can be \samp{Eh} or \samp{O2}, and \code{xaxis} can be \samp{pH} or \samp{T}.
\code{which} controls which lines are drawn (\samp{oxidation}, \samp{reduction}, or both (the default)).
@@ -97,7 +96,9 @@
\code{usrfig} returns the limits of the figure region in \dQuote{user} coordinates (i.e. the limits of the plot region, from \code{\link{par}("usr")}).
It is a supporting function for \code{label.figure} but is also useful for other circumstances where information must be added at a particular location in a figure.
- \code{thermo.axis} is used to add axes and axis labels to plots, with some default style settings (rotation of numeric labels) and conversions between oxidation-reduction scales (called by \code{thermo.plot.new}). It also adds minor tick marks.
+\code{thermo.axis} is used to add axes and axis labels to plots, with some default style settings (rotation of numeric labels) and conversions between oxidation-reduction scales (called by \code{thermo.plot.new}).
+It also adds minor tick marks.
+With the default arguments (no labels specified), it plots only the axis lines and tick marks; this is useful for overplotting the axis on diagrams filled with colors.
\code{mtitle} can be used to add a multi-line title to a plot.
It loops over each element of \code{main} and places it on a separate margin line using \code{\link{mtext}}.
Modified: pkg/CHNOSZ/tests/testthat/test-diagram.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-diagram.R 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/tests/testthat/test-diagram.R 2017-02-09 12:58:00 UTC (rev 137)
@@ -48,9 +48,10 @@
e <- equilibrate(a)
# group the species together
d <- diagram(e, groups=list(1:2, 3:4), plot.it=FALSE)
- # we should find that their activities have been summed
- expect_equal(d$plotvals[[1]], log10(10^e$loga.equil[[1]] + 10^e$loga.equil[[2]]))
- expect_equal(d$plotvals[[2]], log10(10^e$loga.equil[[3]] + 10^e$loga.equil[[4]]))
+ # we should find that their activities have been multiplied by the balance coefficients and summed
+ n.balance <- balance(a)
+ expect_equal(d$plotvals[[1]], log10(n.balance[1]*10^e$loga.equil[[1]] + n.balance[2]*10^e$loga.equil[[2]]))
+ expect_equal(d$plotvals[[2]], log10(n.balance[3]*10^e$loga.equil[[3]] + n.balance[4]*10^e$loga.equil[[4]]))
# ask for degrees of formation instead of logarithms of activities
d <- diagram(e, alpha=TRUE, plot.it=FALSE)
# we should find that the sum of alphas is one
Modified: pkg/CHNOSZ/vignettes/anintro.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/anintro.Rmd 2017-02-06 16:08:42 UTC (rev 136)
+++ pkg/CHNOSZ/vignettes/anintro.Rmd 2017-02-09 12:58:00 UTC (rev 137)
@@ -7,6 +7,7 @@
tufte_features: ["background"]
css: "vig.css"
toc: true
+ mathjax: null
tufte::tufte_handout:
citation_package: natbib
latex_engine: xelatex
@@ -40,6 +41,11 @@
knitr::knit_hooks$set(smallish.mar = function(before, options, envir) {
if (before) par(mar = c(4.2, 4.2, 0.9, 0.9)) # smallish margins on top and right
})
+# use pngquant to optimize PNG images
+knitr::knit_hooks$set(pngquant = knitr::hook_pngquant)
+pngquant <- "--speed=1 --quality=0-50"
+# some frequently used HTML expressions
+logfO2 <- "log<i>f</i><sub>O<sub>2</sub></sub>"
```
# First steps
@@ -194,7 +200,7 @@
as.chemical.formula(makeup(88))
```
-For organic species, a simple calculation of the average oxidation state of carbon ($Z_C$) is possible given the species index, chemical formula, or elemental count:
+For organic species, a simple calculation of the average oxidation state of carbon (*Z*<sub>C</sub>) is possible given the species index, chemical formula, or elemental count:
```{r ZC_88}
ZC(88)
ZC(info(88)$formula)
@@ -231,7 +237,7 @@
subcrt("water", T=c(400, 500, 600), P=c(200, 400, 600), grid="P")$out$water
```
-```{r subcrt_water_plot, fig.margin=TRUE, fig.width=4, fig.height=4, small.mar=TRUE, dpi=50, out.width="100%", echo=FALSE, message=FALSE, fig.cap="Isothermal contours of density (g cm<sup>-3</sup>) and pressure (bar) of H<sub>2</sub>O.", cache=TRUE}
+```{r subcrt_water_plot, fig.margin=TRUE, fig.width=4, fig.height=4, small.mar=TRUE, dpi=72, out.width="100%", echo=FALSE, message=FALSE, fig.cap="Isothermal contours of density (g cm<sup>-3</sup>) and pressure (bar) of H<sub>2</sub>O.", cache=TRUE, pngquant=pngquant}
H2O <- subcrt("water", T=seq(0, 1000, 100), P=c(NA, seq(1, 500, 1)), grid="T")
H2O <- H2O$out$water
plot(H2O$P, H2O$rho, type="l")
@@ -285,7 +291,7 @@
CH4 <- subcrt(c("CH4", "CH4"), c("gas", "aq"), c(-1, 1), T=T)$out$logK
logK <- data.frame(T, CO2, CO, CH4)
```
-```{r dissolution_plot, fig.margin=TRUE, fig.width=4, fig.height=4, small.mar=TRUE, dpi=50, out.width="100%", echo=FALSE, message=FALSE, fig.cap="Equilibrium constants calculated for dissolution of CO<sub>2</sub>, CO, and CH<sub>4</sub>.", cache=TRUE}
+```{r dissolution_plot, fig.margin=TRUE, fig.width=4, fig.height=4, small.mar=TRUE, dpi=72, out.width="100%", echo=FALSE, message=FALSE, fig.cap="Equilibrium constants calculated for dissolution of CO<sub>2</sub>, CO, and CH<sub>4</sub>.", cache=TRUE, pngquant=pngquant}
matplot(logK[, 1], logK[, -1], type="l", col=1, lty=1,
xlab=axis.label("T"), ylab=axis.label("logK"))
text(80, -1.7, expr.species("CO2"))
@@ -355,7 +361,7 @@
<p>
Use `describe.reaction()` to write the reactions on a plot:
-```{r describe_reaction_plot, fig.margin=TRUE, fig.width=3.5, fig.height=1.8, tiny.mar=TRUE, dpi=50, out.width="100%"}
+```{r describe_reaction_plot, fig.margin=TRUE, fig.width=3.5, fig.height=1.8, tiny.mar=TRUE, dpi=72, out.width="100%", pngquant=pngquant}
plot(0, 0, type="n", axes=FALSE, ann=FALSE, xlim=c(0, 5), ylim=c(5.2, -0.2))
text(0, 0, "acetoclastic methanogenesis", adj=0)
text(5, 1, describe.reaction(acetoclastic$reaction), adj=1)
@@ -365,7 +371,7 @@
text(5, 5, describe.reaction(hydrogenotrophic$reaction), adj=1)
```
-## Non-standard state affinities and Gibbs energies
+## Affinity: not the standard state Gibbs energy
Usually, `subcrt()` returns only standard state thermodynamic properties.
```{marginfigure}
@@ -419,7 +425,7 @@
We insert an empty reaction to get a line at zero affinity.
`do.call(rbind, Adat)` turns the list into a data frame that can be plotted with `matplot()`.
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/chnosz -r 137
More information about the CHNOSZ-commits
mailing list