[CHNOSZ-commits] r724 - in pkg/CHNOSZ: . R inst man vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri May 6 12:09:14 CEST 2022
Author: jedick
Date: 2022-05-06 12:09:14 +0200 (Fri, 06 May 2022)
New Revision: 724
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/add.protein.R
pkg/CHNOSZ/R/examples.R
pkg/CHNOSZ/inst/NEWS.Rd
pkg/CHNOSZ/inst/TODO
pkg/CHNOSZ/man/extdata.Rd
pkg/CHNOSZ/vignettes/customizing.Rmd
Log:
add.protein(): check that new protein IDs are unique
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2022-04-16 09:02:02 UTC (rev 723)
+++ pkg/CHNOSZ/DESCRIPTION 2022-05-06 10:09:14 UTC (rev 724)
@@ -1,6 +1,6 @@
-Date: 2022-04-16
+Date: 2022-05-06
Package: CHNOSZ
-Version: 1.9.9-16
+Version: 1.9.9-17
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/add.protein.R
===================================================================
--- pkg/CHNOSZ/R/add.protein.R 2022-04-16 09:02:02 UTC (rev 723)
+++ pkg/CHNOSZ/R/add.protein.R 2022-05-06 10:09:14 UTC (rev 724)
@@ -60,19 +60,22 @@
thermo <- get("thermo", CHNOSZ)
if(!identical(colnames(aa), colnames(thermo$protein)))
stop("'aa' does not have the same columns as thermo()$protein")
+ # Check that new protein IDs are unique 20220418
+ po <- paste(aa$protein, aa$organism, sep = "_")
+ idup <- duplicated(po)
+ if(any(idup)) stop(paste("some protein IDs are duplicated:", paste(unique(po[idup]), collapse = " ")))
# Normalize by protein length if as.residue = TRUE 20220416
if(as.residue) {
pl <- protein.length(aa)
aa[, 5:25] <- aa[, 5:25] / pl
}
- # Find any protein IDs that are duplicated
- po <- paste(aa$protein, aa$organism, sep = "_")
+ # Find any protein IDs that are already present
ip <- pinfo(po)
- ipdup <- !is.na(ip)
+ ip.present <- !is.na(ip)
# Now we're ready to go
tp.new <- thermo$protein
- if(!all(ipdup)) tp.new <- rbind(tp.new, aa[!ipdup, ])
- if(any(ipdup)) tp.new[ip[ipdup], ] <- aa[ipdup, ]
+ if(!all(ip.present)) tp.new <- rbind(tp.new, aa[!ip.present, ])
+ if(any(ip.present)) tp.new[ip[ip.present], ] <- aa[ip.present, ]
rownames(tp.new) <- NULL
thermo$protein <- tp.new
assign("thermo", thermo, CHNOSZ)
@@ -79,7 +82,7 @@
# Return the new rownumbers
ip <- pinfo(po)
# Make some noise
- if(!all(ipdup)) message("add.protein: added ", nrow(aa)-sum(ipdup), " new protein(s) to thermo()$protein")
- if(any(ipdup)) message("add.protein: replaced ", sum(ipdup), " existing protein(s) in thermo()$protein")
+ if(!all(ip.present)) message("add.protein: added ", nrow(aa)-sum(ip.present), " new protein(s) to thermo()$protein")
+ if(any(ip.present)) message("add.protein: replaced ", sum(ip.present), " existing protein(s) in thermo()$protein")
return(ip)
}
Modified: pkg/CHNOSZ/R/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R 2022-04-16 09:02:02 UTC (rev 723)
+++ pkg/CHNOSZ/R/examples.R 2022-05-06 10:09:14 UTC (rev 724)
@@ -9,7 +9,7 @@
"util.array", "util.data", "util.expression", "util.legend", "util.plot",
"util.fasta", "util.formula", "util.misc", "util.seq", "util.units",
"util.water", "taxonomy", "info", "retrieve", "add.OBIGT", "protein.info",
- "hkf", "water", "IAPWS95", "subcrt", "Berman",
+ "water", "IAPWS95", "subcrt", "Berman",
"makeup", "basis", "swap.basis", "species", "affinity",
"solubility", "equilibrate",
"diagram", "mosaic", "mix",
Modified: pkg/CHNOSZ/inst/NEWS.Rd
===================================================================
--- pkg/CHNOSZ/inst/NEWS.Rd 2022-04-16 09:02:02 UTC (rev 723)
+++ pkg/CHNOSZ/inst/NEWS.Rd 2022-05-06 10:09:14 UTC (rev 724)
@@ -10,7 +10,7 @@
\newcommand{\s}{\ifelse{latex}{\eqn{_{#1}}}{\ifelse{html}{\out{<sub>#1</sub>}}{#1}}}
\newcommand{\S}{\ifelse{latex}{\eqn{^{#1}}}{\ifelse{html}{\out{<sup>#1</sup>}}{^#1}}}
-\section{Changes in CHNOSZ version 1.9.9-16 (2022-04-16)}{
+\section{Changes in CHNOSZ version 1.9.9-17 (2022-04-18)}{
\subsection{MAJOR CHANGE}{
\itemize{
@@ -37,7 +37,7 @@
\item Modify \code{OBIGT(no.organics = TRUE)} to prune the database of
organic compounds \emph{except} CH\s{4}. The ability to remove hundreds
of more complex organic compounds while keeping CH\s{4} is useful for
- some models of inorganic reactions in hydrothermal systems.
+ some models of non-biological reactions in hydrothermal systems.
\item Merge \file{biotic_aq.csv} into \file{organic_aq.csv}.
@@ -65,6 +65,9 @@
\item Add an \strong{as.residue} argument to \code{add.protein()} to
normalize amino acid compositions by protein length.
+ \item Add a check to \code{add.protein()} that all new protein IDs
+ (protein name + organism name) are unique.
+
\item Add function \code{affinity_rank()} to calculate (sums of ranks of
affinities for species in designated groups) normalized by number of
species in each group. The output of the new function can be used by
Modified: pkg/CHNOSZ/inst/TODO
===================================================================
--- pkg/CHNOSZ/inst/TODO 2022-04-16 09:02:02 UTC (rev 723)
+++ pkg/CHNOSZ/inst/TODO 2022-05-06 10:09:14 UTC (rev 724)
@@ -51,3 +51,13 @@
- Add units = c(T.units, P.units, E.units) to output of subcrt()
- Add units = c(T.units, P.units) to output of affinity()
+
+[20220422]
+
+- Re-enter data from PS01 and AP01 (original units in J not cal)
+
+- subcrt(): Don't output properties in HKF region 4
+
+[20220503]
+
+- Don't use palply in read.fasta()
Modified: pkg/CHNOSZ/man/extdata.Rd
===================================================================
--- pkg/CHNOSZ/man/extdata.Rd 2022-04-16 09:02:02 UTC (rev 723)
+++ pkg/CHNOSZ/man/extdata.Rd 2022-05-06 10:09:14 UTC (rev 724)
@@ -30,7 +30,7 @@
\item \code{HWM96_V.csv}, \code{HW97_Cp.csv} Apparent molar volumes and heat capacities of \CH4, \CO2, \H2S, and \NH3 in dilute aqueous solutions reported by Hnědkovský et al., 1996 and Hnědkovský and Wood, 1997. Units are Kelvin, MPa, J/K/mol, and cm3/mol. See \code{demo("AD")} for examples that use these files.
\item \code{SC10_Rainbow.csv} Values of temperature (\degC), pH and logarithms of activity of \CO2, \H2, \NH4plus, \H2S and \CH4 for mixing of seawater and hydrothermal fluid at Rainbow field (Mid-Atlantic Ridge), taken from Shock and Canovas, 2010. See the vignette \viglink{anintro} for an example that uses this file.
\item \code{SS98_Fig5a.csv}, \code{SS98_Fig5b.csv} Values of logarithm of fugacity of \O2 and pH as a function of temperature for mixing of seawater and hydrothermal fluid, digitized from Figs. 5a and b of Shock and Schulte, 1998. See the vignette \viglink{anintro} for an example that uses this file.
- \item \code{rubisco.csv} UniProt IDs for Rubisco, ranges of optimal growth temperature of organisms, domain and name of organisms, and URL of reference for growth temperature, from Dick, 2014. See the vignette \viglink{anintro} for an example that uses this file.
+ \item \code{rubisco.csv} UniProt IDs for Rubisco, ranges of optimal growth temperature of organisms, domain and name of organisms, and URL of reference for growth temperature, from Dick, 2014. See \code{\link{affinity_rank}} and the vignette \viglink{anintro} for examples that use this file.
\item \code{bluered.txt} Blue - light grey - red color palette, computed using \CRANpkg{colorspace}\code{::diverge_hcl(1000,} \code{c = 100, l = c(50, 90), power = 1)}. This is used by \code{\link{ZC.col}}.
\item \code{AD03_Fig1?.csv} Experimental data points digitized from Figure 1 of Akinfiev and Diamond, 2003, used in \code{demo("AD")}.
\item \code{TKSS14_Fig2.csv} Experimental data points digitized from Figure 2 of Tutolo et al., 2014, used in \code{demo("aluminum")}.
Modified: pkg/CHNOSZ/vignettes/customizing.Rmd
===================================================================
--- pkg/CHNOSZ/vignettes/customizing.Rmd 2022-04-16 09:02:02 UTC (rev 723)
+++ pkg/CHNOSZ/vignettes/customizing.Rmd 2022-05-06 10:09:14 UTC (rev 724)
@@ -203,7 +203,7 @@
If an "equation-of-state" or heat capacity coefficient (Columns 14-20) is unknown, use 0.
-- Furthermore, if you would like to assume that `r Cp_` or V is 0, then set it to 0.
+- Furthermore, if you would like to assume that `r Cp_` or `r V_` is 0, then set it to 0.
- Thermodynamic properties will be extrapolated to T > 25 °C and P > 1 bar assuming that `r Cp_` and `r V_` are 0.
More detail on the inner working of the functions: For both HKF and CGL, if at least one parameter for a species is provided, any NA values of the other parameters are taken to be zero.
@@ -226,7 +226,8 @@
- Calculate a missing `r Cp_` or `r V_` from the `r model` parameters, if possible.
- Cross-check `r Cp_` or `r V_` (if present) against the `r model` parameters, if possible, and print a message if the difference is above a threshold (see `?checkEOS`).
-`r NOTE`: `r info_` does **NOT** change the units; the values it displays (including possibly calculated ones) correspond to the `r E.units_` for that species. On the other hand, `r subcrt_` outputs values in the units selected with `r E.units_`.
+`r NOTE`: `r info_` does **NOT** change the units of energy; the values it displays (including possibly calculated ones) correspond to the `r E_units` for that species in OBIGT.
+On the other hand, `r subcrt_` outputs values in the units previously selected with the function `r E.units_`.
<!-- ######## SECTION MARKER ######## -->
## Case study: NA and 0 in the default database
More information about the CHNOSZ-commits
mailing list