[CHNOSZ-commits] r670 - in pkg/CHNOSZ: . R man tests/testthat vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 8 01:01:18 CEST 2021


Author: jedick
Date: 2021-04-08 01:01:18 +0200 (Thu, 08 Apr 2021)
New Revision: 670

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/R/util.fasta.R
   pkg/CHNOSZ/man/diagram.Rd
   pkg/CHNOSZ/tests/testthat/test-mosaic.R
   pkg/CHNOSZ/vignettes/equilibrium.Rmd
Log:
A few small changes


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2021-04-07 11:12:28 UTC (rev 669)
+++ pkg/CHNOSZ/DESCRIPTION	2021-04-07 23:01:18 UTC (rev 670)
@@ -1,6 +1,6 @@
-Date: 2021-04-07
+Date: 2021-04-08
 Package: CHNOSZ
-Version: 1.4.0-39
+Version: 1.4.0-40
 Title: Thermodynamic Calculations and Diagrams for Geochemistry
 Authors at R: c(
     person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),

Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R	2021-04-07 11:12:28 UTC (rev 669)
+++ pkg/CHNOSZ/R/diagram.R	2021-04-07 23:01:18 UTC (rev 670)
@@ -197,8 +197,9 @@
     # some additional steps for affinity values, but not for equilibrated activities
     if(eout.is.aout) {
       for(i in 1:length(pv)) {
-        # TODO: see vignette for an explanation for how this is normalizing
-        # the formulas in a predominance calculation
+        # TODO: The equilibrium.Rmd vignette shows predominance diagrams using
+        # 'normalize' and 'as.residue' settings that are consistent with equilibrate(),
+        # but what is the derivation of these equations?
         if(normalize) pv[[i]] <- (pv[[i]] + eout$species$logact[i] / n.balance[i]) - log10(n.balance[i])
         else if(as.residue) pv[[i]] <- pv[[i]] + eout$species$logact[i] / n.balance[i]
       }

Modified: pkg/CHNOSZ/R/util.fasta.R
===================================================================
--- pkg/CHNOSZ/R/util.fasta.R	2021-04-07 11:12:28 UTC (rev 669)
+++ pkg/CHNOSZ/R/util.fasta.R	2021-04-07 23:01:18 UTC (rev 670)
@@ -109,7 +109,7 @@
   # download protein sequence information from UniProt
   iprotein <- numeric()
   # construct the initial URL
-  proteinURL <- paste("http://www.uniprot.org/uniprot/", protein, sep="")
+  proteinURL <- paste("https://www.uniprot.org/uniprot/", protein, sep="")
   message("uniprot.aa: trying ", proteinURL, " ...", appendLF=FALSE)
   # try loading the URL, hiding any warnings
   oldopt <- options(warn=-1)
@@ -131,7 +131,7 @@
   accession.number <- tail(strsplit(linkhead, "/uniprot/", fixed=TRUE)[[1]], 1)
   message(" accession ", accession.number, " ...")
   # now download the fasta file
-  fastaURL <- paste("http://www.uniprot.org/uniprot/", accession.number, ".fasta", sep="")
+  fastaURL <- paste("https://www.uniprot.org/uniprot/", accession.number, ".fasta", sep="")
   URLstuff <- readLines(fastaURL)
   # get the header information / show  the user
   header <- URLstuff[[1]]

Modified: pkg/CHNOSZ/man/diagram.Rd
===================================================================
--- pkg/CHNOSZ/man/diagram.Rd	2021-04-07 11:12:28 UTC (rev 669)
+++ pkg/CHNOSZ/man/diagram.Rd	2021-04-07 23:01:18 UTC (rev 670)
@@ -170,8 +170,8 @@
 The old behavior does not respect \code{lty}; instead, the style of the boundary lines on 2-D diagrams can be altered by supplying one or more non-zero integers in \code{dotted}, which indicates the fraction of line segments to omit; a value of \samp{1} or NULL for \code{dotted} has the effect of not drawing the boundary lines.
 
 \code{normalize} and \code{as.residue} apply only to the 2-D diagrams, and only when \code{eout} is the output from \code{affinity}.
-With \code{normalize}, the activity boundaries are calculated as between the residues of the species (the species divided by the balance coefficients), then the activities are rescaled to the whole species formulas.
-With \code{as.residue}, the activity boundaries are calculated as between the residues of the species, and no rescaling is performed.
+With \code{normalize}, the activity boundaries are calculated between the residues of the species (the species divided by the balance coefficients), then the activities are rescaled to the whole species formulas.
+With \code{as.residue}, the activity boundaries are calculated between the residues of the species, and no rescaling is performed.
 }
 
 \section{Activity Coefficients}{

Modified: pkg/CHNOSZ/tests/testthat/test-mosaic.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-mosaic.R	2021-04-07 11:12:28 UTC (rev 669)
+++ pkg/CHNOSZ/tests/testthat/test-mosaic.R	2021-04-07 23:01:18 UTC (rev 670)
@@ -7,20 +7,20 @@
   basis(c("CO2", "H2O", "NH3", "O2"), c(0, 0, 0, 0))
   species(c("alanine", "glycine"))
   a25 <- affinity()
-  # this is a degenerate case because we only allow NH3 to swap for NH3, and CO2 for CO2;
+  # this is a no-op case because we only allow NH3 to swap for NH3, and CO2 for CO2;
   # however it still exercises the affinity scaling and summing code
-  m1_25 <- mosaic("NH3", "CO2")
+  m1_25 <- mosaic(list("NH3", "CO2"))
   # this failed before we divided by loga.tot to get _relative_ abundances of basis species in mosaic.R
   expect_equal(a25$values, m1_25$A.species$values)
   # the next call failed when which.pmax(), called by diagram(), choked on a list of length one
-  m2_25 <- mosaic("NH3", "CO2", blend = FALSE)
+  m2_25 <- mosaic(list("NH3", "CO2"), blend = FALSE)
   expect_equal(a25$values, m2_25$A.species$values)
   # make sure the function works when all affinities are NA
   a500 <- suppressWarnings(affinity(T=500))
   # using blend=TRUE was failing prior to version 1.1.3-37
-  m1_500 <- suppressWarnings(mosaic("NH3", "CO2", T=500))
+  m1_500 <- suppressWarnings(mosaic(list("NH3", "CO2"), T=500))
   expect_equal(a500$values, m1_500$A.species$values)
-  m2_500 <- suppressWarnings(mosaic("NH3", "CO2", blend = FALSE, T=500))
+  m2_500 <- suppressWarnings(mosaic(list("NH3", "CO2"), blend = FALSE, T=500))
   expect_equal(a500$values, m2_500$A.species$values)
 })
 

Modified: pkg/CHNOSZ/vignettes/equilibrium.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/equilibrium.Rmd	2021-04-07 11:12:28 UTC (rev 669)
+++ pkg/CHNOSZ/vignettes/equilibrium.Rmd	2021-04-07 23:01:18 UTC (rev 670)
@@ -423,14 +423,18 @@
   balancing coefficients, which become exponents on activities in the
   expression for the activity quotient (*Q*).
 
-* In Diagrams **C** and **D**, the chemical formulas of all the proteins are
-  *normalized*, or divided by the protein length.  Writing the reactions in
-  terms of these "residue equivalents" shows the possibility of similar
-  abundances of proteins in metastable equilibrium.
+* In Diagrams **C** and **D**, the chemical formulas of the proteins are
+  *normalized*, or divided by the protein length, before the equilibration or
+  maximum affinity calculation.  However, the final diagram is not drawn for
+  activities of these "residue equivalents", but for rescaled activities of
+  whole proteins. Because of the rescaling, the fields of the shorter METJA and
+  METVO proteins grow at the expense of the longer BACLI protein.
 
 * Diagrams **E** and **F** are like the normalization calculation, except that
   the final diagram is drawn for the residue equivalents and not the whole
-  proteins.  The activities of residues are higher than those of the proteins.
+  proteins.  The predominance diagram is the same as that for non-normalized
+  reactions (**A**), but the equilibrium activities of residues are higher than
+  those of the proteins.
 
 ## Example 3: Normalization
 



More information about the CHNOSZ-commits mailing list