From noreply at r-forge.r-project.org Thu May 14 11:07:47 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 14 May 2015 11:07:47 +0200 (CEST) Subject: [CHNOSZ-commits] r81 - in pkg/CHNOSZ: . R inst inst/tests man vignettes Message-ID: <20150514090747.50402186F99@r-forge.r-project.org> Author: jedick Date: 2015-05-14 11:07:47 +0200 (Thu, 14 May 2015) New Revision: 81 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/diagram.R pkg/CHNOSZ/R/findit.R pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/inst/tests/test-diagram.R pkg/CHNOSZ/man/findit.Rd pkg/CHNOSZ/vignettes/anintro.Rnw pkg/CHNOSZ/vignettes/anintro.lyx pkg/CHNOSZ/vignettes/hotspring.Rnw pkg/CHNOSZ/vignettes/hotspring.lyx pkg/CHNOSZ/vignettes/vig.bib Log: fixes for hotspring.Rnw and anintro.Rnw Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/DESCRIPTION 2015-05-14 09:07:47 UTC (rev 81) @@ -1,6 +1,6 @@ -Date: 2015-03-10 +Date: 2015-05-14 Package: CHNOSZ -Version: 1.0.3-18 +Version: 1.0.3-19 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey Dick Maintainer: Jeffrey Dick Modified: pkg/CHNOSZ/R/diagram.R =================================================================== --- pkg/CHNOSZ/R/diagram.R 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/R/diagram.R 2015-05-14 09:07:47 UTC (rev 81) @@ -153,6 +153,9 @@ dim(predominant) <- dim(pv[[1]]) } + # a warning about that we can only show properties of the first species on a 2-D diagram + if(nd==2 & length(plotvals) > 1 & identical(predominant, NA)) warning("showing only first species in 2-D property diagram") + ## where we'll put extra output for predominance diagrams (lx, ly, is) out2D <- list() @@ -411,7 +414,6 @@ # colors and curves (predominance), or contours (properties) if(identical(predominant, NA)) { zs <- plotvals[[1]] - if(length(plotvals) > 1) warning("showing only first species in 2-D property diagram") contour(xs, ys, zs, add=TRUE, col=col, lty=lty, lwd=lwd, labcex=cex) pn <- list(lx=NULL, ly=NULL, is=NULL) } else { Modified: pkg/CHNOSZ/R/findit.R =================================================================== --- pkg/CHNOSZ/R/findit.R 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/R/findit.R 2015-05-14 09:07:47 UTC (rev 81) @@ -214,7 +214,7 @@ } # to plot results from findit() -plot.findit <- function(x,which=NULL,mar=c(3.5,5,2,2),xlab="iteration",...) { +plot_findit <- function(x,which=NULL,mar=c(3.5,5,2,2),xlab="iteration",...) { # show the values of the test statistic and of the # chemical variables at each iteration l <- length(x$value) Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/inst/NEWS 2015-05-14 09:07:47 UTC (rev 81) @@ -1,37 +1,49 @@ -CHANGES IN CHNOSZ 1.0.3-18 (2015-03-10) +CHANGES IN CHNOSZ 1.0.3-19 (2015-05-14) --------------------------------------- -- Add files with average amino acid compositions of proteins from Bison - Pool grouped according to annotation keyword (DS11.csv) (moved here - from main protein.csv) or phylum assignment (DS13.csv). +NEW FEATURES: -- Convert hotspring.Rnw to use knitr, and add example calculations of - relative abundances of microbial phyla from Dick and Shock, 2013. +- Add mosaic() function for affinity calculations with changing basis + species. See also new 'mosaic.R' demo. -- In energy(), add missing 'IS' argument in call to subcrt(). Thanks to - Grayson Boyer for the bug report. +- Add thermo$opt$varP option as a flag for subcrt() to calculate Gibbs + energies of gases using a variable-pressure standard state. -- In nonideal(), skip proton and electron. Add test for calculations - at constant and variable IS to test-util.affinity.R. +- Add 'solubility.R' demo, and calcite solubility plot to anintro.Rnw. -- diagram() returns 'lx', 'ly' and 'is' for calculated positions of - labels and indices of those species in predominance diagrams, - including when the labels aren't plotted (by setting names=FALSE). +DATA CONSISTENCY: - Move aqueous Ti(OH)4 and H4SiO4 to OBIGT-2.csv. -- Add warning about data and examples to CHNOSZ-package.Rd. +- Add warning about data consistency and use of examples to + CHNOSZ-package.Rd and anintro.Rnw. -- water.lines() gets 'O2state' argument for state of O2. +OTHER CHANGES: -- Add mosaic() function for affinity calculations with changing basis - species. - - When making filled color diagrams, diagram() calls image() with useRaster=TRUE. This speeds up plotting, eliminates artifacts at some resolutions (i.e. blank lines), and greatly reduces the size of PDF files. +- diagram() returns 'lx', 'ly' and 'is' for calculated positions of + labels and indices of those species in predominance diagrams, + including when the labels aren't plotted (by setting names=FALSE). + +- In energy(), add missing 'IS' argument in call to subcrt(). Thanks to + Grayson Boyer for the bug report. + +- In nonideal(), skip proton and electron. Add test for calculations + at constant and variable IS to test-util.affinity.R. + +- Modify hotspring.Rnw to use knitr, and add example calculations of + relative abundances of microbial phyla from Dick and Shock, 2013. + +- Add files with average amino acid compositions of proteins from Bison + Pool grouped according to annotation keyword (DS11.csv) (moved here + from protein.csv) or phylum assignment (DS13.csv). + +- water.lines() gets 'O2state' argument to specify state of O2. + - Add 'as.residue' argument to diagram(), to divide reactions by balance coefficients without rescaling to whole species formulas (cf. 'normalize' argument which uses rescaling). @@ -45,13 +57,9 @@ - In test-diagram.R, test that same diagrams are produced using 'as.residue' in equilibrate() or diagram(). -- Add 'tplot' argument to diagram(). +- Add 'tplot' argument to diagram() (set to FALSE to use R's default + plot set-up). -- Add thermo$opt$varP option as a flag for subcrt() to calculate Gibbs - energies of gases using a variable-pressure standard state. - -- Add 'solubility.R' demo and calcite solubility plot to anintro.Rnw. - CHANGES IN CHNOSZ 1.0.3 (2014-01-12) ------------------------------------ Modified: pkg/CHNOSZ/inst/tests/test-diagram.R =================================================================== --- pkg/CHNOSZ/inst/tests/test-diagram.R 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/inst/tests/test-diagram.R 2015-05-14 09:07:47 UTC (rev 81) @@ -82,5 +82,5 @@ a <- affinity(T=c(0, 200, 6), O2=c(-90, -60, 5)) # TODO: fix plot.line() function in diagram() so that the plot can be made #expect_equal(diagram(a), diagram(a, plot.it=FALSE)) - expect_warning(diagram(a, what="CO2"), "showing only first species in 2-D property diagram") + expect_warning(diagram(a, what="CO2", plot.it=FALSE), "showing only first species in 2-D property diagram") }) Modified: pkg/CHNOSZ/man/findit.Rd =================================================================== --- pkg/CHNOSZ/man/findit.Rd 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/man/findit.Rd 2015-05-14 09:07:47 UTC (rev 81) @@ -1,6 +1,6 @@ \name{findit} \alias{findit} -\alias{plot.findit} +\alias{plot_findit} \title{Gridded Search to Optimize Objective Functions} \description{ Use a gridded search to find a combination of one or more of chemical activities of basis species, temperature and/or pressure that maximize or minimize a objective function of the metastable equilibrium chemical activities of the species of interest. @@ -62,7 +62,7 @@ The function performs \code{niter} iterations. At first, the limits of the parameters given in \code{lims} define the extent of a \eqn{nd}-dimensional box around the space of interest. The value of \code{objective} is calculated at each of the \eqn{res^{nd}}{res^nd} grid points and and optimum value located (see \code{\link{revisit}} and \code{\link{optimal.index}}). In the next iteration the new search box is centered on the location of the optimum value, and the edges are shrunk so their length is \code{rat} * the length in the previous step. If the limits of any of the parameters extend beyond those in \code{lims}, they are pushed in to fit (preserving the difference between them). - \code{plot.findit} plots the values of the parameters and the objective function as a function of the number of iterations. + \code{plot_findit} plots the values of the parameters and the objective function as a function of the number of iterations. } Modified: pkg/CHNOSZ/vignettes/anintro.Rnw =================================================================== --- pkg/CHNOSZ/vignettes/anintro.Rnw 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/vignettes/anintro.Rnw 2015-05-14 09:07:47 UTC (rev 81) @@ -82,7 +82,7 @@ demonstrate basic usage to new users. -\section{Outline of workflow} +\subsection{Outline of workflow} CHNOSZ is made up of a set of functions and supporting datasets. The major components of the package are shown in the figure below, which @@ -120,7 +120,7 @@ or others with whom you might share your scripts. -\section{Installing and loading CHNOSZ} +\subsection{Installing and loading CHNOSZ} If you have just installed R, and you are online, installing the CHNOSZ package should be as simple as selecting ``Install packages from @@ -154,6 +154,30 @@ \section{Thermodynamic database} +\subsection{Warning about internal consistency of thermodynamic data} + +All thermodynamic data and examples are provided on an as-is basis. +It is up to you to check not only the accuracy of the data, but also +\emph{the suitability of the data AND computational techniques} for +your problem. By combining data taken from different sources, it is +possible to build an inconsistent and/or nonsensical calculation. +An attempt has been made to provide a primary database (OBIGT.csv) +that is internally consistent, but no guarantee can be made. Where +possible, data with known or suspected inconsistencies have been placed +into a secondary database (OBIGT-2.csv) that should be regarded as +experimental. If there is any doubt about the accuracy or suitability +of data for a particular problem, please \emph{consult the primary +sources} (which can be located using \texttt{browse.refs()}; see Section +\ref{sub:thermo_refs}). Do not assume that by adding any species +to your calculation (or to any of the examples), you will necessarily +obtain a reasonable answer. Do not assume that the examples are correct, +or that they can be applied to your problem. As with the data, please +\emph{compare the construction and output of the examples to the primary +sources}, cited in the reference list in each help page. Examples +without a reference (and some with references) demonstrate experimental +features of CHNOSZ. + + \subsection{\texttt{info()} part I} So you want to know what are the standard molal thermodynamic properties @@ -195,7 +219,7 @@ @ -\subsection{\texttt{thermo\$refs}} +\subsection{\texttt{\label{sub:thermo_refs}thermo\$refs}} The thermodynamic data and other parameters used by the functions, as well as system definitions provided by the user in an interactive @@ -552,7 +576,6 @@ \setkeys{Gin}{width=0.6\textwidth} -\selectlanguage{english}% <>= demo("solubility", ask=FALSE) @ @@ -619,7 +642,6 @@ \setkeys{Gin}{width=0.6\textwidth} -\selectlanguage{english}% <>= e <- equilibrate(a, normalize=TRUE) diagram(e, legend.x="bottomleft", ylim=c(-6, -2)) @@ -643,7 +665,6 @@ \setkeys{Gin}{width=0.6\textwidth} -\selectlanguage{english}% <>= species(c("SLAP_ACEKI", "SLAP_GEOSE", "SLAP_BACLI", "SLAP_AERSA")) basis(c("NH3", "H2S"), c(-1, -10)) @@ -685,7 +706,6 @@ \setkeys{Gin}{width=0.6\textwidth} -\selectlanguage{english}% <>= basis(c("HCl","H2O","Ca+2","CO2","Mg+2","SiO2","O2","H+"), c(999,0,999,999,999,999,999,-7)) @@ -796,13 +816,12 @@ soils \citep{BKM60} and hot springs in Yellowstone ($+$) \citep{SWM+05} and Iceland ($\blacktriangle$) \citep{SA02}. The symbols identifying the latter two sources were swapped in the figure caption of \citet{DLH06}. -Finally legends are draws to identify the lines and symbols. The \texttt{describe.property()} +Finally legends are drawn to identify the lines and symbols. The \texttt{describe.property()} function of CHNOSZ is used to generate the temperature notation (italic $T$, and degree sign in the units). \setkeys{Gin}{width=0.5\textwidth} -\selectlanguage{english}% <>= basis("CHNOSe") basis(c("NH3", "H2S"), c(-6, -3)) @@ -842,7 +861,6 @@ \setkeys{Gin}{width=0.7\textwidth} -\selectlanguage{english}% <>= locations <- yeastgfp() gfp <- yeastgfp(locations) @@ -966,7 +984,6 @@ \begin{small} \setkeys{Gin}{width=0.6\textwidth} -\selectlanguage{english}% <>= basis(c("CO2", "O2"), c(r$x, r$y)) a <- affinity() @@ -1003,7 +1020,6 @@ \begin{small} \setkeys{Gin}{width=0.4\textwidth} -\selectlanguage{english}% <>= basis("CHNOS") species(c("isoleucine", "tyrosine", "glutamic acid", "methionine", "aspartic acid")) @@ -1022,7 +1038,6 @@ \begin{small} \setkeys{Gin}{width=0.6\textwidth} -\selectlanguage{english}% <>= a <- affinity() par(mfrow=c(1, 2)) @@ -1057,6 +1072,8 @@ \item 2011-08-15 Add \texttt{browse.refs()}; modifying database hint changed to \texttt{help(thermo)} \item 2012-06-16 Add ``More activity diagrams'' +\item 2015-05-14 Add warning about internal consistency of thermodynamic +data \end{itemize} R session information: Modified: pkg/CHNOSZ/vignettes/anintro.lyx =================================================================== --- pkg/CHNOSZ/vignettes/anintro.lyx 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/vignettes/anintro.lyx 2015-05-14 09:07:47 UTC (rev 81) @@ -193,7 +193,7 @@ \end_layout -\begin_layout Section +\begin_layout Subsection Outline of workflow \end_layout @@ -328,7 +328,7 @@ \end_layout -\begin_layout Section +\begin_layout Subsection Installing and loading CHNOSZ \end_layout @@ -480,8 +480,66 @@ status open \begin_layout Subsection +Warning about internal consistency of thermodynamic data +\end_layout +\begin_layout Standard +All thermodynamic data and examples are provided on an as-is basis. + It is up to you to check not only the accuracy of the data, but also +\emph on +the suitability of the data AND computational techniques +\emph default + for your problem. + By combining data taken from different sources, it is possible to build + an inconsistent and/or nonsensical calculation. + An attempt has been made to provide a primary database (OBIGT.csv) that + is internally consistent, but no guarantee can be made. + Where possible, data with known or suspected inconsistencies have been + placed into a secondary database (OBIGT-2.csv) that should be regarded as + experimental. + If there is any doubt about the accuracy or suitability of data for a particula +r problem, please +\emph on +consult the primary sources +\emph default + (which can be located using \family typewriter +browse.refs() +\family default +; see Section +\begin_inset CommandInset ref +LatexCommand ref +reference "sub:thermo_refs" + +\end_inset + +). + Do not assume that by adding any species to your calculation (or to any + of the examples), you will necessarily obtain a reasonable answer. + Do not assume that the examples are correct, or that they can be applied + to your problem. + As with the data, please +\emph on +compare the construction and output of the examples to the primary sources +\emph default +, cited in the reference list in each help page. + Examples without a reference (and some with references) demonstrate experimenta +l features of CHNOSZ. + +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Branch stuff +status open + +\begin_layout Subsection + +\family typewriter info() \family default part I @@ -678,6 +736,12 @@ \begin_layout Subsection \family typewriter +\begin_inset CommandInset label +LatexCommand label +name "sub:thermo_refs" + +\end_inset + thermo$refs \end_layout @@ -2245,7 +2309,6 @@ status open \begin_layout Standard - \begin_inset ERT status collapsed @@ -2520,7 +2583,6 @@ status open \begin_layout Standard - \begin_inset ERT status collapsed @@ -2631,7 +2693,6 @@ status open \begin_layout Standard - \begin_inset ERT status open @@ -2816,7 +2877,6 @@ status open \begin_layout Standard - \begin_inset ERT status open @@ -3360,7 +3420,7 @@ \end_inset . - Finally legends are draws to identify the lines and symbols. + Finally legends are drawn to identify the lines and symbols. The \family typewriter describe.property() @@ -3378,7 +3438,6 @@ status open \begin_layout Standard - \begin_inset ERT status open @@ -3592,7 +3651,6 @@ status open \begin_layout Standard - \begin_inset ERT status open @@ -4227,7 +4285,6 @@ status open \begin_layout Standard - \begin_inset ERT status open @@ -4406,7 +4463,6 @@ status open \begin_layout Standard - \begin_inset ERT status open @@ -4516,7 +4572,6 @@ status open \begin_layout Standard - \begin_inset ERT status open @@ -4692,6 +4747,10 @@ \end_layout +\begin_layout Itemize +2015-05-14 Add warning about internal consistency of thermodynamic data +\end_layout + \begin_layout Standard R session information: \end_layout Modified: pkg/CHNOSZ/vignettes/hotspring.Rnw =================================================================== --- pkg/CHNOSZ/vignettes/hotspring.Rnw 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/vignettes/hotspring.Rnw 2015-05-14 09:07:47 UTC (rev 81) @@ -36,8 +36,10 @@ library(knitr) ## set global chunk options opts_chunk$set(fig.path='figure/hotspring-', cache.path='cache/hotspring-', fig.align='center', fig.show='hold', par=TRUE) -## set code/output width to be 60 -options(width=80) +## set code/output width +options(width=85) +## set number of digits +options(digits=5) ## tune details of base graphics (http://yihui.name/knitr/hooks) knit_hooks$set(par=function(before, options, envir){ if (before && options$fig.show!='none') par(mar=c(4,4,1,1),cex.lab=.95,cex.axis=.9,mgp=c(2,.7,0),tcl=-.3) @@ -47,6 +49,9 @@ \title{Hot-spring proteins in CHNOSZ} + +\author{Jeffrey M. Dick and Everett L. Shock} + \maketitle \section{Introduction} @@ -68,8 +73,8 @@ In order to keep the code here as short and efficient as possible, some aspects of the published figures including manual labeling and higher resolution are not all reproduced; these changes are noted -where possible. Also, some tricks (e.g. using \texttt{xtabs()} to -create the BLAST frequency table, and \texttt{revisit()} to calculate +where possible. Also, some shortcuts (e.g. using \texttt{xtabs()} +to create the BLAST frequency table, and \texttt{revisit()} to calculate the $\Delta G_{tr}$) have been introduced here in order to streamline the code. @@ -115,7 +120,7 @@ @ \href{http://dx.doi.org/10.1371/journal.pone.0022782.g005}{DOI link} -to original figure (panels A and B). The length of \texttt{xpoints} +to published figure (panels A and B). The length of \texttt{xpoints} here, 128, is the resolution used for the figures in the 2011 paper (defined in the \texttt{mkargs()} function of the Supporting Information). @@ -153,7 +158,7 @@ modifications): <>= -# the names of the phyla in alphabetical order (Deinococcus-Thermus at end) +# the names of the phyla in alphabetical order (except Deinococcus-Thermus at end) phyla.abc <- sort(unique(aa.phyla$organism))[c(1:7,9:11,8)] # an abbreviation for Dein.-Thermus phyla.abbrv <- phyla.abc @@ -299,7 +304,7 @@ @ \href{http://dx.doi.org/10.1371/journal.pone.0022782.t005}{DOI link} -to original table. +to published table. The affinities are expressed as dimensionless values, i.e. $\boldsymbol{A}/2.303RT$ where $\boldsymbol{A}$, $R$ and $T$ stand for chemical affinity, @@ -322,9 +327,9 @@ apply(a.res, 2, which.max) @ -This 1-2-4 progression of stabilities is visualized below, and for -some groups of proteins, an update to the thermodynamic properties -of the methionine sidechain causes site 3 also to become stable. +This 1-2-4 progression of stabilities is visualized below; for some +groups of proteins, an update to the thermodynamic properties of the +methionine sidechain causes site 3 also to become stable. \subsection{Relative stabilities along a chemical gradient} @@ -370,7 +375,7 @@ @ \href{http://dx.doi.org/10.1371/journal.pone.0022782.g005}{DOI link} -to original figure (panels B and F). +to published figure (panels B and F). \clearpage @@ -401,18 +406,19 @@ @ \href{http://dx.doi.org/10.1371/journal.pone.0022782.g007}{DOI link} -to original figure. +to published figure. \clearpage \section{Comparing old and new methionine sidechain parameters} -Make some $T-\log a_{\mathrm{H_{2}}}$ protein metastable equilibrium -predominance diagrams using old and new methionine sidechain {[}Met{]} -parameters. When this is run, the old {[}Met{]} is in the database -(since \texttt{add.obigt()} was called above), so in the second row -(j=2), we reset the database to use the new {[}Met{]}. +Make some $T-\log a_{\mathrm{H_{2}}}$ metastable equilibrium predominance +diagrams using different values for the thermodynamic properties of +the methionine sidechain group {[}Met{]}. The first row shows the +results using the old values (since \texttt{add.obigt()} was called +above); for the second row (j=2), we reset the database to use the +current (revised) parameters. <>= par(mfrow=c(2, 3)) @@ -437,9 +443,9 @@ } @ -\href{http://10.1371/journal.pone.0072395.g002}{DOI link} to original -figure. The original was made with higher resolution (256) and some -labels were manually placed. +\href{http://dx.doi.org/10.1371/journal.pone.0072395.g002}{DOI link} +to published figure, which was made with higher resolution (256) and +manual placement of some labels. \section{Relative abundance calculations} @@ -453,7 +459,7 @@ # put it in correct order, then turn counts into fractions out <- out[c(1,5:2), c(1:7,9:11,8)] out <- out/rowSums(out) - return(as.data.frame(out)) + return(out) } @ @@ -655,7 +661,7 @@ text(66, -9, "optimal parameterization\nfor observed\nphylum abundances", adj=0) @ -DOI links to original versions: \href{http://dx.doi.org/10.1371/journal.pone.0022782.g009}{plot 1}, +DOI links to published versions: \href{http://dx.doi.org/10.1371/journal.pone.0022782.g009}{plot 1}, \href{http://dx.doi.org/10.1371/journal.pone.0072395.g004}{plot 2}. @@ -663,7 +669,8 @@ Let's make some plots comparing the relative abundances calculated above (stored in \texttt{equil.results}) with the abundances from -BLAST counts. We'll also store the optimal models in \texttt{equil.opt}. +BLAST counts. We'll also store the results of the optimized models +in \texttt{equil.opt}. <>= layout(matrix(c(1, 2, 3, 4, 5, 6), nrow=2, byrow=TRUE), widths=c(2, 2, 2)) @@ -694,7 +701,7 @@ @ \href{http://dx.doi.org/10.1371/journal.pone.0072395.g005}{DOI link} -to original figure. +to published figure. \clearpage @@ -722,7 +729,7 @@ @ \href{http://dx.doi.org/10.1371/journal.pone.0072395.g006}{DOI link} -to original figure. +to published figure. \section{Document history} @@ -730,8 +737,8 @@ \item 2011-08-23 Initial version (CHNOSZ\_0.9-7) \item 2012-01-07 Use \texttt{add.obigt()} for superseded properties of methionine sidechain group. -\item 2014-02-01 Include results from 2013 paper and use knitr instead of -Sweave. +\item 2014-02-01 Include results from 2013 paper and change VignetteEngine +to knitr. \end{itemize} \bibliographystyle{unsrtnat} \bibliography{vig} Modified: pkg/CHNOSZ/vignettes/hotspring.lyx =================================================================== --- pkg/CHNOSZ/vignettes/hotspring.lyx 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/vignettes/hotspring.lyx 2015-05-14 09:07:47 UTC (rev 81) @@ -95,7 +95,7 @@ \begin_layout Standard \begin_inset ERT -status collapsed +status open \begin_layout Plain Layout @@ -120,16 +120,26 @@ \begin_layout Plain Layout -## set code/output width to be 60 +## set code/output width \end_layout \begin_layout Plain Layout -options(width=80) +options(width=85) \end_layout \begin_layout Plain Layout +## set number of digits +\end_layout + +\begin_layout Plain Layout + +options(digits=5) +\end_layout + +\begin_layout Plain Layout + ## tune details of base graphics (http://yihui.name/knitr/hooks) \end_layout @@ -163,6 +173,12 @@ Hot-spring proteins in CHNOSZ \end_layout +\begin_layout Author +Jeffrey M. + Dick and Everett L. + Shock +\end_layout + \begin_layout Section Introduction \end_layout @@ -202,7 +218,7 @@ In order to keep the code here as short and efficient as possible, some aspects of the published figures including manual labeling and higher resolutio n are not all reproduced; these changes are noted where possible. - Also, some tricks (e.g. + Also, some shortcuts (e.g. using \family typewriter xtabs() @@ -417,7 +433,7 @@ \end_inset - to original figure (panels A and B). + to published figure (panels A and B). The length of \family typewriter xpoints @@ -574,7 +590,8 @@ \begin_layout Plain Layout -# the names of the phyla in alphabetical order (Deinococcus-Thermus at end) +# the names of the phyla in alphabetical order (except Deinococcus-Thermus + at end) \end_layout \begin_layout Plain Layout @@ -1244,7 +1261,7 @@ \end_inset - to original table. + to published table. \end_layout \begin_layout Standard @@ -1341,8 +1358,8 @@ \end_layout \begin_layout Standard -This 1-2-4 progression of stabilities is visualized below, and for some - groups of proteins, an update to the thermodynamic properties of the methionine +This 1-2-4 progression of stabilities is visualized below; for some groups + of proteins, an update to the thermodynamic properties of the methionine sidechain causes site 3 also to become stable. \end_layout @@ -1541,7 +1558,7 @@ \end_inset - to original figure (panels B and F). + to published figure (panels B and F). \end_layout \begin_layout Standard @@ -1683,7 +1700,7 @@ \end_inset - to original figure. + to published figure. \end_layout \begin_layout Standard @@ -1711,14 +1728,14 @@ \begin_inset Formula $T-\log a_{\mathrm{H_{2}}}$ \end_inset - protein metastable equilibrium predominance diagrams using old and new - methionine sidechain [Met] parameters. - When this is run, the old [Met] is in the database (since + metastable equilibrium predominance diagrams using different values for + the thermodynamic properties of the methionine sidechain group [Met]. + The first row shows the results using the old values (since \family typewriter add.obigt() \family default - was called above), so in the second row (j=2), we reset the database to - use the new [Met]. + was called above); for the second row (j=2), we reset the database to use + the current (revised) parameters. \end_layout \begin_layout Standard @@ -1845,13 +1862,12 @@ \begin_inset CommandInset href LatexCommand href name "DOI link" -target "10.1371/journal.pone.0072395.g002" +target "http://dx.doi.org/10.1371/journal.pone.0072395.g002" \end_inset - to original figure. - The original was made with higher resolution (256) and some labels were - manually placed. + to published figure, which was made with higher resolution (256) and manual + placement of some labels. \end_layout \begin_layout Section @@ -1873,7 +1889,7 @@ \begin_layout Standard \begin_inset ERT -status collapsed +status open \begin_layout Plain Layout @@ -1907,7 +1923,7 @@ \begin_layout Plain Layout - return(as.data.frame(out)) + return(out) \end_layout \begin_layout Plain Layout @@ -1942,7 +1958,7 @@ \begin_layout Standard \begin_inset ERT -status collapsed +status open \begin_layout Plain Layout @@ -2082,7 +2098,7 @@ \begin_layout Standard \begin_inset ERT -status collapsed +status open \begin_layout Plain Layout @@ -2753,7 +2769,7 @@ \end_layout \begin_layout Standard -DOI links to original versions: +DOI links to published versions: \begin_inset CommandInset href LatexCommand href name "plot 1" @@ -2783,7 +2799,7 @@ equil.results \family default ) with the abundances from BLAST counts. - We'll also store the optimal models in + We'll also store the results of the optimized models in \family typewriter equil.opt \family default @@ -2947,7 +2963,7 @@ \end_inset - to original figure. + to published figure. \end_layout \begin_layout Standard @@ -3092,7 +3108,7 @@ \end_inset - to original figure. + to published figure. \end_layout \begin_layout Section @@ -3112,7 +3128,8 @@ \end_layout \begin_layout Itemize -2014-02-01 Include results from 2013 paper and use knitr instead of Sweave. +2014-02-01 Include results from 2013 paper and change VignetteEngine to + knitr. \end_layout \begin_layout Standard Modified: pkg/CHNOSZ/vignettes/vig.bib =================================================================== --- pkg/CHNOSZ/vignettes/vig.bib 2015-03-10 16:00:18 UTC (rev 80) +++ pkg/CHNOSZ/vignettes/vig.bib 2015-05-14 09:07:47 UTC (rev 81) @@ -1,1311 +1,615 @@ -% This file was created with JabRef 2.9.2. +% This file was created with JabRef 2.10. % Encoding: ISO8859_1 - at ARTICLE{AH97a, - author = {Amend, Jan P. and Helgeson, Harold C.}, - title = {{G}roup additivity equations of state for calculating the standard - molal thermodynamic properties of aqueous organic species at elevated - temperatures and pressures}, - journal = {Geochimica et Cosmochimica Acta}, - year = {1997}, - volume = {61}, - pages = {11 -- 46}, - abstract = {Group additivity equations of state for aqueous organic molecules - have been generated by combining the revised Helgeson-Kirkham-Flowers - (HKF) equations of state (Shock and Helgeson, 1988, 1990; Tanger - and Helgeson, 1988; Shock et al., 1989, 1992) with experimental values - of the standard molal properties of aqueous alkanes, alkanols, alkylbenzenes, - carboxylic acids, amides, and amines. Equations of state parameters - for the groups represented by -cn2 , -CH3, -CHCH3-, -C6H5, -CH2OH, - -COOH, -CONH2, and -CH2NH2 were determined by regression of the experimental - data. This procedure permits calculation of the standard molal thermodynamic - properties of these groups at elevated tempera-tures and pressures. - Although curves representing the apparent standard molal Gibbs free - energies ( A G ?) and enthalpies ( A H ?) of formation, and the standard - molal entropies (S ?) of the groups as a function of temperature - and pressure are respectively similar for each of them, the temperature - dependence of the standard molal heat capacities (C~) and volumes - (V?) of a number of the groups are quite different from one another. - For example, the standard molal heat capacities of the hydrocarbon - groups minimize with increasing temperature, but those of -CHEOH - and -CH2NH2 maximize. Computed values of AG ?, A H ?, S ?, C~, V - ?, and the equations of state parameters for the various groups were - used together with group additivity relations to generate corresponding - values of these properties for aqueous n-alkanes, 2-methylalkanes, - n-alkylbenzenes, n-alkanols, n-carboxylic acids, n-amides, and n-amines - at temperatures -< 250?C and pressures - 1 kbar. The validity and - generality of the equations of state are supported by the fact that - predicted equilibrium constants for liquid n-alkane solubility reactions - in water compare favorably with experimental values reported in the - literature for temperatures as high as 200?C. Furthermore, equilibrium - constants for aqueous ethane coexisting with ethene at 325 and 350?C - at 350 bars predicted from the equations of state are in close agreement - with independently determined experimental values reported by Seewald - (1994). The standard molal thermodynamic properties and equations - of state parameters reported below provide the means to characterize - the thermodynamic behavior of a wide variety of aqueous organic species - involved in hydrothermal reactions at elevated temperatures and pressures.}, - doi = {10.1016/S0016-7037(96)00306-7}, + + at Article{AH97a, + Title = {{G}roup additivity equations of state for calculating the standard molal thermodynamic properties of aqueous organic species at elevated temperatures and pressures}, + Author = {Amend, Jan P. and Helgeson, Harold C.}, + Journal = {Geochimica et Cosmochimica Acta}, + Year = {1997}, + Pages = {11 -- 46}, + Volume = {61}, + [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/chnosz -r 81 From noreply at r-forge.r-project.org Thu May 14 19:05:52 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 14 May 2015 19:05:52 +0200 (CEST) Subject: [CHNOSZ-commits] r82 - in pkg/CHNOSZ: . inst man Message-ID: <20150514170552.F3D661879CF@r-forge.r-project.org> Author: jedick Date: 2015-05-14 19:05:52 +0200 (Thu, 14 May 2015) New Revision: 82 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/findit.Rd Log: fix plot_findit documentation Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2015-05-14 09:07:47 UTC (rev 81) +++ pkg/CHNOSZ/DESCRIPTION 2015-05-14 17:05:52 UTC (rev 82) @@ -1,6 +1,6 @@ Date: 2015-05-14 Package: CHNOSZ -Version: 1.0.3-19 +Version: 1.0.3-20 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey Dick Maintainer: Jeffrey Dick Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2015-05-14 09:07:47 UTC (rev 81) +++ pkg/CHNOSZ/inst/NEWS 2015-05-14 17:05:52 UTC (rev 82) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.0.3-19 (2015-05-14) +CHANGES IN CHNOSZ 1.0.3-20 (2015-05-14) --------------------------------------- NEW FEATURES: Modified: pkg/CHNOSZ/man/findit.Rd =================================================================== --- pkg/CHNOSZ/man/findit.Rd 2015-05-14 09:07:47 UTC (rev 81) +++ pkg/CHNOSZ/man/findit.Rd 2015-05-14 17:05:52 UTC (rev 82) @@ -11,7 +11,7 @@ plot.it = TRUE, T = 25, P = "Psat", res = NULL, labcex = 0.6, loga2 = NULL, loga.balance = 0, rat = NULL, balance = NULL, normalize = FALSE) - \method{plot}{findit}(x, which=NULL, mar=c(3.5,5,2,2), xlab="iteration", \dots) + plot_findit(x, which=NULL, mar=c(3.5,5,2,2), xlab="iteration", \dots) } \arguments{ From noreply at r-forge.r-project.org Fri May 15 11:23:26 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 15 May 2015 11:23:26 +0200 (CEST) Subject: [CHNOSZ-commits] r83 - in pkg/CHNOSZ: . inst vignettes Message-ID: <20150515092326.DA62F187845@r-forge.r-project.org> Author: jedick Date: 2015-05-15 11:23:26 +0200 (Fri, 15 May 2015) New Revision: 83 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/vignettes/anintro.Rnw pkg/CHNOSZ/vignettes/anintro.lyx Log: use no internet in anintro.Rnw Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2015-05-14 17:05:52 UTC (rev 82) +++ pkg/CHNOSZ/DESCRIPTION 2015-05-15 09:23:26 UTC (rev 83) @@ -1,6 +1,6 @@ -Date: 2015-05-14 +Date: 2015-05-15 Package: CHNOSZ -Version: 1.0.3-20 +Version: 1.0.3-21 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey Dick Maintainer: Jeffrey Dick Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2015-05-14 17:05:52 UTC (rev 82) +++ pkg/CHNOSZ/inst/NEWS 2015-05-15 09:23:26 UTC (rev 83) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.0.3-20 (2015-05-14) +CHANGES IN CHNOSZ 1.0.3-21 (2015-05-15) --------------------------------------- NEW FEATURES: Modified: pkg/CHNOSZ/vignettes/anintro.Rnw =================================================================== --- pkg/CHNOSZ/vignettes/anintro.Rnw 2015-05-14 17:05:52 UTC (rev 82) +++ pkg/CHNOSZ/vignettes/anintro.Rnw 2015-05-15 09:23:26 UTC (rev 83) @@ -527,9 +527,11 @@ If the protein is not available in CHNOSZ's own database, the amino acid composition of the protein can be retrieved from the UniProtKB -(if the computer is connected to the Internet). +(if the computer is connected to the internet). N.B. The following +example is not evaluated when compiling this vignette in case the +R package checks are run without internet access. -<>= +<>= aa <- uniprot.aa("ALAT1_HUMAN") add.protein(aa) subcrt("ALAT1_HUMAN",1,T=25) Modified: pkg/CHNOSZ/vignettes/anintro.lyx =================================================================== --- pkg/CHNOSZ/vignettes/anintro.lyx 2015-05-14 17:05:52 UTC (rev 82) +++ pkg/CHNOSZ/vignettes/anintro.lyx 2015-05-15 09:23:26 UTC (rev 83) @@ -2073,7 +2073,10 @@ \begin_layout Standard If the protein is not available in CHNOSZ's own database, the amino acid composition of the protein can be retrieved from the UniProtKB (if the - computer is connected to the Internet). + computer is connected to the internet). + N.B. + The following example is not evaluated when compiling this vignette in + case the R package checks are run without internet access. \end_layout \begin_layout Standard @@ -2090,7 +2093,7 @@ status open \begin_layout Plain Layout -subcrt_ALAT1 +subcrt_ALAT1,eval=FALSE \end_layout \end_inset From noreply at r-forge.r-project.org Sun May 17 06:44:04 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 17 May 2015 06:44:04 +0200 (CEST) Subject: [CHNOSZ-commits] r84 - in pkg/CHNOSZ: . data inst man Message-ID: <20150517044404.DEE72185315@r-forge.r-project.org> Author: jedick Date: 2015-05-17 06:44:02 +0200 (Sun, 17 May 2015) New Revision: 84 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/data/refs.csv pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/affinity.Rd pkg/CHNOSZ/man/protein.info.Rd Log: minor changes to examples Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2015-05-15 09:23:26 UTC (rev 83) +++ pkg/CHNOSZ/DESCRIPTION 2015-05-17 04:44:02 UTC (rev 84) @@ -1,6 +1,6 @@ -Date: 2015-05-15 +Date: 2015-05-17 Package: CHNOSZ -Version: 1.0.3-21 +Version: 1.0.3-22 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey Dick Maintainer: Jeffrey Dick Modified: pkg/CHNOSZ/data/refs.csv =================================================================== --- pkg/CHNOSZ/data/refs.csv 2015-05-15 09:23:26 UTC (rev 83) +++ pkg/CHNOSZ/data/refs.csv 2015-05-17 04:44:02 UTC (rev 84) @@ -23,7 +23,6 @@ DPS+96,"I. Diakonov, G. Pokrovski et al.",1996,"Geochim. Cosmochim. Acta 60, 197-211",http://dx.doi.org/10.1016/0016-7037(95)00403-3 DRT98,"I. I. Diakonov, K. V. Ragnarsdottir and B. R. Tagirov",1998,"Chem. Geol. 151, 327-347",http://dx.doi.org/10.1016/S0009-2541(98)00088-6 DS09,"P. Dalla-Betta and M. Schulte",2009,"Int. J. Mol. Sci. 10, 2809-2837",http://dx.doi.org/10.3390/ijms10062809 -DS11,"J. M. Dick and E. L. Shock",2011,"PLoS ONE 6, e22782",http://dx.doi.org/10.1371/journal.pone.0022782 DSM+97,"J. D. Dale, E. L. Shock et al.",1997,"Geochim. Cosmochim. Acta 61, 4017-4024",http://dx.doi.org/10.1016/S0016-7037(97)00212-3 DSM+99,"I. I. Diakonov, J. Schott et al.",1999,"Geochim. Cosmochim. Acta 63, 2247-2261",http://dx.doi.org/10.1016/S0016-7037(99)00070-8 FDK+04,"P. M. B. Fernandes, T. Domitrovic et al.",2004,"FEBS Lett. 556, 153-160",http://dx.doi.org/10.1016/S0014-5793(03)01396-6 Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2015-05-15 09:23:26 UTC (rev 83) +++ pkg/CHNOSZ/inst/NEWS 2015-05-17 04:44:02 UTC (rev 84) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.0.3-21 (2015-05-15) +CHANGES IN CHNOSZ 1.0.3-22 (2015-05-17) --------------------------------------- NEW FEATURES: Modified: pkg/CHNOSZ/man/affinity.Rd =================================================================== --- pkg/CHNOSZ/man/affinity.Rd 2015-05-15 09:23:26 UTC (rev 83) +++ pkg/CHNOSZ/man/affinity.Rd 2015-05-17 04:44:02 UTC (rev 84) @@ -168,7 +168,7 @@ 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")[[1]] +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 Modified: pkg/CHNOSZ/man/protein.info.Rd =================================================================== --- pkg/CHNOSZ/man/protein.info.Rd 2015-05-15 09:23:26 UTC (rev 83) +++ pkg/CHNOSZ/man/protein.info.Rd 2015-05-17 04:44:02 UTC (rev 84) @@ -121,8 +121,7 @@ log(10) * Astar.residue # 0.4359, after Eq. 23 \donttest{## using protein.formula: average oxidation state of -## carbon of proteins from different organisms -# after Dick, 2014 (see Supporting Information to make plot with more groups) +## carbon of proteins from different organisms (Dick, 2014) # get amino acid compositions of microbial proteins # generated from the RefSeq database file <- system.file("extdata/refseq/protein_refseq.csv.xz", package="CHNOSZ") @@ -135,11 +134,11 @@ # the organism names we search for # "" matches all organisms terms <- c("Natr", "Halo", "Rhodo", "Acido", "Methylo", - "Nitro", "Desulfo", "Chloro", "Geo", "Methano", + "Chloro", "Nitro", "Desulfo", "Geo", "Methano", "Thermo", "Pyro", "Sulfo", "Buchner", "") tps <- thermo$protein$ref[ip] plot(0, 0, xlim=c(1, 15), ylim=c(-0.3, -0.05), pch="", - ylab="average oxidation state of carbon in proteins", + ylab=expression(italic(Z)[C]), xlab="", xaxt="n", mar=c(6, 3, 1, 1)) for(i in 1:length(terms)) { it <- grep(terms[i], tps) @@ -148,8 +147,8 @@ } terms[15] <- paste("all", length(ip)) axis(1, 1:15, terms, las=2) -title(main=paste("Average Oxidation State of Carbon:", - "Total Protein per taxID in NCBI RefSeq", sep="\n")) +title(main=paste("Average oxidation state of carbon in proteins", + "by taxID in NCBI RefSeq (after Dick, 2014)", sep="\n")) } } From noreply at r-forge.r-project.org Sun May 17 11:20:42 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 17 May 2015 11:20:42 +0200 (CEST) Subject: [CHNOSZ-commits] r85 - in pkg/CHNOSZ: . inst man vignettes Message-ID: <20150517092042.53C13187892@r-forge.r-project.org> Author: jedick Date: 2015-05-17 11:20:41 +0200 (Sun, 17 May 2015) New Revision: 85 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/inst/CHECKLIST pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/CHNOSZ-package.Rd pkg/CHNOSZ/man/EOSregress.Rd pkg/CHNOSZ/man/data.Rd pkg/CHNOSZ/man/examples.Rd pkg/CHNOSZ/man/extdata.Rd pkg/CHNOSZ/man/sideeffects.Rd pkg/CHNOSZ/man/subcrt.Rd pkg/CHNOSZ/man/util.expression.Rd pkg/CHNOSZ/man/wjd.Rd pkg/CHNOSZ/vignettes/hotspring.Rnw pkg/CHNOSZ/vignettes/hotspring.lyx Log: clean up documentation formatting Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/DESCRIPTION 2015-05-17 09:20:41 UTC (rev 85) @@ -1,6 +1,6 @@ Date: 2015-05-17 Package: CHNOSZ -Version: 1.0.3-22 +Version: 1.0.3-23 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey Dick Maintainer: Jeffrey Dick Modified: pkg/CHNOSZ/inst/CHECKLIST =================================================================== --- pkg/CHNOSZ/inst/CHECKLIST 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/inst/CHECKLIST 2015-05-17 09:20:41 UTC (rev 85) @@ -2,26 +2,38 @@ release checklist for CHNOSZ **************************** -- remove all "<<-" from sources (leftover from debugging) - -- update list of documentation topics in examples() with any new ones - - run examples() to make sure that all examples can be run (that includes \donttest ones that aren't run by R CMD check) - run demos() to run all demos +- check output of demo("sources") to make sure all data sources are cited + +- check output of R CMD Rd2pdf: fix lines truncated by page margins + +- run R CMD check using R compiled without long doubles (as in Solaris checks on CRAN) + (CFLAGS=-ffloat-store ./configure --disable-long-double) + +- build the package on the source directory; + try both qpdf and ghostscript to compact vignettes: + R CMD build --compact-vignettes=both chnosz/ + +OTHER THINGS TO CHECK: + +- remove all "<<-" from sources (leftover from debugging) + +- update list of documentation topics in examples() with any new ones + - run test_package("CHNOSZ") to run all tests -- check output of demo("sources") to make sure all data sources are cited - - recreate extdata/thermo/obigt_check.csv after all data updates: co <- check.obigt() write.csv(co, "obigt_check.csv", row.names=FALSE, na="") - especially on Windows: - data files are uncompressed on installation? (from BuildResaveData: no) - anim.*() produce pngs / movies (ImageMagick dependency)? + - data files are uncompressed on installation? (from BuildResaveData: no) + (so that users can copy and modify the thermodynamic database) + - anim.*() produce pngs / movies (ImageMagick dependency)? - check that uniprot.aa() works with current UniProt web pages @@ -33,10 +45,3 @@ - update .Rinstignore with any new/deleted files -- run R CMD check using R compiled without long doubles (as in Solaris checks on CRAN) - (CFLAGS=-ffloat-store ./configure --disable-long-double) - -- build the package on the source directory: - R CMD build --compact-vignettes chnosz/ - don't use --no-vignettes, that keeps the Rnw files from being copied to inst/doc, - causing vignettes to disappear from CRAN webpage Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/inst/NEWS 2015-05-17 09:20:41 UTC (rev 85) @@ -1,4 +1,4 @@ -CHANGES IN CHNOSZ 1.0.3-22 (2015-05-17) +CHANGES IN CHNOSZ 1.0.3-23 (2015-05-17) --------------------------------------- NEW FEATURES: @@ -9,7 +9,8 @@ - Add thermo$opt$varP option as a flag for subcrt() to calculate Gibbs energies of gases using a variable-pressure standard state. -- Add 'solubility.R' demo, and calcite solubility plot to anintro.Rnw. +- Add 'solubility.R' demo, and add calcite solubility plot to + anintro.Rnw. DATA CONSISTENCY: @@ -21,8 +22,8 @@ OTHER CHANGES: - When making filled color diagrams, diagram() calls image() with - useRaster=TRUE. This speeds up plotting, eliminates artifacts at - some resolutions (i.e. blank lines), and greatly reduces the size + useRaster=TRUE. This speeds up plotting, eliminates artifacts (i.e. + blank lines) at some resolutions, and greatly reduces the size of PDF files. - diagram() returns 'lx', 'ly' and 'is' for calculated positions of @@ -39,8 +40,8 @@ relative abundances of microbial phyla from Dick and Shock, 2013. - Add files with average amino acid compositions of proteins from Bison - Pool grouped according to annotation keyword (DS11.csv) (moved here - from protein.csv) or phylum assignment (DS13.csv). + Pool hot spring grouped according to annotation keyword (DS11.csv) + (moved here from protein.csv) or phylum assignment (DS13.csv). - water.lines() gets 'O2state' argument to specify state of O2. @@ -57,7 +58,7 @@ - In test-diagram.R, test that same diagrams are produced using 'as.residue' in equilibrate() or diagram(). -- Add 'tplot' argument to diagram() (set to FALSE to use R's default +- Add 'tplot' argument to diagram() (change to FALSE to use R's default plot set-up). CHANGES IN CHNOSZ 1.0.3 (2014-01-12) Modified: pkg/CHNOSZ/man/CHNOSZ-package.Rd =================================================================== --- pkg/CHNOSZ/man/CHNOSZ-package.Rd 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/man/CHNOSZ-package.Rd 2015-05-17 09:20:41 UTC (rev 85) @@ -12,10 +12,10 @@ By combining data taken from different sources, it is possible to build an inconsistent and/or nonsensical calculation. An attempt has been made to provide a primary database (OBIGT.csv) that is internally consistent, but no guarantee can be made. Where possible, data with known or suspected inconsistencies have been placed into a secondary database (OBIGT-2.csv) that should be regarded as experimental. -If there is any doubt about the accuracy or suitability of data for a particular problem, PLEASE consult the primary sources (see \code{\link{browse.refs}}). +If there is any doubt about the accuracy or suitability of data for a particular problem, please \emph{consult the primary sources} (see \code{\link{browse.refs}}). Do not assume that by adding any species to your calculation (or to any of the examples), you will necessarily obtain a reasonable answer. Do not assume that the examples are correct, or that they can be applied to your problem. -As with the data, PLEASE compare the construction and output of the examples to the primary sources, cited in the reference list in each help page. +As with the data, please \emph{compare the construction and output of the examples to the primary sources}, cited in the reference list in each help page. Examples without a reference (and some with references) demonstrate experimental features of CHNOSZ. } Modified: pkg/CHNOSZ/man/EOSregress.Rd =================================================================== --- pkg/CHNOSZ/man/EOSregress.Rd 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/man/EOSregress.Rd 2015-05-17 09:20:41 UTC (rev 85) @@ -134,7 +134,8 @@ var <- c("invTTTheta3", "invTX") EOSregress(d, var) # give them a "label" attribute for use in the legend -attr(invTTTheta3, "label") <- quote(phantom()\%*\%2*italic(T)/(italic(T)-italic(T)*Theta)^3) +attr(invTTTheta3, "label") <- + quote(phantom()\%*\%2*italic(T)/(italic(T)-italic(T)*Theta)^3) attr(invTX, "label") <- quote(phantom()/italic(T*X)) # uncomment the following to make the plot #EOSplot(d, var) Modified: pkg/CHNOSZ/man/data.Rd =================================================================== --- pkg/CHNOSZ/man/data.Rd 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/man/data.Rd 2015-05-17 09:20:41 UTC (rev 85) @@ -51,9 +51,9 @@ \code{state} \tab character \tab The default physical state for searching species (\samp{aq} by default)\cr \code{water} \tab character \tab Computational option for properties of water (\samp{SUPCRT} (default) or \samp{IAPWS})\cr \code{online} \tab logical \tab Allow online searches of protein composition? Default (\code{NA}) is to ask the user.\cr - \code{G.tol} \tab numeric \tab Absolute difference between tabulated and calculated value of G above which \code{\link{checkGHS}} produces a message (cal mol\eqn{^{-1}}{^-1}).\cr - \code{Cp.tol} \tab numeric \tab Absolute difference between tabulated and calculated value of Cp above which \code{\link{checkEOS}} produces a message (cal K\eqn{^{-1}}{-1} mol\eqn{^{-1}}{^-1}).\cr - \code{V.tol} \tab numeric \tab Absolute difference between tabulated and calculated value of V above which \code{\link{checkEOS}} produces a message (cm\eqn{^{3}}{3} mol\eqn{^{-1}}{^-1}).\cr + \code{G.tol} \tab numeric \tab Difference in value of G above which \code{\link{checkGHS}} produces a message (cal mol\eqn{^{-1}}{^-1}).\cr + \code{Cp.tol} \tab numeric \tab Difference in value of Cp above which \code{\link{checkEOS}} produces a message (cal K\eqn{^{-1}}{-1} mol\eqn{^{-1}}{^-1}).\cr + \code{V.tol} \tab numeric \tab Difference in value of V above which \code{\link{checkEOS}} produces a message (cm\eqn{^{3}}{3} mol\eqn{^{-1}}{^-1}).\cr \code{varP} \tab logical \tab Use variable-pressure standard state for gases (default \code{FALSE})? See \code{\link{subcrt}}.\cr } Modified: pkg/CHNOSZ/man/examples.Rd =================================================================== --- pkg/CHNOSZ/man/examples.Rd 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/man/examples.Rd 2015-05-17 09:20:41 UTC (rev 85) @@ -37,11 +37,11 @@ \code{nucleobase} \tab relative stabilities of nucleobases and some amino acids \cr \code{orp} \tab oxidation-reduction potential of redox standards as a function of temperature \cr \code{findit} \tab detailed example of usage of \code{\link{findit}} using log-normal distribution as an objective \cr - \code{CO2Ac} \tab activity of CO2 buffered by acetic acid; comparing \code{\link{affinity}(return.buffer=TRUE)} with \code{\link{diagram}(what="CO2")} \cr + \code{CO2Ac} \tab activity of CO2 buffered by acetic acid; comparing \code{\link{affinity}} with \code{\link{diagram}} \cr \code{nonideal} \tab activity coefficient of charged species (Alberty, 2003), using the \code{IS} argument of \code{subcrt} \cr \code{TPX} \tab metastablilities of selected ionized bacterial thiol peroxidases as a chemical activity buffer \cr - \code{mosaic} \tab Eh-pH diagram for iron oxides, sulfides and carbonate with two sets of changing basis species (Garrels and Christ, 1965) \cr - \code{solubility} \tab solubility of calcite (cf. Manning et al., 2013 Fig. 4A) or CO2(gas) (cf. Stumm and Morgan, 1996 Fig 4.5) as a function of pH \cr + \code{mosaic} \tab Eh-pH diagram with two sets of changing basis species (Garrels and Christ, 1965) \cr + \code{solubility} \tab solubility of calcite (cf. Manning et al., 2013) or CO2(gas) (cf. Stumm and Morgan, 1996) \cr } } Modified: pkg/CHNOSZ/man/extdata.Rd =================================================================== --- pkg/CHNOSZ/man/extdata.Rd 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/man/extdata.Rd 2015-05-17 09:20:41 UTC (rev 85) @@ -21,7 +21,7 @@ Files in \code{bison} contain BLAST results and taxonomic information for a metagenome: \itemize{ - \item \code{bisonN_vs_refseq57.blast.xz}, \code{bisonS_vs_refseq57.blast.xz}, \code{bisonR_vs_refseq57.blast.xz}, \code{bisonQ_vs_refseq57.blast.xz}, \code{bisonP_vs_refseq57.blast.xz} are partial tabular BLAST results for proteins in the Bison Pool Environmental Genome. Protein sequences predicted in the metagenome were downloaded from the Joint Genome Institute's IMG/M system on 2009-05-13. The target database for the searches was constructed from microbial protein sequences in National Center for Biotechnology Information (NCBI) RefSeq database version 57, representing 7415 microbial genomes. The \sQuote{blastall} command was used with the default setting for E value cuttoff (10.0) and options to make a tabular output file consisting of the top 20 hits for each query sequence. The function \code{\link{read.blast}} was used to extract only those hits with E values less than or equal to 1e-5 and with sequence similarity (percent identity) at least 30 percent, and to keep only the first hit for each query sequence. The function \code{\link{write.blast}} was used to save partial BLAST files (only selected columns). The files provided with CHNOSZ contain the first 5,000 hits for each sampling site at Bison Pool, representing between about 7 to 15 percent of the first BLAST hits after similarity and E value filtering. + \item \code{bisonN_vs_refseq57.blast.xz}, \code{bisonS...}, \code{bisonR...}, \code{bisonQ...}, \code{bisonP...} are partial tabular BLAST results for proteins in the Bison Pool Environmental Genome. Protein sequences predicted in the metagenome were downloaded from the Joint Genome Institute's IMG/M system on 2009-05-13. The target database for the searches was constructed from microbial protein sequences in National Center for Biotechnology Information (NCBI) RefSeq database version 57, representing 7415 microbial genomes. The \sQuote{blastall} command was used with the default setting for E value cuttoff (10.0) and options to make a tabular output file consisting of the top 20 hits for each query sequence. The function \code{\link{read.blast}} was used to extract only those hits with E values less than or equal to 1e-5 and with sequence similarity (percent identity) at least 30 percent, and to keep only the first hit for each query sequence. The function \code{\link{write.blast}} was used to save partial BLAST files (only selected columns). The files provided with CHNOSZ contain the first 5,000 hits for each sampling site at Bison Pool, representing between about 7 to 15 percent of the first BLAST hits after similarity and E value filtering. \item \code{gi.taxid.txt.xz} is a table that lists the sequence identifiers (gi numbers) that appear in the example BLAST files (see above), together with the corresponding taxon ids used in the NCBI databases. This file is \emph{not} a subset of the complete \sQuote{gi_taxid_prot.dmp.gz} available at \url{ftp://ftp.ncbi.nih.gov/pub/taxonomy/} but instead is a subset of \sQuote{gi.taxid.txt} generated from the RefSeq release catalog using \sQuote{gencat.sh} in the \code{refseq} directory. See \code{\link{id.blast}} for an example that uses this file and the BLAST files described above. } Modified: pkg/CHNOSZ/man/sideeffects.Rd =================================================================== --- pkg/CHNOSZ/man/sideeffects.Rd 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/man/sideeffects.Rd 2015-05-17 09:20:41 UTC (rev 85) @@ -10,7 +10,7 @@ When the package is loaded, \code{\link{.onAttach}} creates a \code{\link{list}} object named \code{\link{thermo}} that is placed in an \code{\link{environment}} named \samp{CHNOSZ}. Some functions in CHNOSZ have side effects that modify the contents of \code{thermo}; all such changes can be reverted, and the object restored to its original state, by calling \code{\link{data}(thermo)}. -The \samp{CHNOSZ} environment is \emph{not} (as of CHNOSZ 1.0.0) \code{\link{attach}ed}, rather the \code{thermo} object is accessed in functions using \code{\link{get}} (as in \code{get("thermo")}), \code{\link{assign}} (\code{assign("thermo", thermo, "CHNOSZ")}) and occasionally \code{\link{with}} (\code{with(as.environment("CHNOSZ"), ...)}). +The \samp{CHNOSZ} environment is \emph{not} (as of CHNOSZ 1.0.0) \code{\link{attach}ed}, rather the \code{thermo} object is accessed in functions by e.g. \code{\link{get}("thermo")}, \code{\link{assign}("thermo", thermo, "CHNOSZ")} and occasionally \code{\link{with}(as.environment("CHNOSZ"), ...)}. In the functions in the package, the greatest number of accessions are to the thermodynamic database (\code{thermo$obigt}), followed by the basis and species definitions (\code{thermo$basis} and \code{thermo$species}). For example, \code{\link{info}} can be used to look up thermodynamic data in \code{thermo$obigt} by the name or chemical formula of a species. Modified: pkg/CHNOSZ/man/subcrt.Rd =================================================================== --- pkg/CHNOSZ/man/subcrt.Rd 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/man/subcrt.Rd 2015-05-17 09:20:41 UTC (rev 85) @@ -253,7 +253,8 @@ # start plot with extra room on right par(mar=c(5, 4, 4, 4)) # plot G -plot(sb$water$T, sb$water$G, ylim=c(-63000, -56000), xlab=axis.label("T"), ylab=axis.label("DG0")) +plot(sb$water$T, sb$water$G, ylim=c(-63000, -56000), xlab=axis.label("T"), + ylab=axis.label("DG0")) points(sb$`Na+`$T, sb$`Na+`$G, pch=2) # add Cp # change y-axis Modified: pkg/CHNOSZ/man/util.expression.Rd =================================================================== --- pkg/CHNOSZ/man/util.expression.Rd 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/man/util.expression.Rd 2015-05-17 09:20:41 UTC (rev 85) @@ -15,9 +15,10 @@ expr.property(property) expr.units(property, prefix = "", per = "mol") axis.label(label, units = NULL, basis = get("thermo")$basis, prefix = "") - describe.basis(basis = get("thermo")$basis, ibasis = 1:nrow(basis), digits = 1, - oneline = FALSE) - describe.property(property, value, digits = 1, oneline = FALSE, ret.val = FALSE) + describe.basis(basis = get("thermo")$basis, ibasis = 1:nrow(basis), + digits = 1, oneline = FALSE) + describe.property(property, value, digits = 1, oneline = FALSE, + ret.val = FALSE) describe.reaction(reaction, iname = numeric(), states = NULL) } Modified: pkg/CHNOSZ/man/wjd.Rd =================================================================== --- pkg/CHNOSZ/man/wjd.Rd 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/man/wjd.Rd 2015-05-17 09:20:41 UTC (rev 85) @@ -38,8 +38,9 @@ dimnames=list(NULL,c("H","N","O"))), B = c(2,1,1), method="stoich", minX = 0.001, iguess = 1, ic = NULL ) - run.wjd(ispecies, B = NULL, method = "stoich", Y = run.guess(ispecies, B, method), - P=1, T=25, nlambda=101, imax = 10, Gfrac = 1e-7, tol = 0.01) + run.wjd(ispecies, B = NULL, method = "stoich", + Y = run.guess(ispecies, B, method), P=1, T=25, nlambda=101, imax = 10, + Gfrac = 1e-7, tol = 0.01) run.guess(ispecies, B = NULL, method = "stoich", iguess = NULL) equil.potentials(w, tol=0.01, T=25) } Modified: pkg/CHNOSZ/vignettes/hotspring.Rnw =================================================================== --- pkg/CHNOSZ/vignettes/hotspring.Rnw 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/vignettes/hotspring.Rnw 2015-05-17 09:20:41 UTC (rev 85) @@ -56,15 +56,15 @@ \section{Introduction} -The intention of this document is to demonstrate the calculations -described in two recent papers \citep{DS11,DS13} dealing with the -distribution and abundances of proteins in ``Bison Pool'', a hot -spring in Yellowstone National Park. The calculations use metastable -equilibrium to interrelate the compositions of proteins (from metagenomic -data) with environmental conditions, particularly pH, temperature, -and redox chemistry. This document is focused on the details of the -calculations and has little in the way of introduction of concepts -or interpretation and discussion; please see the papers for more details. +This document is intended to demonstrate the calculations described +in two recent papers \citep{DS11,DS13} dealing with the distribution +and abundances of proteins in ``Bison Pool'', a hot spring in Yellowstone +National Park. The calculations use metastable equilibrium to interrelate +the compositions of proteins (from metagenomic data) with environmental +conditions, particularly pH, temperature, and redox chemistry. This +document is focused on the details of the calculations and has little +in the way of introduction of concepts or interpretation and discussion; +please see the papers for more details. There is no hidden code in this document; all code used to make the figures is shown in the blocks, but much of the text output (particularly @@ -187,7 +187,8 @@ <>= # 2011 plot -plot(0, 0, xlim=c(-0.5, 5), ylim=c(-0.27, -0.11), xlab="location", xaxt="n", ylab=expression(bar(italic(Z))[C])) +ylab <- expression(bar(italic(Z))[C]) +plot(0, 0, xlim=c(-0.5, 5), ylim=c(-0.27, -0.11), xlab="location", xaxt="n", ylab=ylab) axis(1, at=1:5) col <- c("green", rep("black", 20)) lwd <- c(3, rep(1, 20)) @@ -204,7 +205,7 @@ pf.phyla <- protein.formula(aa.phyla) ZC.phyla <- ZC(pf.phyla) # set up plot -plot(0, 0, xlim=c(1, 5), ylim=c(-0.27, -0.11), xlab="location", ylab=as.expression(quote(bar(italic(Z))[C]))) +plot(0, 0, xlim=c(1, 5), ylim=c(-0.27, -0.11), xlab="location", ylab=ylab) for(i in 1:length(phyla.abc)) { # which of the model proteins correspond to this phylum iphy <- which(aa.phyla$organism==phyla.abc[i]) @@ -641,8 +642,10 @@ <>= # 2011 plot +xlab <- axis.label("T") +ylab <- axis.label("H2") plot(Tlim, get.logaH2(Tlim), xlim=Tlim, ylim=c(-45,0), - xlab=axis.label("T"), ylab=axis.label("H2"), type="l", lty=3) + xlab=xlab, ylab=ylab, type="l", lty=3) points(T.ORP, logaH2.ORP, pch=15) lines(T.ORP, logaH2.ORP, lty=2) points(bison.T, logaH2.O, pch=16) @@ -654,7 +657,7 @@ # 2013 plot plot(Tlim, get.logaH2(Tlim), xlim=Tlim, ylim=c(-11,-2), - xlab=axis.label("T"), ylab=axis.label("H2"), type="l", lty=3) + xlab=xlab, ylab=ylab, type="l", lty=3) lines(bison.T, sapply(equil.results, "[", "logaH2.opt"), lty=2) points(bison.T, sapply(equil.results, "[", "logaH2.opt"), pch=21, bg="white") text(90, -5.3, "Equation 2") Modified: pkg/CHNOSZ/vignettes/hotspring.lyx =================================================================== --- pkg/CHNOSZ/vignettes/hotspring.lyx 2015-05-17 04:44:02 UTC (rev 84) +++ pkg/CHNOSZ/vignettes/hotspring.lyx 2015-05-17 09:20:41 UTC (rev 85) @@ -184,8 +184,8 @@ \end_layout \begin_layout Standard -The intention of this document is to demonstrate the calculations described - in two recent papers +This document is intended to demonstrate the calculations described in two + recent papers \begin_inset CommandInset citation LatexCommand citep key "DS11,DS13" @@ -736,8 +736,13 @@ \begin_layout Plain Layout +ylab <- expression(bar(italic(Z))[C]) +\end_layout + +\begin_layout Plain Layout + plot(0, 0, xlim=c(-0.5, 5), ylim=c(-0.27, -0.11), xlab="location", xaxt="n", - ylab=expression(bar(italic(Z))[C])) + ylab=ylab) \end_layout \begin_layout Plain Layout @@ -822,8 +827,7 @@ \begin_layout Plain Layout -plot(0, 0, xlim=c(1, 5), ylim=c(-0.27, -0.11), xlab="location", ylab=as.expression( -quote(bar(italic(Z))[C]))) +plot(0, 0, xlim=c(1, 5), ylim=c(-0.27, -0.11), xlab="location", ylab=ylab) \end_layout \begin_layout Plain Layout @@ -2667,12 +2671,22 @@ \begin_layout Plain Layout +xlab <- axis.label("T") +\end_layout + +\begin_layout Plain Layout + +ylab <- axis.label("H2") +\end_layout + +\begin_layout Plain Layout + plot(Tlim, get.logaH2(Tlim), xlim=Tlim, ylim=c(-45,0), \end_layout \begin_layout Plain Layout - xlab=axis.label("T"), ylab=axis.label("H2"), type="l", lty=3) + xlab=xlab, ylab=ylab, type="l", lty=3) \end_layout \begin_layout Plain Layout @@ -2731,7 +2745,7 @@ \begin_layout Plain Layout - xlab=axis.label("T"), ylab=axis.label("H2"), type="l", lty=3) + xlab=xlab, ylab=ylab, type="l", lty=3) \end_layout \begin_layout Plain Layout From noreply at r-forge.r-project.org Mon May 18 16:21:17 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 18 May 2015 16:21:17 +0200 (CEST) Subject: [CHNOSZ-commits] r86 - in pkg/CHNOSZ: . inst man vignettes Message-ID: <20150518142117.25E37185671@r-forge.r-project.org> Author: jedick Date: 2015-05-18 16:21:16 +0200 (Mon, 18 May 2015) New Revision: 86 Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/CHNOSZ-package.Rd pkg/CHNOSZ/vignettes/equilibrium.Rnw pkg/CHNOSZ/vignettes/equilibrium.lyx pkg/CHNOSZ/vignettes/hotspring.Rnw pkg/CHNOSZ/vignettes/hotspring.lyx Log: prepare version 1.0.4 for submission to CRAN Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2015-05-17 09:20:41 UTC (rev 85) +++ pkg/CHNOSZ/DESCRIPTION 2015-05-18 14:21:16 UTC (rev 86) @@ -1,10 +1,10 @@ -Date: 2015-05-17 +Date: 2015-05-18 Package: CHNOSZ -Version: 1.0.3-23 +Version: 1.0.4 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey Dick Maintainer: Jeffrey Dick -Depends: R (>= 2.12.0) +Depends: R (>= 3.0.0) Suggests: limSolve, parallel, testthat, knitr Description: Functions and data sets to support chemical thermodynamic modeling in biochemistry and low-temperature geochemistry. The features include calculation of the standard molal Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2015-05-17 09:20:41 UTC (rev 85) +++ pkg/CHNOSZ/inst/NEWS 2015-05-18 14:21:16 UTC (rev 86) @@ -1,13 +1,13 @@ -CHANGES IN CHNOSZ 1.0.3-23 (2015-05-17) ---------------------------------------- +CHANGES IN CHNOSZ 1.0.4 (2015-05-18) +------------------------------------ NEW FEATURES: - Add mosaic() function for affinity calculations with changing basis species. See also new 'mosaic.R' demo. -- Add thermo$opt$varP option as a flag for subcrt() to calculate Gibbs - energies of gases using a variable-pressure standard state. +- Add thermo$opt$varP option for subcrt() to calculate Gibbs energies + of gases using a variable-pressure standard state. - Add 'solubility.R' demo, and add calcite solubility plot to anintro.Rnw. @@ -61,6 +61,8 @@ - Add 'tplot' argument to diagram() (change to FALSE to use R's default plot set-up). +- R version dependency changed to (>= 3.0.0). + CHANGES IN CHNOSZ 1.0.3 (2014-01-12) ------------------------------------ Modified: pkg/CHNOSZ/man/CHNOSZ-package.Rd =================================================================== --- pkg/CHNOSZ/man/CHNOSZ-package.Rd 2015-05-17 09:20:41 UTC (rev 85) +++ pkg/CHNOSZ/man/CHNOSZ-package.Rd 2015-05-18 14:21:16 UTC (rev 86) @@ -69,7 +69,8 @@ \section{Compatibility}{ - The recommended version of \R is 2.14.0 or greater (to find vignettes in the \code{vignettes} directory, and for availability of \pkg{parallel} in the standard library). + As of version 1.0.4, the package depends on \R version 3.0.0 or greater (previous versions use \code{\link{Stangle}} to extract R code from vignettes when installing the source package, leading to failure processing hotspring.Rnw, which now uses knitr instead of Sweave). + Before version 1.0.4, the recommended version of \R was 2.14.0 or greater (to find vignettes in the \code{vignettes} directory, and for availability of \pkg{parallel} in the standard library). As of version 0.9-9, the package depends on \R version 2.12.0 or greater (so useDynLib in the NAMESPACE can find the shared library on Windows). Starting with version 0.9-6 of the package, the dependency was given as \R version 2.10.0 or greater (to read compressed data files). Before version 0.9-6 of the package, the dependency was given as \R version 2.7.0 or greater (major update of the X11 device in 2.7.0). Modified: pkg/CHNOSZ/vignettes/equilibrium.Rnw =================================================================== --- pkg/CHNOSZ/vignettes/equilibrium.Rnw 2015-05-17 09:20:41 UTC (rev 85) +++ pkg/CHNOSZ/vignettes/equilibrium.Rnw 2015-05-18 14:21:16 UTC (rev 86) @@ -1,4 +1,4 @@ -%% LyX 2.1.0beta2 created this file. For more info, see http://www.lyx.org/. +%% LyX 2.1.3 created this file. For more info, see http://www.lyx.org/. %% Do not edit unless you really know what you are doing. \documentclass[english,noae]{article} \usepackage{mathpazo} @@ -78,12 +78,10 @@ the molar formula by the balancing coefficients. This normalization has been referred to previously as using the residue equivalents of proteins \citep{Dic08}; here the terminology of \emph{normalize} -will be used preferentially% -\footnote{The older style of function call using \texttt{diagram(..., residue=TRUE)} +will be used preferentially\footnote{The older style of function call using \texttt{diagram(..., residue=TRUE)} has been replaced by \texttt{equilibrate(..., normalize=TRUE)} or \texttt{diagram(..., normalize=TRUE)} starting with version 0.9-9 -of CHNOSZ.% -}. +of CHNOSZ.}. Two different methods of calculating the equilibrium activities of species in a system are described below. These are referred to as @@ -580,20 +578,14 @@ distribution. -\section{Document Information} +\section{Document revision history} -Revision history \begin{itemize} \item 2009-11-29 Initial version containing CSG example (title: Calculating relative abundances of proteins) \item 2012-09-30 Renamed from previous ``protactiv.Rnw'': Remove activity -comparisons, add maximum affinity method. -\end{itemize} -R session information +comparisons, add maximum affinity method.\end{itemize} -<>= -sessionInfo() -@ \bibliographystyle{plainnat} \bibliography{vig} Modified: pkg/CHNOSZ/vignettes/equilibrium.lyx =================================================================== --- pkg/CHNOSZ/vignettes/equilibrium.lyx 2015-05-17 09:20:41 UTC (rev 85) +++ pkg/CHNOSZ/vignettes/equilibrium.lyx 2015-05-18 14:21:16 UTC (rev 86) @@ -2302,17 +2302,13 @@ \end_layout \begin_layout Section -Document Information +Document revision history \end_layout \begin_layout Standard \begin_inset Branch stuff status open -\begin_layout Standard -Revision history -\end_layout - \begin_layout Itemize 2009-11-29 Initial version containing CSG example (title: Calculating relative abundances of proteins) @@ -2330,38 +2326,11 @@ : Remove activity comparisons, add maximum affinity method. \end_layout -\begin_layout Standard -R session information -\end_layout - -\begin_layout Standard -\begin_inset Flex Chunk -status open - -\begin_layout Plain Layout - -\begin_inset Argument 1 -status open - -\begin_layout Plain Layout -SessionInfo -\end_layout - \end_inset -sessionInfo() -\end_layout -\end_inset - - \end_layout -\end_inset - - -\end_layout - \begin_layout Standard \begin_inset CommandInset bibtex LatexCommand bibtex Modified: pkg/CHNOSZ/vignettes/hotspring.Rnw =================================================================== --- pkg/CHNOSZ/vignettes/hotspring.Rnw 2015-05-17 09:20:41 UTC (rev 85) +++ pkg/CHNOSZ/vignettes/hotspring.Rnw 2015-05-18 14:21:16 UTC (rev 86) @@ -330,7 +330,7 @@ This 1-2-4 progression of stabilities is visualized below; for some groups of proteins, an update to the thermodynamic properties of the -methionine sidechain causes site 3 also to become stable. +methionine sidechain causes proteins from site 3 also to become stable. \subsection{Relative stabilities along a chemical gradient} Modified: pkg/CHNOSZ/vignettes/hotspring.lyx =================================================================== --- pkg/CHNOSZ/vignettes/hotspring.lyx 2015-05-17 09:20:41 UTC (rev 85) +++ pkg/CHNOSZ/vignettes/hotspring.lyx 2015-05-18 14:21:16 UTC (rev 86) @@ -1364,7 +1364,7 @@ \begin_layout Standard This 1-2-4 progression of stabilities is visualized below; for some groups of proteins, an update to the thermodynamic properties of the methionine - sidechain causes site 3 also to become stable. + sidechain causes proteins from site 3 also to become stable. \end_layout \begin_layout Subsection From noreply at r-forge.r-project.org Tue May 19 16:38:46 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 19 May 2015 16:38:46 +0200 (CEST) Subject: [CHNOSZ-commits] r87 - in pkg/CHNOSZ: . R demo inst man Message-ID: <20150519143846.9365A185587@r-forge.r-project.org> Author: jedick Date: 2015-05-19 16:38:46 +0200 (Tue, 19 May 2015) New Revision: 87 Added: pkg/CHNOSZ/demo/buffer.R pkg/CHNOSZ/demo/diagram.R pkg/CHNOSZ/demo/ionize.R pkg/CHNOSZ/demo/revisit.R pkg/CHNOSZ/demo/wjd.R pkg/CHNOSZ/demo/yeastgfp.R Removed: pkg/CHNOSZ/demo/TPX.R Modified: pkg/CHNOSZ/DESCRIPTION pkg/CHNOSZ/R/examples.R pkg/CHNOSZ/demo/00Index pkg/CHNOSZ/demo/findit.R pkg/CHNOSZ/inst/CHECKLIST pkg/CHNOSZ/inst/NEWS pkg/CHNOSZ/man/CHNOSZ-package.Rd pkg/CHNOSZ/man/EOSregress.Rd pkg/CHNOSZ/man/IAPWS95.Rd pkg/CHNOSZ/man/affinity.Rd pkg/CHNOSZ/man/anim.Rd pkg/CHNOSZ/man/basis.Rd pkg/CHNOSZ/man/buffer.Rd pkg/CHNOSZ/man/data.Rd pkg/CHNOSZ/man/diagram.Rd pkg/CHNOSZ/man/eos.Rd pkg/CHNOSZ/man/eqdata.Rd pkg/CHNOSZ/man/equilibrate.Rd pkg/CHNOSZ/man/examples.Rd pkg/CHNOSZ/man/extdata.Rd pkg/CHNOSZ/man/findit.Rd pkg/CHNOSZ/man/info.Rd pkg/CHNOSZ/man/ionize.aa.Rd pkg/CHNOSZ/man/iprotein.Rd pkg/CHNOSZ/man/makeup.Rd pkg/CHNOSZ/man/more.aa.Rd pkg/CHNOSZ/man/mosaic.Rd pkg/CHNOSZ/man/objective.Rd pkg/CHNOSZ/man/protein.Rd pkg/CHNOSZ/man/protein.info.Rd pkg/CHNOSZ/man/read.expr.Rd pkg/CHNOSZ/man/revisit.Rd pkg/CHNOSZ/man/sideeffects.Rd pkg/CHNOSZ/man/species.Rd pkg/CHNOSZ/man/subcrt.Rd pkg/CHNOSZ/man/swap.basis.Rd pkg/CHNOSZ/man/taxonomy.Rd pkg/CHNOSZ/man/transfer.Rd pkg/CHNOSZ/man/util.affinity.Rd pkg/CHNOSZ/man/util.args.Rd pkg/CHNOSZ/man/util.array.Rd pkg/CHNOSZ/man/util.blast.Rd pkg/CHNOSZ/man/util.character.Rd pkg/CHNOSZ/man/util.data.Rd pkg/CHNOSZ/man/util.expression.Rd pkg/CHNOSZ/man/util.fasta.Rd pkg/CHNOSZ/man/util.formula.Rd pkg/CHNOSZ/man/util.list.Rd pkg/CHNOSZ/man/util.matrix.Rd pkg/CHNOSZ/man/util.misc.Rd pkg/CHNOSZ/man/util.plot.Rd pkg/CHNOSZ/man/util.program.Rd pkg/CHNOSZ/man/util.seq.Rd pkg/CHNOSZ/man/util.units.Rd pkg/CHNOSZ/man/water.Rd pkg/CHNOSZ/man/wjd.Rd Log: prepare version 1.0.5 for submission to CRAN Modified: pkg/CHNOSZ/DESCRIPTION =================================================================== --- pkg/CHNOSZ/DESCRIPTION 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/DESCRIPTION 2015-05-19 14:38:46 UTC (rev 87) @@ -1,6 +1,6 @@ -Date: 2015-05-18 +Date: 2015-05-19 Package: CHNOSZ -Version: 1.0.4 +Version: 1.0.5 Title: Chemical Thermodynamics and Activity Diagrams Author: Jeffrey Dick Maintainer: Jeffrey Dick Modified: pkg/CHNOSZ/R/examples.R =================================================================== --- pkg/CHNOSZ/R/examples.R 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/R/examples.R 2015-05-19 14:38:46 UTC (rev 87) @@ -12,7 +12,7 @@ "util.seq", "util.units", "taxonomy", "info", "protein.info", "hkf", "water", "subcrt", "makeup", "basis", "swap.basis", "species", "affinity", "util.affinity", "equil.boltzmann", "diagram", "buffer", "iprotein", "protein", "ionize.aa", "more.aa", "read.expr", - "objective", "revisit", "findit", "transfer", "anim", "EOSregress", "wjd") + "objective", "revisit", "transfer", "anim", "EOSregress", "wjd") plot.it <- FALSE if(is.character(do.png)) png(paste(do.png,"%d.png",sep=""),width=700,height=700,pointsize=18) @@ -30,8 +30,9 @@ } demos <- function(which=c("sources", "NaCl", "cordierite", - "phosphate", "nucleobase", "orp", - "findit", "CO2Ac", "nonideal", "TPX", "mosaic", "solubility")) { + "phosphate", "nucleobase", "orp", "diagram", "revisit", "findit", + "CO2Ac", "nonideal", "ionize", "buffer", "yeastgfp", "mosaic", + "solubility", "wjd")) { # 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/demo/00Index =================================================================== --- pkg/CHNOSZ/demo/00Index 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/demo/00Index 2015-05-19 14:38:46 UTC (rev 87) @@ -4,9 +4,14 @@ phosphate phosphate speciation with pH, temperature and ionic strength nucleobase relative stabilities of nucleobases and some amino acids orp oxidation-reduction potential of redox standards as a function of temperature -findit example of findit() using log-normal distribution as an objective +diagram comparison of methods for calculating stability fields +revisit detailed example of usage of revisit() +findit detailed example of usage of findit() CO2Ac activity of CO2 buffered by acetic acid; comparing affinity(return.buffer=TRUE) with diagram(what="CO2") nonideal activity coefficient of charged species, using the IS argument of subcrt -TPX metastablilities of selected ionized bacterial thiol peroxidases as a chemical activity buffer +ionize ionize.aa(): contour plots of net charge and ionization properties of LYSC_CHICK +buffer ionized proteins as a chemical activity buffer (1. thiol peroxidases 2. sigma factors) +yeastgfp logfO2-logaH2O diagrams for model proteins based on YeastGFP localizations mosaic Eh-pH diagram for iron oxides, sulfides and carbonate with two sets of changing basis species solubility solubility of calicite or CO2(gas) as a function of pH +wjd run.wjd() with proteins: cell periphery of yeast Deleted: pkg/CHNOSZ/demo/TPX.R =================================================================== --- pkg/CHNOSZ/demo/TPX.R 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/demo/TPX.R 2015-05-19 14:38:46 UTC (rev 87) @@ -1,18 +0,0 @@ -## Buffer + ionization: Metastablilities of -## thiol peroxidases from model bactera -## (ECOLI, BACSU mesophile; AQUAE thermophile, -## THIDA acidophile, BACHD alkaliphile) -basis("CHNOS+") -organisms <- c("ECOLI", "AQUAE", "BACSU", "BACHD", "THIDA") -species("TPX", organisms) -# create a buffer with our proteins in it -mod.buffer("TPX", paste("TPX", organisms, sep="_")) -# set up the buffered activities -basis(c("CO2", "H2O", "NH3", "O2"), "TPX") -a <- affinity(return.buffer=TRUE, T=50) -basis(c("CO2", "H2O", "NH3", "O2"), as.numeric(a[1:4])) -a <- affinity(pH=c(0, 14, 200), T=c(25, 70, 200)) -e <- equilibrate(a, normalize=TRUE) -diagram(e, fill=NULL) -title(main="Thiol peroxidases from bacteria") -text(0.5, 66, describe.basis(thermo$basis[-6,], oneline=TRUE), adj=0) Added: pkg/CHNOSZ/demo/buffer.R =================================================================== --- pkg/CHNOSZ/demo/buffer.R (rev 0) +++ pkg/CHNOSZ/demo/buffer.R 2015-05-19 14:38:46 UTC (rev 87) @@ -0,0 +1,43 @@ +## Buffer + ionization: Metastablilities of +## thiol peroxidases from model bactera +## (ECOLI, BACSU mesophile; AQUAE thermophile, +## THIDA acidophile, BACHD alkaliphile) +basis("CHNOS+") +organisms <- c("ECOLI", "AQUAE", "BACSU", "BACHD", "THIDA") +species("TPX", organisms) +# create a buffer with our proteins in it +mod.buffer("TPX", paste("TPX", organisms, sep="_")) +# set up the buffered activities +basis(c("CO2", "H2O", "NH3", "O2"), "TPX") +a <- affinity(return.buffer=TRUE, T=50) +basis(c("CO2", "H2O", "NH3", "O2"), as.numeric(a[1:4])) +a <- affinity(pH=c(0, 14, 200), T=c(25, 70, 200)) +e <- equilibrate(a, normalize=TRUE) +diagram(e, fill=NULL) +title(main="Thiol peroxidases from bacteria") +text(0.5, 66, describe.basis(thermo$basis[-6,], oneline=TRUE), adj=0) + +## Buffer + ionization: relative stabilities +## of E. coli sigma factors on a T-pH diagram +# (sigma factors 24, 32, 38, 54, 70, i.e. +# RpoE, RpoH, RpoS, RpoN, RpoD) +proteins <- c("RPOE", "RP32", "RPOS", "RP54", "RPOD") +basis("CHNOS+") +basis("pH", 7.4) +# define and set the buffer +mod.buffer("sigma", paste(proteins, "ECOLI", sep="_")) +basis(c("CO2", "NH3", "H2S", "O2"), "sigma") +logact <- affinity(return.buffer=TRUE, T=25) +# Set the activities of the basis species to constants +# corresponding to the buffer, and diagram the relative +# stabilities as a function of T and pH +basis(c("CO2", "NH3", "H2S", "O2"), as.numeric(logact)) +species(paste(proteins, "ECOLI", sep="_")) +a <- affinity(pH=c(5, 10), T=c(10, 40)) +diagram(a, normalize=FALSE, fill="heat") +title(main="Relative stabilities of sigma factors in E. coli") +ptext <- c(describe.property("T", 25), + describe.basis(ibasis=c(2, 6), oneline=TRUE)) +btext <- describe.basis(ibasis=c(1, 3, 4, 5), oneline=TRUE) +legend("bottomleft", legend=c("preset (input values):", + ptext, "buffered (results):", btext), bty="n") Added: pkg/CHNOSZ/demo/diagram.R =================================================================== --- pkg/CHNOSZ/demo/diagram.R (rev 0) +++ pkg/CHNOSZ/demo/diagram.R 2015-05-19 14:38:46 UTC (rev 87) @@ -0,0 +1,17 @@ +## a case where the maximum affinity method doesn't +## reproduce an equilibrium predominance diagram +basis("CHNOS+") +# this adds data for some metabolites in the TCA cycle +# from Dalla-Betta and Schulte, 2010 +add.obigt() +species(c("oxaloacetate-2", "malate-2", "fumarate-2", + "a-ketoglutarate-2", "citrate-3")) +a <- affinity(O2=c(-80, -60), H2O=c(-5, 5)) +diagram(a, dotted=1, fill="heat") +e <- equilibrate(a) +diagram(e, add=TRUE, names=NULL, col="purple") +e <- equilibrate(a, normalize=TRUE) +diagram(e, add=TRUE, names=NULL) +title(main=paste("maximum affinity method (fields)\n", + "equilibrium calculations (lines)")) +data(thermo) Modified: pkg/CHNOSZ/demo/findit.R =================================================================== --- pkg/CHNOSZ/demo/findit.R 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/demo/findit.R 2015-05-19 14:38:46 UTC (rev 87) @@ -1,42 +1,26 @@ -opar <- par(mfrow=c(2, 2)) -# find chemical activities where metastable equilibrium activities of -# selected proteins in P. ubique have high correlation -# with a lognormal distribution (i.e., maximize r of q-q plot) -f <- system.file("extdata/fasta/HTCC1062.faa.xz", package="CHNOSZ") -# search for ribosomal proteins -g <- grep.file(f, "ribosomal") -# read their amino acid compositions from the file -aa <- read.fasta(f, g) -# add these proteins to thermo$protein -ip <- add.protein(aa) -# load a predefined set of uncharged basis species -# (speeds things up as we won't model protein ionization) -basis("CHNOS") -# plot 1: calculated logarithms of chemical activity -# as a function of logfO2 ... a bundle of curves near logfO2 = -77 -a <- affinity(O2=c(-90, -60), iprotein=ip) -e <- equilibrate(a, loga.balance=0, normalize=TRUE) -d <- diagram(e, names=NULL) -title(as.expression("Ribosomal proteins in"~italic("Pelagibacter ubique"))) -db <- describe.basis(ibasis=c(2, 1, 3)) -legend("bottomright", legend=db, bg="white") -# plot 2: calculate q-q correlation coefficient -# the lognormal distribution is favored near logfO2 = -77 -r <- revisit(d, "qqr") -title(main="correlation with a normal distribution") -text(r$xopt, r$optimum, paste(" qqr", round(r$optimum, 3), sep="="), adj=0) -# plot 3: findit... maximize qqr as a function of activities of O2-H2O-NH3-CO2 -f1 <- findit(list(O2=c(-106, -75), H2O=c(-40, -20), CO2=c(-20, 10), NH3=c(-15, 0)), - "qqr", iprotein=ip, niter=12, normalize=TRUE) -title(main="searching 4-D chemical activity space") -# plot 4: q-q plot at the final loga O2, H2O, CO2, NH3 -# higher correlation coefficient than plot 3 -a <- affinity(iprotein=ip) -e <- equilibrate(a, loga.balance=0, normalize=TRUE) -qqr5 <- revisit(e, "qqr")$H -db <- describe.basis(ibasis=c(5, 2, 1, 3)) -legend("bottomright", legend=db) -# plot 5: trajectory of O2, H2O, CO2, NH3, and the -# q-q correlation coefficient in the search -#plot(f1,mar=c(2,5,1,1),mgp=c(4,1,0)) -par(opar) +## findit() calculations for sulfur species +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-")) +# to minimize the standard deviations of the +# logarithms of activity the species +objective <- "SD" +# the variables we are interested in +vars <- list(O2=c(-50, -15), pH=c(0, 14), T=c(275, 375)) +# optimize logfO2 at constant T and pH +f1 <- findit(vars[1], objective, T=325, P=350, niter=3) +title("S.D. of equilibrium log activities of sulfur species") +# optimize logfO2 and pH at constant T +f2 <- findit(vars[1:2], objective, T=325, P=350, res=16, niter=5) +title("S.D. of equilibrium log activities of sulfur species") +# optimize logfO2, pH and T (at constant P ...) +f3 <- findit(vars, objective, P=350, res=10, niter=10) +title("S.D. of equilibrium log activities of sulfur species") +# the results +print(f1.out <- sapply(f1$value, tail, 1)) +print(f2.out <- sapply(f2$value, tail, 1)) +print(f3.out <- sapply(f3$value, tail, 1)) +# with more variables, we should find a greater degree of optimization +stopifnot(f2.out["SD"] < f1.out["SD"]) +stopifnot(f3.out["SD"] < f2.out["SD"]) Added: pkg/CHNOSZ/demo/ionize.R =================================================================== --- pkg/CHNOSZ/demo/ionize.R (rev 0) +++ pkg/CHNOSZ/demo/ionize.R 2015-05-19 14:38:46 UTC (rev 87) @@ -0,0 +1,16 @@ +## ionize.aa(): Contour plots of net charge and ionization properties of LYSC_CHICK +aa <- ip2aa("LYSC_CHICK") +pH <- seq(0, 14, 0.2) +T <- seq(0, 200, 2) +val <- expand.grid(pH=pH, T=T) +par(mfrow=c(2, 2)) +for(X in c("Z", "A", "Cp", "V")) { + Y <- ionize.aa(aa, property=X, pH=val$pH, T=val$T) + contour(pH, T, matrix(Y[, 1], ncol=length(T)), + xlab="pH", ylab=axis.label("T")) + title(main=axis.label(X)) +} +par(mfrow=c(1, 1)) +pu <- par("usr") +text(mean(pu[1:2]), sum(pu[3:4])*0.45, + "additive properties of ionization of LYSC_CHICK") Added: pkg/CHNOSZ/demo/revisit.R =================================================================== --- pkg/CHNOSZ/demo/revisit.R (rev 0) +++ pkg/CHNOSZ/demo/revisit.R 2015-05-19 14:38:46 UTC (rev 87) @@ -0,0 +1,39 @@ +## Demo for revisit(): CV of equilibrium activities of proteins in +## Pelagibacter ubique. +## Also shows use of grep.file(), read.fasta(), add.protein() +f <- system.file("extdata/fasta/HTCC1062.faa.xz", package="CHNOSZ") +# what proteins to select (set to "" for all proteins) +w <- "ribosomal" +# locate entries whose names contain w +j <- grep.file(f, w) +# get the amino acid compositions of these proteins +aa <- read.fasta(f, j) +# add these proteins to CHNOSZ's inventory +ip <- add.protein(aa) +# set up a the chemical system +basis("CHNOS+") +# calculate affinities of formation in logfO2 space +a <- affinity(O2=c(-85, -60), iprotein=ip) +# show the equilibrium activities +opar <- par(mfrow=c(2, 2)) +e <- equilibrate(a, loga.balance=0, normalize=TRUE) +diagram(e, names=NULL) +# make a title +expr <- as.expression(substitute(x~y~"proteins in"~ + italic("P. ubique"), list(x=length(j), y=w))) +mtitle(c("Equilibrium activities of", expr)) +# show the coefficient of variation +revisit(e, "CV") +mtitle(c("CV of equilibrium activities of", expr)) +# calculate affinities in logfO2-logaH2O space +a <- affinity(O2=c(-85,-65), H2O=c(-10,0), iprotein=ip) +# show the predominances +diagram(a, normalize=TRUE, fill="heat") +# calculate the equilibrium activities +e <- equilibrate(a, loga.balance=0, normalize=TRUE) +# show the coefficient of variation +r <- revisit(e, "CV") +stopifnot(r$ix==37) +stopifnot(r$iy==53) +mtitle(c("CV of equilibrium activities of", expr)) +par(opar) Added: pkg/CHNOSZ/demo/wjd.R =================================================================== --- pkg/CHNOSZ/demo/wjd.R (rev 0) +++ pkg/CHNOSZ/demo/wjd.R 2015-05-19 14:38:46 UTC (rev 87) @@ -0,0 +1,31 @@ +## run.wjd with proteins: cell periphery of yeast +# get the proteins in the requested location +y <- yeastgfp("cell.periphery") +# get the amino acid compositions of the proteins +aa <- more.aa(y$protein, "Sce") +# don't use those with NA abundance or sequence +ina <- is.na(y$abundance) | is.na(aa$chains) +aa <- aa[!ina, ] +# let's try normalizing the proteins to single residues +# columns 6:25 are the actual amino acid counts +aa.625 <- aa[, 6:25] +aa[, 6:25] <- aa.625 / rowSums(aa.625) +# add proteins to thermo$protein +add.protein(aa) +# add proteins to thermo$obigt +iobigt <- info(paste(aa$protein, aa$organism, sep="_")) +# use equal initial abundances, with total equal to yeastGFP abundances +Y <- rep(mean(y$abundance[!ina]), length(y$abundance[!ina])) +# run the Gibbs energy minimization +w <- run.wjd(iobigt, Y=Y, imax=100) +# make a log-log plot +plot(log10(y$abundance[!ina]), log10(w$X), xlim=c(1.5, 5), ylim=c(1.5, 5)) +# get the element potentials (tolerating "close enough" to equilibrium) +emu <- equil.potentials(w, tol=1e7) +# then the logarithms of activities of the basis species +basis("CHNOS") +bl <- basis.logact(emu) +# make a title and legend +title(main="calculated vs observed abundances: yeast cell periphery") +basis(names(bl), bl) +legend("topleft", describe.basis(digits=2)) Added: pkg/CHNOSZ/demo/yeastgfp.R =================================================================== --- pkg/CHNOSZ/demo/yeastgfp.R (rev 0) +++ pkg/CHNOSZ/demo/yeastgfp.R 2015-05-19 14:38:46 UTC (rev 87) @@ -0,0 +1,51 @@ +## Oxygen fugacity - activity of H2O predominance +## diagrams for proteologs for 23 YeastGFP localizations +# use old properties of [Met] to reproduce this example +data(thermo) +add.obigt() +# arranged by decreasing metastability: +# order of this list of locations is based on the +# (dis)appearance of species on the current set of diagrams +names <- c("vacuole", "early.Golgi", "ER", "lipid.particle", + "cell.periphery", "ambiguous", "Golgi", "mitochondrion", + "bud", "actin", "cytoplasm", "late.Golgi", + "endosome", "nucleus", "vacuolar.membrane", "punctate.composite", + "peroxisome", "ER.to.Golgi", "nucleolus", "spindle.pole", + "nuclear.periphery", "bud.neck", "microtubule") +nloc <- c(4, 5, 3, 4, 4, 3) +# define the system +basis("CHNOS+") +# get protein names and abundances in each location +gfp <- yeastgfp(names) +# get amino acid compositions of proteins +aa <- more.aa(gfp$protein, "Sce") +# calculate average amino acid compositions +for(i in 1:length(names)) { + avgaa <- aasum(aa[[i]], gfp$abundance[[i]], average=TRUE, protein=names[i]) + add.protein(avgaa) +} +species(names, "Sce") +a <- affinity(H2O=c(-5, 0, 256), O2=c(-80, -66, 256)) +# setup the plot +layout(matrix(c(1, 1,2:7), byrow=TRUE, nrow=4), heights=c(0.7, 3, 3, 3)) +par(mar=c(0, 0, 0, 0)) +plot.new() +text(0.5, 0.5, paste("Subcellular proteins of S. cerevisiae,", + "after Dick, 2009\n"), cex=1.5) +text(0.5, 0.2, describe.basis(ibasis=c(1, 3, 4, 6), oneline=TRUE), cex=1.5) +opar <- par(mar=c(3, 4, 1, 1), xpd=TRUE) +fill <- heat.colors(length(names)) +inames <- 1:length(names) +for(i in 1:length(nloc)) { + diagram(a, normalize=TRUE, names=names[inames], groups=as.list(inames), + fill=fill[inames], cex.axis=0.75, cex.names=1) + label.plot(letters[i]) + title(main=paste(length(inames), "locations")) + # take out the stable species + inames <- inames[-(1:nloc[i])] +} +# return to plot defaults +layout(matrix(1)) +par(opar) +# reset thermodynamic database +data(thermo) Modified: pkg/CHNOSZ/inst/CHECKLIST =================================================================== --- pkg/CHNOSZ/inst/CHECKLIST 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/inst/CHECKLIST 2015-05-19 14:38:46 UTC (rev 87) @@ -41,7 +41,13 @@ - clean up all TODO, XXX, etc. in Rd files (and hopefully R files too) -- ensure all Rd files have \keyword{...} - - update .Rinstignore with any new/deleted files +- ensure all Rd files have \keyword{...} or \concept{...} + - keywords used are standard R keywords: package, utilities + - concepts are as follows: + - Thermodynamic data (thermo, extdata) + - Primary thermodynamic modeling (commonly used functions e.g. subcrt) + - Secondary thermodynamic modeling (less often-used functions e.g. revisit) + - Extra thermodynamic modeling (out-of-workflow functions e.g. transfer) + - Protein thermodynamic modeling (protein-specific functions e.g. ionize.aa) Modified: pkg/CHNOSZ/inst/NEWS =================================================================== --- pkg/CHNOSZ/inst/NEWS 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/inst/NEWS 2015-05-19 14:38:46 UTC (rev 87) @@ -1,3 +1,19 @@ +CHANGES IN CHNOSZ 1.0.5 (2015-05-19) +------------------------------------ + +- Following "Writing R Extensions", remove uncommented \donttest{} code + from Rd files. Some examples have had \donttest{} markup removed + without other modification, some non-representative examples have + been deleted, and some longer examples have been moved to demo files. + +- Some previous \donttest{} examples have been moved to demos 'findit.R' + (replaces old demo), and to new demos 'revisit.R', 'ionize.R', + 'buffer.R', 'wjd.R', 'yeastgfp.R', 'diagram.R'. + +- Rd files now use standard R \keyword{}s ('package' and 'utilities'); + non-standard keywords have been changed to \concept{}s (see CHECKLIST + for description, and CHNOSZ-package.Rd for overview). + CHANGES IN CHNOSZ 1.0.4 (2015-05-18) ------------------------------------ Modified: pkg/CHNOSZ/man/CHNOSZ-package.Rd =================================================================== --- pkg/CHNOSZ/man/CHNOSZ-package.Rd 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/man/CHNOSZ-package.Rd 2015-05-19 14:38:46 UTC (rev 87) @@ -3,9 +3,21 @@ \docType{package} \title{Chemical Thermodynamics and Activity Diagrams} \description{ - CHNOSZ is a package for thermodynamic calculations, primarily with applications in geochemistry and biochemistry. It can be used to calculate the standard molal thermodynamic properties and chemical affinities of reactions relevant to geobiochemical processes, and to visualize the equilibrium activities of species on chemical speciation and predominance diagrams. The package can be used interactively and in batch mode, through the use of R source files containing a sequence of commands. The major features of the package are outlined below, with links to specific help topics in this document, which constitutes the primary technical description of the package. If you are a new user, the \sQuote{anintro} vignette (An introduction to CHNOSZ) may offer a more comfortable way to get started with using the package. +CHNOSZ is a package for thermodynamic calculations, primarily with applications in geochemistry and biochemistry. +It can be used to calculate the standard molal thermodynamic properties and chemical affinities of reactions relevant to geobiochemical processes, and to visualize the equilibrium activities of species on chemical speciation and predominance diagrams. +The package can be used interactively and in batch mode, through the use of R source files containing a sequence of commands. } +\section{Getting Help}{ +The major features of the package are outlined in the Overview given below, with links to specific help topics. +If you are a new user, the \sQuote{anintro} vignette (An introduction to CHNOSZ) may offer a more comfortable way to get started with using the package. +The help pages have been given either keywords or \dQuote{concept index entries} which are visible to \code{\link{help.search}} (aka \code{??}). +Use \code{??primary} to browse the most commonly used functions and \code{??secondary} to see other high-level, but less often-used functions. +\code{??protein} shows functions for working with proteins, and \code{??extra} lists functions with extra functionality (beyond the main workflow). +For help on the thermodynamic database, use \code{??"thermodynamic data"}. +Finally, \code{??utilities} (one of the standard \R keywords) can be used to locate utility functions in the package; these include useful tools for modifying the database, converting units, reading protein sequence files, parsing chemical formulas, etc. +} + \section{Warning}{ All thermodynamic data and examples are provided on an as-is basis. It is up to you to check not only the accuracy of the data, but also the \emph{suitability of the data AND computational techniques} for your problem. @@ -31,7 +43,7 @@ \item File and internet access - read protein sequences from FASTA files, and download sequence information from UniProt (\code{\link{read.fasta}}, \code{\link{protein}}). - \item Equations of state - calculate the standard thermodynamic properties of proteins or other species in the database, and reactions between them, as a function of temperature and pressure (\code{\link{hkf}}, \code{\link{cgl}}), \code{\link{subcrt}}. + \item Equations of state - calculate the standard thermodynamic properties of proteins or other species in the database, and reactions between them, as a function of temperature and pressure (\code{\link{hkf}}, \code{\link{cgl}}, \code{\link{subcrt}}). \item Stoichiometry - count elements in chemical formulas of species, check and optionally correct mass balance of chemical reactions (\code{\link{makeup}}). @@ -41,16 +53,16 @@ \item Chemical activity - calculate the equilibrium activities of the species of interest as a function of the same variables used in the affinity calculation, using a reference state transformation (either the Boltzmann distribution or a reaction matrix approach). (\code{\link{diagram}}, \code{\link{equil.reaction}}, \code{\link{equil.boltzmann}}). - \item Buffer calculations - compute activities of basis species that are determined by a buffer of one or more species (e.g., pyrite-pyrrhotite-magnetite; acetic acid-CO2) (\code{\link{buffer}}). - \item Activity diagrams - plot the equilibrium activities at a single point (as barplots), or as a function of one (species activity diagrams) or two (predominance diagrams) variables (\code{\link{diagram}}). - \item Activity statistics - calculate summary statistics for equilibrium activities of species (\code{\link{revisit}}). + \item Buffer calculations (\bold{experimental}) - compute activities of basis species that are determined by a buffer of one or more species (e.g., pyrite-pyrrhotite-magnetite; acetic acid-CO2) (\code{\link{buffer}}). - \item Multidimensional optimization (new in 0.9-3) - using an iterative gridded optimization, find a combination of chemical activities of basis species, temperature and/or pressure that maximize or minimize the value of a target statistic (\code{\link{findit}}). + \item Activity statistics (\bold{experimental}) - calculate summary statistics for equilibrium activities of species (\code{\link{revisit}}). - \item Mass transfer calculations (experimental) - calculate changes in solution composition and formation of secondary species as a function of incremental reaction of a mineral (or protein) (\code{\link{transfer}}). + \item Multidimensional optimization (new in 0.9-3) (\bold{experimental}) - using an iterative gridded optimization, find a combination of chemical activities of basis species, temperature and/or pressure that maximize or minimize the value of a target statistic (\code{\link{findit}}). + \item Mass transfer calculations (\bold{experimental}) - calculate changes in solution composition and formation of secondary species as a function of incremental reaction of a mineral (or protein) (\code{\link{transfer}}). + } Here are some tips for new users: @@ -59,9 +71,10 @@ \item Install the package from CRAN using \code{\link{install.packages}} or its GUI menu equivalent. \item To begin working with the package after installation, type \code{\link{library}(CHNOSZ)} at the command line (or select the name of the package from the GUI menu). \item Running the examples shown in the various help topics is a great way to become more familiar with the usage of the functions. From \code{\link{help.start}}, select \sQuote{Packages} then \sQuote{CHNOSZ} and then select a function of interest. Individual examples can be run by pasting the example block directly into the R console. - \item Type the command \code{\link{examples}()} to run all of the examples provided in CHNOSZ. This takes about five to ten minutes depending on your system. If things go as expected, the entire set will run without any warnings or errors. - \item Some of the examples require internet or file access or user intervention, or are intentionally written to demonstrate conditions that lead to errors. This offensive code is hidden from \R's package checking mechanism using the \code{dontrun} tag. You can experiment with \code{dontrun} examples by pasting the code to the R console. + \item Type the command \code{\link{examples}()} to run all of the examples provided in CHNOSZ. This takes a few minutes depending on your system. If things go as expected, the entire set will run without any warnings or errors. + \item Some of the examples require internet or file access or user intervention, or are intentionally written to demonstrate conditions that lead to errors. This code is hidden from \R's package checking mechanism using the \code{dontrun} tag. You can experiment with \code{dontrun} examples by pasting the code to the R console. \item A couple of other things to note about the examples: 1) There are some \code{\link{stopifnot}} statements that represent expected outcomes of the calculations; if the expectation is not met, the \code{stopifnot} statement causes an error. These tests are useful for checking the code during package development cycles, but are usually not of critical importance for the set-up of the problem (though they do sometimes employ useful programming tricks). 2) Commands written with an enclosing pair of parentheses \code{(z <- "like this one")} are used to display the result of an assignment operation (\code{\link{<-}}), the value of which is needed later in the calculation. In interactive use, the outermost pair of enclosing parentheses is generally not needed. + \item Also try out \code{\link{demos}()} to run the demos (some of these are longer running examples that are not part of the main help pages). \item To learn how to update the thermodynamic database, look at its documentation in \code{\link{thermo}}. } @@ -84,11 +97,11 @@ } \section{Known Bugs}{ + \code{\link{subcrt}} does not correctly identify the stable polymorph of some minerals at high temperature. + The values generated by \code{\link{buffer}} may not be applied correctly by \code{\link{affinity}} in calculating the affinities of the formation reactions. (The values returned by \code{affinity(..., return.buffer=TRUE)} do appear to be correct in the examples). - \code{\link{subcrt}} does not correctly identify the stable polymorph of some minerals at high temperature. - - \code{\link{diagram}} causes an error while plotting stability field boundaries if the x and y resolutions are not identical. + There is an unidentified inconsistency in \code{\link{transfer}} causing the reaction boundaries in one of the examples (\code{apc("closed")}) to be offset from the stability diagram. OTOH, \code{feldspar("closed")} appears to work correctly. } \examples{ Modified: pkg/CHNOSZ/man/EOSregress.Rd =================================================================== --- pkg/CHNOSZ/man/EOSregress.Rd 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/man/EOSregress.Rd 2015-05-19 14:38:46 UTC (rev 87) @@ -166,4 +166,4 @@ # not consistent with the high-T heat capacities } -\keyword{extra} +\concept{Extra thermodynamic modeling} Modified: pkg/CHNOSZ/man/IAPWS95.Rd =================================================================== --- pkg/CHNOSZ/man/IAPWS95.Rd 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/man/IAPWS95.Rd 2015-05-19 14:38:46 UTC (rev 87) @@ -67,4 +67,4 @@ } -\keyword{secondary} +\concept{Secondary thermodynamic modeling} Modified: pkg/CHNOSZ/man/affinity.Rd =================================================================== --- pkg/CHNOSZ/man/affinity.Rd 2015-05-18 14:21:16 UTC (rev 86) +++ pkg/CHNOSZ/man/affinity.Rd 2015-05-19 14:38:46 UTC (rev 87) @@ -92,7 +92,50 @@ # Standard molal Gibbs energies of reactions affinity(property="G") -\donttest{## amino acid synthesis at low and high temperatures +## 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 @@ -138,49 +181,6 @@ E.units("cal") species(delete=TRUE) -## 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 [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/chnosz -r 87