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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat May 10 13:02:43 CEST 2025


Author: jedick
Date: 2025-05-10 13:02:43 +0200 (Sat, 10 May 2025)
New Revision: 895

Added:
   pkg/CHNOSZ/demo/protein_A.R
   pkg/CHNOSZ/demo/protein_Cp.R
   pkg/CHNOSZ/demo/rubisco_Zc.R
Removed:
   pkg/CHNOSZ/vignettes/rubisco.svg
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/demo/00Index
   pkg/CHNOSZ/inst/NEWS.Rd
   pkg/CHNOSZ/man/examples.Rd
Log:
Extract protein demos from old anintro.Rmd


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2025-05-10 09:10:43 UTC (rev 894)
+++ pkg/CHNOSZ/DESCRIPTION	2025-05-10 11:02:43 UTC (rev 895)
@@ -1,6 +1,6 @@
 Date: 2025-05-10
 Package: CHNOSZ
-Version: 2.1.0-66
+Version: 2.1.0-67
 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/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R	2025-05-10 09:10:43 UTC (rev 894)
+++ pkg/CHNOSZ/R/examples.R	2025-05-10 11:02:43 UTC (rev 895)
@@ -35,7 +35,7 @@
   "mosaic", "copper", "arsenic", "solubility", "gold", "contour", "sphalerite", "minsol",
   "Shh", "saturation", "adenine", "DEW", "lambda", "potassium", "TCA", "aluminum",
   "AD", "comproportionation", "Pourbaix", "E_coli", "yttrium", "rank.affinity", "uranyl",
-  "sum_S", "MgATP"),
+  "sum_S", "MgATP", "protein_Cp", "protein_A", "rubisco_Zc"),
   save.png = FALSE) {
   # Run one or more demos from CHNOSZ with ask = FALSE, and return the value of the last one
   out <- NULL

Modified: pkg/CHNOSZ/demo/00Index
===================================================================
--- pkg/CHNOSZ/demo/00Index	2025-05-10 09:10:43 UTC (rev 894)
+++ pkg/CHNOSZ/demo/00Index	2025-05-10 11:02:43 UTC (rev 895)
@@ -35,3 +35,6 @@
 yttrium         logK.to.OBIGT fits at 800 and 1000 bar and Y speciation in NaCl solution at varying pH
 uranyl          Total (carbonate|sulfate)-pH diagrams for uranyl species
 MgATP           Speciation of ATP with H+ and Mg+2
+protein_Cp      Compare calculated and experimental Cp of proteins
+protein_A       Affinity of ionization of proteins
+rubisco_Zc      Zc of Rubisco vs optimal growth temperature

Added: pkg/CHNOSZ/demo/protein_A.R
===================================================================
--- pkg/CHNOSZ/demo/protein_A.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/protein_A.R	2025-05-10 11:02:43 UTC (rev 895)
@@ -0,0 +1,23 @@
+# CHNOSZ/demo/protein_A.R
+# Calculate affinity of ionization of proteins
+# 20250510 demo extracted from anintro.Rmd
+
+library(CHNOSZ)
+
+ip <- pinfo(c("CYC_BOVIN", "LYSC_CHICK", "MYG_PHYCA", "RNAS1_BOVIN"))
+basis("CHNOS+")
+a_ion <- affinity(pH = c(0, 14), iprotein = ip)
+basis("CHNOS")
+a_nonion <- affinity(iprotein = ip)
+plot(c(0, 14), c(50, 300), xlab = "pH", ylab = quote(italic(A/2.303*RT)), type = "n")
+for(i in 1:4) {
+  A_ion <- as.numeric(a_ion$values[[i]])
+  A_nonion <- as.numeric(a_nonion$values[[i]])
+  lines(a_ion$vals[[1]], A_ion - A_nonion, col=i)
+}
+legend("topright", legend = a_ion$species$name,
+       col = 1:4, lty = 1, bty = "n", cex = 0.9)
+title("Affinity of ionization of proteins", font.main = 1)
+
+# The affinity is always positive, showing the strong energetic drive for ionization of proteins in aqueous solution.
+# The degrees of ionization of amino and carboxyl groups increase at low and high pH, respectively, giving rise to the U-shaped lines.

Added: pkg/CHNOSZ/demo/protein_Cp.R
===================================================================
--- pkg/CHNOSZ/demo/protein_Cp.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/protein_Cp.R	2025-05-10 11:02:43 UTC (rev 895)
@@ -0,0 +1,24 @@
+# CHNOSZ/demo/protein_Cp.R
+# Compare calculated and experimental Cp of proteins
+# 20250510 demo extracted from anintro.Rmd
+
+library(CHNOSZ)
+
+# Experimental values from Privalov and Makhatadze (1990)
+PM90 <- read.csv(system.file("extdata/misc/PM90.csv", package = "CHNOSZ"))
+plength <- protein.length(colnames(PM90)[2:5])
+Cp_expt <- t(t(PM90[, 2:5]) / plength)
+matplot(PM90[, 1], Cp_expt, type = "p", pch = 19,
+        xlab = axis.label("T"), ylab = axis.label("Cp0"), ylim = c(110, 280))
+for(i in 1:4) {
+  pname <- colnames(Cp_expt)[i]
+  aq <- subcrt(pname, "aq", T = seq(0, 150))$out[[1]]
+  cr <- subcrt(pname, "cr", T = seq(0, 150))$out[[1]]
+  lines(aq$T, aq$Cp / plength[i], col = i)
+  lines(cr$T, cr$Cp / plength[i], col = i, lty = 2)
+}
+legend("right", legend = colnames(Cp_expt),
+       col = 1:4, pch = 19, lty = 1, bty = "n", cex = 0.9)
+legend("bottomright", legend = c("experimental", "calculated (aq)",
+       "calculated (cr)"), lty = c(NA, 1, 2), pch = c(19, NA, NA), bty = "n")
+title("Calculated and experimental Cp of proteins", font.main = 1)

Added: pkg/CHNOSZ/demo/rubisco_Zc.R
===================================================================
--- pkg/CHNOSZ/demo/rubisco_Zc.R	                        (rev 0)
+++ pkg/CHNOSZ/demo/rubisco_Zc.R	2025-05-10 11:02:43 UTC (rev 895)
@@ -0,0 +1,62 @@
+# CHNOSZ/demo/rubisco_Zc.R
+# Plot Zc of Rubisco vs optimal growth temperature
+# 20250510 demo extracted from anintro.Rmd
+
+library(CHNOSZ)
+
+datfile <- system.file("extdata/misc/rubisco.csv", package = "CHNOSZ")
+fastafile <- system.file("extdata/protein/rubisco.fasta", package = "CHNOSZ")
+dat <- read.csv(datfile)
+aa <- canprot::read_fasta(fastafile)
+Topt <- (dat$T1 + dat$T2) / 2
+idat <- match(dat$ID, substr(aa$protein, 4, 9))
+aa <- aa[idat, ]
+ZC <- ZC(protein.formula(aa))
+pch <- match(dat$domain, c("E", "B", "A")) - 1
+col <- match(dat$domain, c("A", "B", "E")) + 1
+plot(Topt, ZC, pch = pch, cex = 2, col = col,
+     xlab = expression(list(italic(T)[opt], degree*C)),
+     ylab = expression(italic(Z)[C]))
+text(Topt, ZC, rep(1:9, 3), cex = 0.8)
+abline(v = c(36, 63), lty = 2, col = "grey")
+legend("topright", legend = c("Archaea", "Bacteria", "Eukaryota"),
+       pch = c(2, 1, 0), col = 2:4, pt.cex = 2)
+title("Average oxidation state of carbon in Rubisco vs.\noptimal growth temperature of organisms", font.main = 1)
+
+# The old code for making the SVG image
+# - RSVGTipsDevice is no longer on CRAN: https://cran.r-project.org/web/packages/RSVGTipsDevice/index.html
+# - I got a compilation error trying to install it with remotes::install_github("cran/RSVGTipsDevice")
+
+if(require(RSVGTipsDevice, quietly = TRUE)) {
+  datfile <- system.file("extdata/misc/rubisco.csv", package = "CHNOSZ")
+  fastafile <- system.file("extdata/protein/rubisco.fasta", package = "CHNOSZ")
+  dat <- read.csv(datfile)
+  aa <- canprot::read_fasta(fastafile)
+  Topt <- (dat$T1 + dat$T2) / 2
+  idat <- match(dat$ID, substr(aa$protein, 4, 9))
+  aa <- aa[idat, ]
+  ZC <- ZC(protein.formula(aa))
+  pch <- match(dat$domain, c("E", "B", "A")) - 1
+  col <- match(dat$domain, c("A", "B", "E")) + 1
+  # Because the tooltip titles in the SVG file are shown by recent browsers,
+  # we do not need to draw the tooltips explicitly, so set toolTipMode=0
+  devSVGTips("rubisco_Zc.svg", toolTipMode = 0, title = "Rubisco")
+  par(cex=1.4)
+  # Unfortunately, plotmath can't be used with devSVGTips,
+  # so axis labels here don't contain italics.
+  plot(Topt, ZC, type = "n", xlab = "T, °C", ylab = "ZC")
+  n <- rep(1:9, 3)
+  for(i in seq_along(Topt)) {
+    # adjust cex to make the symbols look the same size
+    cex <- ifelse(pch[i] == 1, 2.5, 3.5)
+    points(Topt[i], ZC[i], pch = pch[i], cex = cex, col = col[i])
+    URL <- dat$URL[i]
+    setSVGShapeURL(URL, target = "_blank")
+    setSVGShapeContents(paste0("<title>", dat$species[i], "</title>"))
+    text(Topt[i], ZC[i], n[i], cex = 1.2)
+  }
+  abline(v = c(36, 63), lty = 2, col = "grey")
+  legend("topright", legend = c("Archaea", "Bacteria", "Eukaryota"),
+         pch = c(2, 1, 0), col = 2:4, cex = 1.5, pt.cex = c(3, 2.3, 3), bty = "n")
+  dev.off()
+}

Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd	2025-05-10 09:10:43 UTC (rev 894)
+++ pkg/CHNOSZ/inst/NEWS.Rd	2025-05-10 11:02:43 UTC (rev 895)
@@ -15,7 +15,7 @@
 \newcommand{\Cp}{\ifelse{latex}{\eqn{C_P}}{\ifelse{html}{\out{<I>C<sub>P</sub></I>}}{Cp}}}
 \newcommand{\DG0}{\ifelse{latex}{\eqn{{\Delta}G^{\circ}}}{\ifelse{html}{\out{Δ<I>G</I>°}}{ΔG°}}}
 
-\section{Changes in CHNOSZ version 2.1.0-65 (2025-05-10)}{
+\section{Changes in CHNOSZ version 2.1.0-67 (2025-05-10)}{
 
   \subsection{OBIGT DEFAULT DATA}{
     \itemize{
@@ -117,6 +117,10 @@
       \file{CHNOSZ_equilibrium.Rmd} in the [JMDplots
       package](https://github.com/jedick/JMDplots).
 
+      \item Add \file{demo/protein_A.R}, \file{demo/protein_Cp.R}, and
+      \file{demo/rubisco_Zc.R}, extracted from old version of
+      \file{anintro.Rmd}.
+
     }
   }
 

Modified: pkg/CHNOSZ/man/examples.Rd
===================================================================
--- pkg/CHNOSZ/man/examples.Rd	2025-05-10 09:10:43 UTC (rev 894)
+++ pkg/CHNOSZ/man/examples.Rd	2025-05-10 11:02:43 UTC (rev 895)
@@ -19,7 +19,7 @@
     "contour", "sphalerite", "minsol", "Shh", "saturation",
     "adenine", "DEW", "lambda", "potassium", "TCA", "aluminum", "AD",
     "comproportionation", "Pourbaix", "E_coli", "yttrium", "rank.affinity",
-    "uranyl", "sum_S", "MgATP"),
+    "uranyl", "sum_S", "MgATP", "protein_Cp", "protein_A", "rubisco_Zc"),
     save.png = FALSE)
 }
 
@@ -69,6 +69,9 @@
     \item{uranyl}{Total (carbonate|sulfate)-pH diagrams for uranyl species (Migdisov et al., 2024)}
     \item{sum_S}{Summed molality of S species and solubility contours for iron and gold (Skirrow and Walshe, 2002)}
     \item{MgATP}{Speciation of ATP with H+ and Mg+2 (Alberty, 2003)}
+    \item{protein_Cp}{Compare calculated and experimental Cp of proteins (Privalov and Makhatadze, 1990)}
+    \item{protein_A}{Affinity of ionization of proteins}
+    \item{rubisco_Zc}{Zc of Rubisco vs optimal growth temperature}
   }
 
 For either function, if \code{save.png} is TRUE, the plots are saved in \code{\link{png}} files whose names begin with the names of the help topics or demos.
@@ -140,6 +143,8 @@
 
 Pourbaix, M. (1974) \emph{Atlas of Electrochemical Equilibria in Aqueous Solutions}, NACE, Houston, TX and CEBELCOR, Brussels. \url{https://www.worldcat.org/oclc/563921897}
 
+Privalov, P. L. and Makhatadze, G. I. (1990) Heat capacity of proteins. II. Partial molar heat capacity of the unfolded polypeptide chain of proteins: Protein unfolding effects. \emph{J. Mol. Biol.} \bold{213}, 385--391. \doi{10.1016/S0022-2836(05)80198-6}
+
 Schulte, M. D. and Shock, E. L. (1995) Thermodynamics of Strecker synthesis in hydrothermal systems. \emph{Orig. Life Evol. Biosph.} \bold{25}, 161--173. \doi{10.1007/BF01581580}
 
 Shock, E. L. and Koretsky, C. M. (1995) Metal-organic complexes in geochemical processes: Estimation of standard partial molal thermodynamic properties of aqueous complexes between metal cations and monovalent organic acid ligands at high pressures and temperatures. \emph{Geochim. Cosmochim. Acta} \bold{59}, 1497--1532. \doi{10.1016/0016-7037(95)00058-8}

Deleted: pkg/CHNOSZ/vignettes/rubisco.svg
===================================================================
(Binary files differ)



More information about the CHNOSZ-commits mailing list