[CHNOSZ-commits] r545 - in pkg/CHNOSZ: . R demo inst tests/testthat vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jul 5 10:04:45 CEST 2020


Author: jedick
Date: 2020-07-05 10:04:45 +0200 (Sun, 05 Jul 2020)
New Revision: 545

Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/add.OBIGT.R
   pkg/CHNOSZ/R/add.protein.R
   pkg/CHNOSZ/R/affinity.R
   pkg/CHNOSZ/R/basis.R
   pkg/CHNOSZ/R/berman.R
   pkg/CHNOSZ/R/cgl.R
   pkg/CHNOSZ/R/equilibrate.R
   pkg/CHNOSZ/R/hkf.R
   pkg/CHNOSZ/R/info.R
   pkg/CHNOSZ/R/ionize.aa.R
   pkg/CHNOSZ/R/makeup.R
   pkg/CHNOSZ/R/nonideal.R
   pkg/CHNOSZ/R/palply.R
   pkg/CHNOSZ/R/protein.info.R
   pkg/CHNOSZ/R/species.R
   pkg/CHNOSZ/R/subcrt.R
   pkg/CHNOSZ/R/swap.basis.R
   pkg/CHNOSZ/R/util.affinity.R
   pkg/CHNOSZ/R/util.data.R
   pkg/CHNOSZ/R/util.expression.R
   pkg/CHNOSZ/R/util.fasta.R
   pkg/CHNOSZ/R/util.formula.R
   pkg/CHNOSZ/R/util.plot.R
   pkg/CHNOSZ/R/util.seq.R
   pkg/CHNOSZ/R/util.units.R
   pkg/CHNOSZ/demo/copper.R
   pkg/CHNOSZ/demo/density.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/tests/testthat/test-add.protein.R
   pkg/CHNOSZ/tests/testthat/test-affinity.R
   pkg/CHNOSZ/tests/testthat/test-berman.R
   pkg/CHNOSZ/tests/testthat/test-info.R
   pkg/CHNOSZ/tests/testthat/test-ionize.aa.R
   pkg/CHNOSZ/tests/testthat/test-makeup.R
   pkg/CHNOSZ/tests/testthat/test-species.R
   pkg/CHNOSZ/tests/testthat/test-thermo.R
   pkg/CHNOSZ/tests/testthat/test-util.R
   pkg/CHNOSZ/tests/testthat/test-util.data.R
   pkg/CHNOSZ/vignettes/OBIGT.Rmd
   pkg/CHNOSZ/vignettes/anintro.Rmd
   pkg/CHNOSZ/vignettes/mklinks.sh
Log:
Change thermo$... to thermo()$... in messages and comments


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/DESCRIPTION	2020-07-05 08:04:45 UTC (rev 545)
@@ -1,6 +1,6 @@
-Date: 2020-07-04
+Date: 2020-07-05
 Package: CHNOSZ
-Version: 1.3.6-19
+Version: 1.3.6-20
 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.OBIGT.R
===================================================================
--- pkg/CHNOSZ/R/add.OBIGT.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/add.OBIGT.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -18,7 +18,7 @@
 }
 
 mod.OBIGT <- function(...) {
-  # add or modify species in thermo$OBIGT
+  # add or modify species in thermo()$OBIGT
   thermo <- get("thermo", CHNOSZ)
   # the names and values are in the arguments
   # this works for providing arguments via do.call
@@ -41,7 +41,7 @@
     else ispecies <- suppressMessages(mapply(info.character, 
       species=args$name, check.protein=FALSE, SIMPLIFY=TRUE, USE.NAMES=FALSE))
   }
-  # the column names of thermo$OBIGT, split at the "."
+  # the column names of thermo()$OBIGT, split at the "."
   cnames <- c(do.call(rbind, strsplit(colnames(thermo$OBIGT), ".", fixed=TRUE)), colnames(thermo$OBIGT))
   # the columns we are updating
   icol <- match(names(args), cnames)
@@ -55,7 +55,7 @@
   # the arguments as data frame
   args <- data.frame(args, stringsAsFactors=FALSE)
   if(length(inew) > 0) {
-    # the right number of blank rows of thermo$OBIGT
+    # the right number of blank rows of thermo()$OBIGT
     newrows <- thermo$OBIGT[1:length(inew), ]
     # if we don't know something it's NA
     newrows[] <- NA
@@ -83,7 +83,7 @@
       Z[is.na(Z)] <- 0
       newrows$z.T[isaq] <- Z[isaq]
     }
-    # assign to thermo$OBIGT
+    # assign to thermo()$OBIGT
     thermo$OBIGT <- rbind(thermo$OBIGT, newrows)
     rownames(thermo$OBIGT) <- NULL
     assign("thermo", thermo, CHNOSZ)

Modified: pkg/CHNOSZ/R/add.protein.R
===================================================================
--- pkg/CHNOSZ/R/add.protein.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/add.protein.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -2,7 +2,7 @@
 # calculate properties of proteins 20061109 jmd
 # reorganize protein functions 20120513
 
-# add.protein - add amino acid counts to thermo$protein (returns iprotein)
+# add.protein - add amino acid counts to thermo()$protein (returns iprotein)
 # seq2aa - calculate amino acid counts from a sequence
 # aasum - combine amino acid counts (sum, average, or weighted sum by abundance)
 
@@ -56,10 +56,10 @@
 
 add.protein <- function(aa) {
   # add a properly constructed data frame of 
-  # amino acid counts to thermo$protein
+  # amino acid counts to thermo()$protein
   thermo <- get("thermo", CHNOSZ)
   if(!identical(colnames(aa), colnames(thermo$protein)))
-    stop("'aa' does not have the same columns as thermo$protein")
+    stop("'aa' does not have the same columns as thermo()$protein")
   # find any protein IDs that are duplicated
   po <- paste(aa$protein, aa$organism, sep="_")
   ip <- pinfo(po)
@@ -74,7 +74,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(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")
   return(ip)
 }

Modified: pkg/CHNOSZ/R/affinity.R
===================================================================
--- pkg/CHNOSZ/R/affinity.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/affinity.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -75,7 +75,7 @@
     if(!is.null(iprotein)) {
       # check all proteins are available
       if(any(is.na(iprotein))) stop("`iprotein` has some NA values")
-      if(!all(iprotein %in% 1:nrow(thermo$protein))) stop("some value(s) of `iprotein` are not rownumbers of thermo$protein")
+      if(!all(iprotein %in% 1:nrow(thermo$protein))) stop("some value(s) of `iprotein` are not rownumbers of thermo()$protein")
       # add protein residues to the species list
       resnames <- c("H2O",aminoacids(3))
       # residue activities set to zero;

Modified: pkg/CHNOSZ/R/basis.R
===================================================================
--- pkg/CHNOSZ/R/basis.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/basis.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -89,7 +89,7 @@
 
 ### unexported functions ###
 
-# to add the basis to thermo$OBIGT
+# to add the basis to thermo()$OBIGT
 put.basis <- function(ispecies, logact = rep(NA, length(ispecies))) {
   thermo <- get("thermo", CHNOSZ)
   state <- thermo$OBIGT$state[ispecies]
@@ -120,7 +120,7 @@
   # the second test: matrix is invertible
   if(inherits(tryCatch(solve(comp), error = identity), "error")) 
     stop("singular stoichiometric matrix")
-  # store the basis definition in thermo$basis, including
+  # store the basis definition in thermo()$basis, including
   # both numeric and character data, so we need to use a data frame
   comp <- cbind(as.data.frame(comp), ispecies, logact, state, stringsAsFactors=FALSE)
   # ready to assign to the global thermo object

Modified: pkg/CHNOSZ/R/berman.R
===================================================================
--- pkg/CHNOSZ/R/berman.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/berman.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -31,7 +31,7 @@
         userfileexists <- TRUE
         BDat_user <- read.csv(userfile, as.is=TRUE)
         dat <- rbind(BDat_user, dat)
-      } else stop("the file named in thermo$opt$Berman (", userfile, ") does not exist")
+      } else stop("the file named in thermo()$opt$Berman (", userfile, ") does not exist")
     } 
   }
   # remove duplicates (only the first, i.e. most recent entry is kept)
@@ -46,7 +46,7 @@
   irow <- which(dat$name == name)
   if(length(irow)==0) {
     if(userfileexists) stop("Data for ", name, " not available. Please add it to ", userfile)
-    if(!userfileexists) stop("Data for ", name, " not available. Please add it to your_data_file.csv and run thermo$OBIGT$Berman <<- 'path/to/your_data_file.csv'")
+    if(!userfileexists) stop("Data for ", name, " not available. Please add it to your_data_file.csv and run thermo('opt$Berman' = 'path/to/your_data_file.csv')")
   }
   # the function works fine with just the following assign() call,
   # but an explicit dummy assignment here is used to avoid "Undefined global functions or variables" in R CMD check
@@ -55,7 +55,7 @@
     k4 <- k5 <- k6 <- l1 <- l2 <- v1 <- v2 <- v3 <- v4 <- NA
   # assign values to the variables used below
   for(i in 1:ncol(dat)) assign(colnames(dat)[i], dat[irow, i])
-  # get the entropy of the elements using the chemical formula in thermo$OBIGT
+  # get the entropy of the elements using the chemical formula in thermo()$OBIGT
   if(is.null(thisinfo)) thisinfo <- info(info(name, "cr", check.it=FALSE))
   SPrTr_elements <- convert(entropy(thisinfo$formula), "J")
   # check that G in data file is the G of formation from the elements --> Benson-Helgeson convention (DG = DH - T*DS)

Modified: pkg/CHNOSZ/R/cgl.R
===================================================================
--- pkg/CHNOSZ/R/cgl.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/cgl.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -15,7 +15,7 @@
     # the parameters for *this* species
     PAR <- parameters[k, ]
     if(all(is.na(PAR[9:21]))) {
-      # use Berman equations (parameters not in thermo$OBIGT)
+      # use Berman equations (parameters not in thermo()$OBIGT)
       properties <- berman(PAR$name, T=T, P=P, thisinfo=PAR)
       iprop <- match(property, colnames(properties))
       values <- properties[, iprop, drop=FALSE]
@@ -28,7 +28,7 @@
       values <- data.frame(matrix(NA, ncol = length(property), nrow=ncond))
       colnames(values) <- property
       # a test for availability of heat capacity coefficients (a, b, c, d, e, f)
-      # based on the column assignments in thermo$OBIGT
+      # based on the column assignments in thermo()$OBIGT
       if(any(!is.na(PAR[, 14:19]))) {
         # we have at least one of the heat capacity coefficients;
         # zero out any NA's in the rest (leave lambda and T of transition (columns 19-20) alone)
@@ -85,7 +85,7 @@
         if(property[i] == "H") values[, i] <- PAR$H + intCpdT + intVdP - T*intdVdTdP
         if(property[i] == "S") values[, i] <- PAR$S + intCpdlnT - intdVdTdP
       }
-    } # end calculations using parameters from thermo$OBIGT
+    } # end calculations using parameters from thermo()$OBIGT
     out[[k]] <- values
   } # end loop over species
   return(out)

Modified: pkg/CHNOSZ/R/equilibrate.R
===================================================================
--- pkg/CHNOSZ/R/equilibrate.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/equilibrate.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -349,7 +349,7 @@
   #                             (default if balance is missing and all species are proteins)
   #   1                       - balanced on one mole of species
   #   numeric vector          - user-defined n.balance
-  #   "volume"                - standard-state volume listed in thermo$OBIGT
+  #   "volume"                - standard-state volume listed in thermo()$OBIGT
   # the index of the basis species that might be balanced
   ibalance <- numeric()
   # deal with proteins

Modified: pkg/CHNOSZ/R/hkf.R
===================================================================
--- pkg/CHNOSZ/R/hkf.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/hkf.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -52,7 +52,7 @@
     # loop over each species
     PAR <- parameters[k, ]
     # substitute Cp and V for missing EoS parameters
-    # here we assume that the parameters are in the same position as in thermo$OBIGT
+    # here we assume that the parameters are in the same position as in thermo()$OBIGT
     # we don't need this if we're just looking at solvation properties (Cp_s_var, V_s_var)
     if("n" %in% contrib) {
       # put the heat capacity in for c1 if both c1 and c2 are missing

Modified: pkg/CHNOSZ/R/info.R
===================================================================
--- pkg/CHNOSZ/R/info.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/info.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -10,7 +10,7 @@
 #source("util.data.R")
 
 info <- function(species=NULL, state=NULL, check.it=TRUE) {
-  ## return information for one or more species in thermo$OBIGT
+  ## return information for one or more species in thermo()$OBIGT
   thermo <- get("thermo", CHNOSZ)
   # that should give us the data, not the thermo() function 20190928
   if(is.function(thermo)) stop("CHNOSZ package data is not available; use reset() or library(CHNOSZ) to load it")
@@ -17,11 +17,11 @@
   ## if no species are requested, summarize the available data  20101129
   if(is.null(species)) {
     message("info: 'species' is NULL; summarizing information about thermodynamic data...")
-    message(paste("thermo$OBIGT has", nrow(thermo$OBIGT[thermo$OBIGT$state=="aq", ]), "aqueous,",
+    message(paste("thermo()$OBIGT has", nrow(thermo$OBIGT[thermo$OBIGT$state=="aq", ]), "aqueous,",
       nrow(thermo$OBIGT), "total species"))
     message(paste("number of literature sources: ", nrow(thermo$refs), ", elements: ",
       nrow(thermo$element), ", buffers: ", length(unique(thermo$buffers$name)), sep=""))
-    message(paste("number of proteins in thermo$protein is", nrow(thermo$protein), "from",
+    message(paste("number of proteins in thermo()$protein is", nrow(thermo$protein), "from",
       length(unique(thermo$protein$organism)), "organisms"))
     return()
   }
@@ -77,14 +77,14 @@
 }
 
 info.character <- function(species, state=NULL, check.protein=TRUE) {
-  # returns the rownumbers of thermo$OBIGT having an exact match of 'species' to
-  # thermo$OBIGT$[species|abbrv|formula] or NA otherwise
-  # a match to thermo$OBIGT$state is also required if 'state' is not NULL
+  # returns the rownumbers of thermo()$OBIGT having an exact match of 'species' to
+  # thermo()$OBIGT$[species|abbrv|formula] or NA otherwise
+  # a match to thermo()$OBIGT$state is also required if 'state' is not NULL
   # (first occurence of a match to species is returned otherwise)
   thermo <- get("thermo", CHNOSZ)
   # find matches for species name, abbreviation or formula
   matches.species <- thermo$OBIGT$name==species | thermo$OBIGT$abbrv==species | thermo$OBIGT$formula==species
-  # since thermo$OBIGT$abbrv contains NAs, convert NA results to FALSE
+  # since thermo()$OBIGT$abbrv contains NAs, convert NA results to FALSE
   matches.species[is.na(matches.species)] <- FALSE
   # turn it in to no match if it's a protein in the wrong state
   ip <- pinfo(species)
@@ -98,7 +98,7 @@
     if(check.protein) {
       # did we find a protein? add its properties to OBIGT
       if(!is.na(ip)) {
-        # here we use a default state from thermo$opt$state
+        # here we use a default state from thermo()$opt$state
         if(is.null(state)) state <- thermo$opt$state
         # add up protein properties
         eos <- protein.OBIGT(ip, state=state)
@@ -182,7 +182,7 @@
   # species indices must be in range
   ispeciesmax <- nrow(thermo$OBIGT)
   if(ispecies > ispeciesmax | ispecies < 1) 
-    stop(paste("species index", ispecies, "not found in thermo$OBIGT\n"))
+    stop(paste("species index", ispecies, "not found in thermo()$OBIGT\n"))
   # remove scaling factors on EOS parameters depending on state
   # use new OBIGT2eos function here
   this <- OBIGT2eos(this, this$state)

Modified: pkg/CHNOSZ/R/ionize.aa.R
===================================================================
--- pkg/CHNOSZ/R/ionize.aa.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/ionize.aa.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -17,7 +17,7 @@
   # turn charges into a matrix with as many rows as T,P,pH conditions
   charges <- c(-1, -1, -1, 1, 1, 1, -1, 1, -1)
   charges <- matrix(rep(charges, lmax), nrow=lmax, byrow=TRUE)
-  # the rownumbers of the ionizable groups in thermo$OBIGT
+  # the rownumbers of the ionizable groups in thermo()$OBIGT
   neutral <- c("[Cys]", "[Asp]", "[Glu]", "[His]", "[Lys]", "[Arg]", "[Tyr]", "[AABB]", "[AABB]")
   charged <- c("[Cys-]","[Asp-]","[Glu-]","[His+]","[Lys+]","[Arg+]","[Tyr-]","[AABB+]","[AABB-]")
   ineutral <- info(neutral, "aq")

Modified: pkg/CHNOSZ/R/makeup.R
===================================================================
--- pkg/CHNOSZ/R/makeup.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/makeup.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -58,7 +58,7 @@
   }
   # if the formula argument is numeric,
   # and if the thermo object is available,
-  # get the formula of that numbered species from thermo$OBIGT
+  # get the formula of that numbered species from thermo()$OBIGT
   if(exists("CHNOSZ")) {
     thermo <- get("thermo", CHNOSZ)
     if(is.numeric(formula)) formula <- thermo$OBIGT$formula[formula]
@@ -89,7 +89,7 @@
   # complain if there are any elements that look strange
   if(exists("CHNOSZ")) {
     are.elements <- names(out) %in% thermo$element$element
-    if(!all(are.elements)) warning(paste("element(s) not in thermo$element:", 
+    if(!all(are.elements)) warning(paste("element(s) not in thermo()$element:", 
       paste(names(out)[!are.elements], collapse=" ") ))
   }
   # done!

Modified: pkg/CHNOSZ/R/nonideal.R
===================================================================
--- pkg/CHNOSZ/R/nonideal.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/nonideal.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -30,7 +30,7 @@
 
   # check if we have a valid method setting
   if(!method %in% c("Alberty", "Bdot", "Bdot0", "bgamma", "bgamma0")) {
-    if(missing(method)) stop("invalid setting (", thermo$opt$nonideal, ") in thermo$opt$nonideal")
+    if(missing(method)) stop("invalid setting (", thermo$opt$nonideal, ") in thermo()$opt$nonideal")
     else stop("invalid method (", thermo$opt$nonideal, ")")
   }
 

Modified: pkg/CHNOSZ/R/palply.R
===================================================================
--- pkg/CHNOSZ/R/palply.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/palply.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -1,7 +1,7 @@
 # CHNOSZ/palply.R
 
 palply <- function(varlist, X, FUN, ...) {
-  # a wrapper function to run parLapply if length(X) >= thermo$opt$paramin
+  # a wrapper function to run parLapply if length(X) >= thermo()$opt$paramin
   # and package 'parallel' is available, otherwise run lapply
   if(length(X) >= get("thermo", CHNOSZ)$opt$paramin) {
     # Use option mc.cores to choose an appropriate cluster size.

Modified: pkg/CHNOSZ/R/protein.info.R
===================================================================
--- pkg/CHNOSZ/R/protein.info.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/protein.info.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -1,7 +1,7 @@
 # CHNOSZ/protein.info.R
 
 # calculate formulas and summarize properties of proteins
-# pinfo: find rownumber in thermo$protein
+# pinfo: find rownumber in thermo()$protein
 # protein.length: lengths of the indicated proteins
 # protein.formula: chemical makeup of the indicated proteins
 # protein.OBIGT: perform group additivity calculations
@@ -11,15 +11,15 @@
 pinfo <- function(protein, organism=NULL, residue=FALSE, regexp=FALSE) {
   # return the `protein` (possibly per residue) for:
   #   dataframe `protein`
-  # return the rownumber(s) of thermo$protein for:
+  # return the rownumber(s) of thermo()$protein for:
   #   character `protein`, e.g. LYSC_CHICK
   #   character `protein` and `organism`, e.g. 'LYSC', 'CHICK'
-  # return the row(s) of thermo$protein (possibly per residue) for:
+  # return the row(s) of thermo()$protein (possibly per residue) for:
   #   numeric `protein` (the rownumber itself)
   if(is.data.frame(protein)) out <- protein
   if(is.numeric(protein)) {
     t_p <- get("thermo", CHNOSZ)$protein
-    # drop NA matches to thermo$protein
+    # drop NA matches to thermo()$protein
     iproteins <- 1:nrow(t_p)
     protein[!protein %in% iproteins] <- NA
     # get amino acid counts
@@ -37,7 +37,7 @@
       if(!is.null(organism)) iorganism <- grepl(organism, t_p$organism)
       iprotein <- which(iprotein & iorganism)
     } else {
-      # search for protein or protein_organism in thermo$protein
+      # search for protein or protein_organism in thermo()$protein
       t_p_names <- paste(t_p$protein, t_p$organism, sep="_")
       if(is.null(organism)) my_names <- protein
       else my_names <- paste(protein, organism, sep="_")
@@ -77,12 +77,12 @@
   groups <- c("AABB", colnames(aa)[6:25], bbgroup)
   # put brackets around the group names
   groups <- paste("[", groups, "]", sep="")
-  # the rownumbers of the groups in thermo$OBIGT
+  # the rownumbers of the groups in thermo()$OBIGT
   groups_state <- paste(groups, state)
   OBIGT <- get("thermo", CHNOSZ)$OBIGT
   OBIGT_state <- paste(OBIGT$name, OBIGT$state)
   igroup <- match(groups_state, OBIGT_state)
-  # the properties are in columns 9-21 of thermo$OBIGT
+  # the properties are in columns 9-21 of thermo()$OBIGT
   groupprops <- OBIGT[igroup, 9:21]
   # the elements in each of the groups
   groupelements <- i2A(igroup)
@@ -163,7 +163,7 @@
   # get some general information about the proteins
   pname <- paste(aa$protein, aa$organism, sep="_")
   plength <- protein.length(aa)
-  # use thermo$basis to decide whether to ionize the proteins
+  # use thermo()$basis to decide whether to ionize the proteins
   thermo <- get("thermo", CHNOSZ)
   ionize.it <- FALSE
   iword <- "nonionized"

Modified: pkg/CHNOSZ/R/species.R
===================================================================
--- pkg/CHNOSZ/R/species.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/species.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -5,7 +5,7 @@
 species <- function(species=NULL, state=NULL, delete=FALSE, index.return=FALSE) {
   # 20080925 default quiet=TRUE 20101003 default quiet=FALSE
   # 20120128 remove 'quiet' argument (messages can be hidden with suppressMessages())
-  # 20120523 return thermo$species instead of rownumbers therein, and remove message showing thermo$species
+  # 20120523 return thermo()$species instead of rownumbers therein, and remove message showing thermo()$species
   thermo <- get("thermo", CHNOSZ)
   ## argument processing
   # we can't deal with NA species
@@ -72,15 +72,15 @@
     ispecies <- match(species, thermo$species$name)
     # if all species names match, and logact is given, re-call the function with the species indices
     if(!any(is.na(ispecies)) & !is.null(logact)) return(species(ispecies, state=logact, index.return=index.return))
-    # look for species in thermo$OBIGT
+    # look for species in thermo()$OBIGT
     iOBIGT <- suppressMessages(info(species, state))
-    # since that could have updated thermo$OBIGT (with proteins), re-read thermo
+    # since that could have updated thermo()$OBIGT (with proteins), re-read thermo
     thermo <- get("thermo", CHNOSZ)
     # check if we got all the species
     ina <- is.na(iOBIGT)
     if(any(ina)) stop(paste("species not available:", paste(species[ina], collapse=" ")))
   } else {
-    # if species is numeric and low number it refers to the index of existing species, else to thermo$OBIGT
+    # if species is numeric and low number it refers to the index of existing species, else to thermo()$OBIGT
     nspecies <- nrow(thermo$species)
     if(is.null(thermo$species)) nspecies <- 0
     if(max(species) > nspecies) iOBIGT <- species
@@ -117,7 +117,7 @@
     rownames(thermo$species) <- seq(nrow(thermo$species))
   } else {
     # update activities or states of existing species
-    # first get the rownumbers in thermo$species
+    # first get the rownumbers in thermo()$species
     if(is.numeric(species[1])) {
       ispecies <- species
       # if state and logact are both NULL we don't do anything but return the selected species

Modified: pkg/CHNOSZ/R/subcrt.R
===================================================================
--- pkg/CHNOSZ/R/subcrt.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/subcrt.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -135,9 +135,9 @@
       # get the species index for a named species
       if(!can.be.numeric(species[i])) si <- info.character(species[i], state[i])
       else {
-        # check that a numeric argument is a rownumber of thermo$OBIGT
+        # check that a numeric argument is a rownumber of thermo()$OBIGT
         si <- as.numeric(species[i])
-        if(!si %in% 1:nrow(thermo$OBIGT)) stop(paste(species[i], "is not a row number of thermo$OBIGT"))
+        if(!si %in% 1:nrow(thermo$OBIGT)) stop(paste(species[i], "is not a row number of thermo()$OBIGT"))
       }
       # that could have the side-effect of adding a protein; re-read thermo
       thermo <- get("thermo", CHNOSZ)
@@ -351,7 +351,7 @@
         # if we are considering multiple phases, and if this phase is cr2 or higher, check if we're below the transition temperature
         if(length(iphases) > length(ispecies) & i > 1) {
           if(!(reaction$state[i] %in% c('liq','cr','gas')) & reaction$name[i-1] == reaction$name[i]) {
-            # after add.OBIGT("SUPCRT92"), quartz cr and cr2 are not next to each other in thermo$OBIGT,
+            # after add.OBIGT("SUPCRT92"), quartz cr and cr2 are not next to each other in thermo()$OBIGT,
             # so use iphases[i-1] here, not iphases[i]-1  20181107
             Ttr <- Ttr(iphases[i-1], iphases[i], P=P, dPdT = dPdTtr(iphases[i-1], iphases[i]))
             if(all(is.na(Ttr))) next

Modified: pkg/CHNOSZ/R/swap.basis.R
===================================================================
--- pkg/CHNOSZ/R/swap.basis.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/swap.basis.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -16,7 +16,7 @@
   # matrix part of the basis definition
   basis.mat <- basis.elements(basis)
   # the standard Gibbs energies of the basis species
-  # don't take it from thermo$OBIGT, even at 25 degC, because G for H2O is NA there
+  # don't take it from thermo()$OBIGT, even at 25 degC, because G for H2O is NA there
   # the sapply(..., "[", 1) is needed to get the first value, in case subcrt appends a polymorph column (i.e. for S(cr))  20171105
   G <- unlist(sapply(subcrt(basis$ispecies, T=T, property="G")$out, "[", 1))
   # chemical potentials of the basis species
@@ -39,7 +39,7 @@
   # check that elements of basis.mat and emu are identical
   if(any(is.na(ielem))) stop(paste("element(s)", paste(names(emu)[is.na(ielem)], collapse=" "), "not found in basis"))
   # the standard Gibbs energies of the basis species
-  # don't take it from thermo$OBIGT, even at 25 degC, because G for H2O is NA there
+  # don't take it from thermo()$OBIGT, even at 25 degC, because G for H2O is NA there
   # the sapply(..., "[", 1) is needed to get the first value, in case subcrt appends a polymorph column (i.e. for S(cr))  20171105
   G <- unlist(sapply(subcrt(basis$ispecies, T=T, property="G")$out, "[", 1))
   # the chemical potentials of the basis species in equilibrium
@@ -89,7 +89,7 @@
   if(is.numeric(species2)) ispecies2 <- species2
   else ispecies2 <- suppressMessages(info(species2))
   if(is.na(ispecies2) | is.list(ispecies2))
-    stop(paste("a species matching '",species2,"' is not available in thermo$OBIGT",sep=""))
+    stop(paste("a species matching '",species2,"' is not available in thermo()$OBIGT",sep=""))
   # try to load the new basis species
   ispecies <- oldbasis$ispecies
   ispecies[ib] <- ispecies2

Modified: pkg/CHNOSZ/R/util.affinity.R
===================================================================
--- pkg/CHNOSZ/R/util.affinity.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/util.affinity.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -207,7 +207,7 @@
       # which species are proteins
       isprotein <- grepl("_", myspecies$name)
       if(any(isprotein)) {
-        # the rownumbers in thermo$protein
+        # the rownumbers in thermo()$protein
         ip <- pinfo(myspecies$name[isprotein])
         # get the affinity of ionization
         iHplus <- match("H+", rownames(mybasis))

Modified: pkg/CHNOSZ/R/util.data.R
===================================================================
--- pkg/CHNOSZ/R/util.data.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/util.data.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -28,7 +28,7 @@
     # remove the last (URL) component
     #x$URL <- NULL
     x <- x[1:5]
-    # count the number of times each source is cited in thermo$OBIGT
+    # count the number of times each source is cited in thermo()$OBIGT
     # e.g. if key is "Kel60" we match "Kel60 [S92]" but not "Kel60.1 [S92]"
     # http://stackoverflow.com/questions/6713310/how-to-specify-space-or-end-of-string-and-space-or-start-of-string
     # we also have to escape keys with "+" signs
@@ -394,7 +394,7 @@
 
 ### unexported functions ###
 
-# Take a data frame in the format of thermo$OBIGT of one or more rows,
+# Take a data frame in the format of thermo()$OBIGT of one or more rows,
 #   remove scaling factors from equations-of-state parameters,
 #   and apply new column names depending on the state.
 # And convert energy units from J to cal (used by subcrt()) 20190530

Modified: pkg/CHNOSZ/R/util.expression.R
===================================================================
--- pkg/CHNOSZ/R/util.expression.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/util.expression.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -15,7 +15,7 @@
   if(use.makeup) {
     # the counts of elements in the species:
     # here we don't care too much if an "element" is a real element
-    # (listed in thermo$element), so we suppress warnings
+    # (listed in thermo()$element), so we suppress warnings
     elements <- suppressWarnings(try(makeup(species), TRUE))
   } else elements <- split.formula(species)
   # if species can't be parsed as a chemical formula, we don't do the formula formatting

Modified: pkg/CHNOSZ/R/util.fasta.R
===================================================================
--- pkg/CHNOSZ/R/util.fasta.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/util.fasta.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -8,7 +8,7 @@
   # read.fasta in package seqinR
   # value of 'iseq' is what sequences to read (default is all)
   # value of 'ret' determines format of return value:
-  #   count: amino acid composition (same columns as thermo$protein, can be used by add.protein)
+  #   count: amino acid composition (same columns as thermo()$protein, can be used by add.protein)
   #        or nucleic acid base composition (A-C-G-T)
   #   seq: amino acid sequence
   #   fas: fasta entry
@@ -155,7 +155,7 @@
   else if(type=="DNA") letts <- c("A", "C", "G", "T")
   else if(type=="RNA") letts <- c("A", "C", "G", "U")
   else stop(paste("unknown sequence type", type))
-  # the numerical positions of the letters in alphabetical order (i.e. for amino acids, same order as in thermo$protein)
+  # the numerical positions of the letters in alphabetical order (i.e. for amino acids, same order as in thermo()$protein)
   ilett <- match(letts, LETTERS)
   # the letters A-Z represented by raw values
   rawAZ <- charToRaw("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

Modified: pkg/CHNOSZ/R/util.formula.R
===================================================================
--- pkg/CHNOSZ/R/util.formula.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/util.formula.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -17,7 +17,7 @@
     # convert formulas into a stoichiometric matrix with elements on the columns
     A <- t(sapply(msz, c))
     # add names from character argument
-    # or from thermo$OBIGT for numeric argument
+    # or from thermo()$OBIGT for numeric argument
     if(is.numeric(formula[1])) rownames(A) <- get("thermo", CHNOSZ)$OBIGT$name[formula]
     else rownames(A) <- formula
   }
@@ -64,7 +64,7 @@
   formula <- i2A(get.formula(formula))
   ielem <- match(colnames(formula), thermo$element$element)
   if(any(is.na(ielem))) stop(paste("element(s)",
-    colnames(formula)[is.na(ielem)], "not available in thermo$element"))
+    colnames(formula)[is.na(ielem)], "not available in thermo()$element"))
   mass <- as.numeric(formula %*% thermo$element$mass[ielem])
   return(mass)
 }
@@ -75,7 +75,7 @@
   formula <- i2A(get.formula(formula))
   ielem <- match(colnames(formula), thermo$element$element)
   if(any(is.na(ielem))) warning(paste("element(s)",
-    paste(colnames(formula)[is.na(ielem)], collapse=" "), "not available in thermo$element"))
+    paste(colnames(formula)[is.na(ielem)], collapse=" "), "not available in thermo()$element"))
   # entropy per atom
   Sn <- thermo$element$s[ielem] / thermo$element$n[ielem]
   # if there are any NA values of entropy, put NA in the matrix, then set the value to zero
@@ -157,7 +157,7 @@
 
 # Accept a numeric or character argument; the character argument can be mixed
 #   (i.e. include quoted numbers). as.numeric is tested on every value; numeric values
-#   are then interpreted as species indices in the thermodynamic database (rownumbers of thermo$OBIGT),
+#   are then interpreted as species indices in the thermodynamic database (rownumbers of thermo()$OBIGT),
 #   and the chemical formulas for those species are returned.
 # Values that can not be converted to numeric are returned as-is.
 get.formula <- function(formula) {
@@ -168,17 +168,17 @@
   if(is.data.frame(formula)) return(as.matrix(formula))
   # return the values in the argument, or chemical formula(s) 
   # for values that are species indices
-  # for numeric values, get the formulas from those rownumbers of thermo$OBIGT
+  # for numeric values, get the formulas from those rownumbers of thermo()$OBIGT
   i <- as.integer.nowarn(formula)
-  # we can't have more than the number of rows in thermo$OBIGT
+  # we can't have more than the number of rows in thermo()$OBIGT
   thermo <- get("thermo", CHNOSZ)
   iover <- i > nrow(thermo$OBIGT)
   iover[is.na(iover)] <- FALSE
   if(any(iover)) stop(paste("species number(s)",paste(i[iover],collapse=" "),
-    "not available in thermo$OBIGT"))
+    "not available in thermo()$OBIGT"))
   # we let negative numbers pass as formulas
   i[i < 0] <- NA
-  # replace any species indices with formulas from thermo$OBIGT
+  # replace any species indices with formulas from thermo()$OBIGT
   formula[!is.na(i)] <- thermo$OBIGT$formula[i[!is.na(i)]]
   return(formula)
 }

Modified: pkg/CHNOSZ/R/util.plot.R
===================================================================
--- pkg/CHNOSZ/R/util.plot.R	2020-07-04 09:22:47 UTC (rev 544)
+++ pkg/CHNOSZ/R/util.plot.R	2020-07-05 08:04:45 UTC (rev 545)
@@ -6,7 +6,7 @@
   las=1,xline=NULL, grid = "", col.grid = "gray", ...) {
   # start a new plot with some customized settings
   thermo <- get("thermo", CHNOSZ)
-  # 20120523 store the old par in thermo$opar
+  # 20120523 store the old par in thermo()$opar
   if(is.null(thermo$opar)) {
     thermo$opar <- par(no.readonly=TRUE)
     assign("thermo", thermo, CHNOSZ)

Modified: pkg/CHNOSZ/R/util.seq.R
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/chnosz -r 545


More information about the CHNOSZ-commits mailing list