[CHNOSZ-commits] r123 - in pkg/CHNOSZ: . R inst man tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jan 28 09:29:14 CET 2017


Author: jedick
Date: 2017-01-28 09:29:14 +0100 (Sat, 28 Jan 2017)
New Revision: 123

Removed:
   pkg/CHNOSZ/R/msgout.R
Modified:
   pkg/CHNOSZ/DESCRIPTION
   pkg/CHNOSZ/R/EOSregress.R
   pkg/CHNOSZ/R/affinity.R
   pkg/CHNOSZ/R/buffer.R
   pkg/CHNOSZ/R/diagram.R
   pkg/CHNOSZ/R/equilibrate.R
   pkg/CHNOSZ/R/examples.R
   pkg/CHNOSZ/R/findit.R
   pkg/CHNOSZ/R/info.R
   pkg/CHNOSZ/R/iprotein.R
   pkg/CHNOSZ/R/more.aa.R
   pkg/CHNOSZ/R/mosaic.R
   pkg/CHNOSZ/R/nonideal.R
   pkg/CHNOSZ/R/protein.info.R
   pkg/CHNOSZ/R/read.expr.R
   pkg/CHNOSZ/R/revisit.R
   pkg/CHNOSZ/R/subcrt.R
   pkg/CHNOSZ/R/util.affinity.R
   pkg/CHNOSZ/R/util.data.R
   pkg/CHNOSZ/R/util.fasta.R
   pkg/CHNOSZ/R/util.program.R
   pkg/CHNOSZ/R/util.water.R
   pkg/CHNOSZ/R/water.R
   pkg/CHNOSZ/R/wjd.R
   pkg/CHNOSZ/inst/NEWS
   pkg/CHNOSZ/man/diagram.Rd
   pkg/CHNOSZ/man/util.program.Rd
   pkg/CHNOSZ/tests/testthat/test-equilibrate.R
   pkg/CHNOSZ/tests/testthat/test-protein.info.R
Log:
remove msgout()


Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/DESCRIPTION	2017-01-28 08:29:14 UTC (rev 123)
@@ -1,6 +1,6 @@
-Date: 2017-01-22
+Date: 2017-01-28
 Package: CHNOSZ
-Version: 1.0.8-11
+Version: 1.0.8-13
 Title: Chemical Thermodynamics and Activity Diagrams
 Author: Jeffrey Dick
 Maintainer: Jeffrey Dick <j3ffdick at gmail.com>

Modified: pkg/CHNOSZ/R/EOSregress.R
===================================================================
--- pkg/CHNOSZ/R/EOSregress.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/EOSregress.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -167,7 +167,7 @@
   }
   # plot regression line at a single P
   P <- mean(exptdata$P)
-  msgout("EOSplot: plotting line for P=", P, " bar\n")
+  message("EOSplot: plotting line for P=", P, " bar")
   xs <- seq(xlim[1], xlim[2], length.out=200)
   calc.X <- EOScalc(coefficients, xs, P, ...)
   lines(xs, calc.X, lty=lty)

Modified: pkg/CHNOSZ/R/affinity.R
===================================================================
--- pkg/CHNOSZ/R/affinity.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/affinity.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -65,7 +65,7 @@
     ibufbasis <- which(!can.be.numeric(mybasis$logact))
     if(!is.null(mybasis) & length(ibufbasis) > 0) {
       buffer <- TRUE
-      msgout('affinity: loading buffer species\n')
+      message('affinity: loading buffer species')
       if(!is.null(thermo$species)) is.species <- 1:nrow(thermo$species) else is.species <- numeric()
       is.buffer <- buffer(logK=NULL)
       thermo <- get("thermo", "CHNOSZ")

Modified: pkg/CHNOSZ/R/buffer.R
===================================================================
--- pkg/CHNOSZ/R/buffer.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/buffer.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -22,8 +22,8 @@
       if(state[1]=='') {
         thermo$buffers <- thermo$buffers[-imod,]
         assign("thermo", thermo, "CHNOSZ")
-        msgout(paste('mod.buffer: removed ',c2s(species),' in ',
-          c2s(unique(name)),' buffer.\n',sep=''))
+        message(paste('mod.buffer: removed ',c2s(species),' in ',
+          c2s(unique(name)),' buffer.',sep=''))
       } else {
         if(missing(state)) state <- thermo$buffers$state[imod]
         if(missing(logact)) logact <- thermo$buffers$logact[imod]
@@ -35,11 +35,11 @@
         thermo$buffers$logact[imod] <- logact
         assign("thermo", thermo, "CHNOSZ")
         if(identical(state.old,state) & identical(logact.old,logact)) {
-          msgout(paste('mod.buffer: nothing changed for ',
-            c2s(species),' in ',c2s(unique(name)),' buffer.\n',sep=''))
+          message(paste('mod.buffer: nothing changed for ',
+            c2s(species),' in ',c2s(unique(name)),' buffer.',sep=''))
         } else {
-          msgout(paste('mod.buffer: changed state and/or logact of ',
-            c2s(species),' in ',c2s(unique(name)),' buffer.\n',sep=''))
+          message(paste('mod.buffer: changed state and/or logact of ',
+            c2s(species),' in ',c2s(unique(name)),' buffer.',sep=''))
         }
       }
     } else {
@@ -51,7 +51,7 @@
     t <- data.frame(name=name,species=species,state=state,logact=logact)
     thermo$buffers <- rbind(thermo$buffers,t)
     assign("thermo", thermo, "CHNOSZ")
-    msgout(paste('mod.buffer: added ',c2s(unique(name)),'.\n',sep=''))
+    message(paste('mod.buffer: added ',c2s(unique(name)),'.',sep=''))
   }
   return(invisible(thermo$buffers[thermo$buffers$name %in% name,]))
 }
@@ -163,7 +163,7 @@
   if(is.null(newbasis)) context <- '' else context <- paste(', ',basisnames[newbasis],' (conserved)',sep='')
   reqtext <- paste(c2s(basisnames[ibasisrequested]),' (active)',sep='')
   if(length(ibasisadded)==0) addtext <- '' else addtext <- paste(', ',c2s(basisnames[ibasisadded]),sep='')
-  msgout(paste('buffer: ( ',bufname,' ) for activity of ',reqtext,addtext,context,'\n',sep=''))
+  message(paste('buffer: ( ',bufname,' ) for activity of ',reqtext,addtext,context,sep=''))
   #print(bufbasis)
   # there could still be stuff here (over-defined system?)
   xx <- bufbasis[,-ibasis,drop=FALSE]

Modified: pkg/CHNOSZ/R/diagram.R
===================================================================
--- pkg/CHNOSZ/R/diagram.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/diagram.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -72,7 +72,7 @@
     plotvar <- eout$property
     # we change 'A' to 'A/2.303RT' so the axis label is made correctly
     if(plotvar=="A") plotvar <- "A/2.303RT"
-    msgout(paste("diagram: plotting", plotvar, "from affinity(), divided by balancing coefficients\n"))
+    message(paste("diagram: plotting", plotvar, "from affinity(), divided by balancing coefficients"))
   }
 
   ## number of dimensions (T, P or chemical potentials that are varied)
@@ -85,8 +85,8 @@
     if(normalize & as.residue) stop("'normalize' and 'as.residue' can not both be TRUE")
     if(!eout.is.aout) stop("'normalize' or 'as.residue' can be TRUE only if 'eout' is the output from affinity()")
     if(nd!=2) stop("'normalize' or 'as.residue' can be TRUE only for a 2-D (predominance) diagram")
-    if(normalize) msgout("diagram: using 'normalize' in calculation of predominant species\n")
-    else msgout("diagram: using 'as.residue' in calculation of predominant species\n")
+    if(normalize) message("diagram: using 'normalize' in calculation of predominant species")
+    else message("diagram: using 'as.residue' in calculation of predominant species")
   }
 
   ## sum activities of species together in groups 20090524

Modified: pkg/CHNOSZ/R/equilibrate.R
===================================================================
--- pkg/CHNOSZ/R/equilibrate.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/equilibrate.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -19,7 +19,7 @@
   ispecies <- ispecies[!ina[ispecies]]
   if(length(ispecies)==0) stop("all species have NA affinities")
   if(!identical(ispecies, 1:nspecies)) {
-    msgout(paste("equilibrate: using", length(ispecies), "of", nspecies, "species\n"))
+    message(paste("equilibrate: using", length(ispecies), "of", nspecies, "species"))
     aout$species <- aout$species[ispecies, ]
     aout$values <- aout$values[ispecies]
     n.balance <- n.balance[ispecies]
@@ -27,7 +27,7 @@
   ## number of species that are left
   nspecies <- length(aout$values)
   ## say what the balancing coefficients are
-  if(length(n.balance) < 100) msgout(paste("equilibrate: n.balance is", c2s(n.balance), "\n"))
+  if(length(n.balance) < 100) message(paste("equilibrate: n.balance is", c2s(n.balance)))
   ## logarithm of total activity of the balance
   if(is.null(loga.balance)) {
     # sum up the activities, then take absolute value
@@ -35,15 +35,15 @@
     sumact <- abs(sum(10^aout$species$logact * n.balance))
     loga.balance <- log10(sumact)
   }
-  msgout(paste0("equilibrate: loga.balance is ", loga.balance, "\n"))
+  message(paste0("equilibrate: loga.balance is ", loga.balance))
   ## normalize -- normalize the molar formula by the balance coefficients
   m.balance <- n.balance
   isprotein <- grepl("_", as.character(aout$species$name))
   if(normalize | as.residue) {
     if(any(n.balance < 0)) stop("one or more negative balancing coefficients prohibit using normalized molar formulas")
     n.balance <- rep(1, nspecies)
-    if(as.residue) msgout(paste("equilibrate: using 'as.residue' for molar formulas\n"))
-    else msgout(paste("equilibrate: using 'normalize' for molar formulas\n"))
+    if(as.residue) message(paste("equilibrate: using 'as.residue' for molar formulas"))
+    else message(paste("equilibrate: using 'normalize' for molar formulas"))
   } else m.balance <- rep(1, nspecies)
   ## Astar: the affinities/2.303RT of formation reactions with
   ## formed species in their standard-state activities
@@ -57,7 +57,7 @@
     if(all(n.balance==1)) method <- method[1]
     else method <- method[2]
   }
-  msgout(paste("equilibrate: using", method[1], "method\n"))
+  message(paste("equilibrate: using", method[1], "method"))
   if(method[1]=="boltzmann") loga.equil <- equil.boltzmann(Astar, n.balance, loga.balance)
   else if(method[1]=="reaction") loga.equil <- equil.reaction(Astar, n.balance, loga.balance)
   ## if we normalized the formulas, get back to activities to species
@@ -253,16 +253,16 @@
   if(is.numeric(balance[1])) {
     # a numeric vector
     n.balance <- rep(balance, length.out=length(aout$values))
-    msgout("balance: from numeric argument value\n")
+    message("balance: from numeric argument value")
   } else {
     # "length" for balancing on protein length
     if(identical(balance, "length")) {
       if(!all(isprotein)) stop("length was the requested balance, but some species are not proteins")
       n.balance <- protein.length(aout$species$name)
-      msgout("balance: from protein length\n")
+      message("balance: from protein length")
     } else if(identical(balance, "volume")) {
       n.balance <- info(aout$species$ispecies, check.it=FALSE)$V
-      msgout("balance: from volume")
+      message("balance: from volume")
     } else {
       # is the balance the name of a basis species?
       if(length(ibalance)==0) {
@@ -271,7 +271,7 @@
       }
       # the name of the basis species (need this if we got ibalance which which.balance, above)
       balance <- colnames(aout$species)[ibalance[1]]
-      msgout(paste("balance: from moles of", balance, "in formation reactions\n"))
+      message(paste("balance: from moles of", balance, "in formation reactions"))
       # the balance vector
       n.balance <- aout$species[, ibalance[1]]
       # we check if that all formation reactions contain this basis species

Modified: pkg/CHNOSZ/R/examples.R
===================================================================
--- pkg/CHNOSZ/R/examples.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/examples.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -36,11 +36,11 @@
   # 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
-    msgout("------------\n")
+    message("------------")
     if(which[i]=="dehydration" & !to.file) {
-      msgout("demos: skipping dehydration demo as to.file is FALSE\n")
+      message("demos: skipping dehydration demo as to.file is FALSE")
       next 
-    } else msgout(paste("demos: running '", which[i], "'\n", sep=""))
+    } else message(paste("demos: running '", which[i], "'", sep=""))
     if(to.file & !which[i]=="dehydration") {
       if(which[i]=="bugstab") png(paste(which[i], "%d.png", sep=""), width=700, height=500, pointsize=12)
       else png(paste(which[i], "%d.png", sep=""), width=500, height=500, pointsize=12)

Modified: pkg/CHNOSZ/R/findit.R
===================================================================
--- pkg/CHNOSZ/R/findit.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/findit.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -51,7 +51,7 @@
     else {
       # in the ith loop we consider intervals
       # of rat^(i-1) of the ranges specified at start
-      msgout(paste("optimal:",round(curr,4),"",""))
+      message(paste("optimal:",round(curr,4),"",""), appendLF=FALSE)
       range <- range(lim)
       int <- abs(diff(range)) * rat^(i-1)
       mylims <- c(curr-int/2, curr+int/2)
@@ -61,7 +61,7 @@
       # reverse the order if the axis is reversed
       if(diff(lim) < 0) mylims <- rev(mylims)
     }
-    msgout(paste("new limits:",round(mylims[1],4),round(mylims[2],4),"\n"))
+    message(paste("new limits:",round(mylims[1],4),round(mylims[2],4)))
     return(mylims)
   }
 
@@ -76,14 +76,14 @@
   # loop for the specified number of iterations
   # (todo: loop until an error threshhold is reached)
   for(i in 1:niter) {
-    msgout(paste("\n###### findit: iteration",i,"of",niter,"\n"))
+    message(paste("\n###### findit: iteration",i,"of",niter))
     # to generate the argument list for affinity
     # with the variables specified in lims
     aargs <- list()
     for(j in 1:length(lims)) {
       if(names(lims)[j] %in% rownames(basis)) {
         ibasis <- match(names(lims)[j],rownames(basis))
-        msgout(paste("###",rownames(basis)[ibasis],""))
+        message(paste("###",rownames(basis)[ibasis],""), appendLF=FALSE)
         # the starting search limits for this species
         lim <- lims[[j]]
         # center the search interval on the current values
@@ -93,7 +93,7 @@
         names(myarg) <- rownames(basis)[ibasis]
         aargs <- c(aargs,myarg)
       } else if(names(lims[j]) %in% c("T","P")) {
-        msgout(paste("###",names(lims[j]),""))
+        message(paste("###",names(lims[j]),""), appendLF=FALSE)
         if(names(lims[j])=="T") {
           lim <- lims$T
           curr <- T

Modified: pkg/CHNOSZ/R/info.R
===================================================================
--- pkg/CHNOSZ/R/info.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/info.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -67,8 +67,8 @@
       available.states <- thermo$obigt$state[matches.species]
       if(length(available.states)==1) a.s.verb <- "is" else a.s.verb <- "are"
       a.s.text <- paste("'", available.states, "'", sep="", collapse=" ")
-      msgout("info.character: requested state '", state, "' for ", species, 
-        " but only ", a.s.text, " ", a.s.verb, " available\n")
+      message("info.character: requested state '", state, "' for ", species, 
+        " but only ", a.s.text, " ", a.s.verb, " available")
       return(NA)
     }
     matches.species <- matches.state
@@ -83,8 +83,8 @@
   if(length(ispecies) > length(ispecies.out)) {
     ispecies.other <- ispecies[!ispecies %in% ispecies.out]
     othertext <- paste(thermo$obigt$state[ispecies.other], collapse=", ")
-    msgout("info.character: found ", species, "(", thermo$obigt$state[ispecies.out], 
-      "), also available in ", othertext, "\n")
+    message("info.character: found ", species, "(", thermo$obigt$state[ispecies.out], 
+      "), also available in ", othertext)
   }
   return(ispecies.out)
 }
@@ -113,8 +113,8 @@
   if(length(naGHS)==1) {
     # calculate a single missing one of G, H, or S from the others
     GHS <- as.numeric(GHS(as.character(this$formula), G=this[,8], H=this[,9], S=this[,10]))
-    msgout("info.numeric: ", colnames(this)[8:10][naGHS], " of ",
-      this$name, "(", this$state, ") is NA; set to ", round(GHS[naGHS],2), "\n")
+    message("info.numeric: ", colnames(this)[8:10][naGHS], " of ",
+      this$name, "(", this$state, ") is NA; set to ", round(GHS[naGHS],2))
     this[, naGHS+7] <- GHS[naGHS]
   } 
   # now perform consistency checks for GHS and EOS parameters if check.it=TRUE
@@ -125,7 +125,7 @@
     calcCp <- checkEOS(this, this$state, "Cp")
     # fill in NA heat capacity
     if(!is.na(calcCp) & is.na(this$Cp)) {
-      msgout("info.numeric: Cp of ", this$name, "(", this$state, ") is NA; set by EOS parameters to ", round(calcCp, 2), "\n")
+      message("info.numeric: Cp of ", this$name, "(", this$state, ") is NA; set by EOS parameters to ", round(calcCp, 2))
       this$Cp <- as.numeric(calcCp)
     }
     # check tabulated volumes - only for aq (HKF equation)
@@ -133,7 +133,7 @@
       calcV <- checkEOS(this, this$state, "V")
       # fill in NA volume
       if(!is.na(calcV) & is.na(this$V)) {
-        msgout("info.numeric: V of ", this$name, "(", this$state, ") is NA; set by EOS parameters to ", round(calcV, 2), "\n")
+        message("info.numeric: V of ", this$name, "(", this$state, ") is NA; set by EOS parameters to ", round(calcV, 2))
         this$V <- as.numeric(calcV)
       }
     }
@@ -158,20 +158,20 @@
   if(!is.na(approx.species[1])) {
     # show the names of the species
     if(length(approx.species)==1) {
-      msgout("info.approx: '", species, "' is similar to ", info.text(approx.species), "\n")
+      message("info.approx: '", species, "' is similar to ", info.text(approx.species))
     } else {
       napprox.max <- 25
       exttext <- ":"
       if(length(approx.species) > napprox.max) exttext <- paste(" (showing first ", napprox.max, ")", sep="")
-      msgout("info.approx: '", species, "' is ambiguous; has approximate matches to ", 
-        length(approx.species), " species", exttext, "\n")
+      message("info.approx: '", species, "' is ambiguous; has approximate matches to ", 
+        length(approx.species), " species", exttext)
       printout <- capture.output(print(thermo$obigt$name[head(approx.species, napprox.max)]))
-      msgout(paste(printout, collapse="\n"), "\n")
+      message(paste(printout, collapse="\n"))
     }
     return(approx.species)
   }
   # if we got here there were no approximate matches
-  msgout("info.approx: '", species, "' has no approximate matches\n")
+  message("info.approx: '", species, "' has no approximate matches")
   return(NA)
 }
 
@@ -180,13 +180,13 @@
   ## if no species are requested, summarize the available data  20101129
   thermo <- get("thermo")
   if(is.null(species)) {
-    msgout("info: 'species' is NULL; summarizing information about thermodynamic data...\n")
-    msgout(paste("thermo$obigt has", nrow(thermo$obigt[thermo$obigt$state=="aq", ]), "aqueous,",
-      nrow(thermo$obigt), "total species\n"))
-    msgout(paste("number of literature sources: ", nrow(thermo$refs), ", elements: ",
-      nrow(thermo$element), ", buffers: ", length(unique(thermo$buffers$name)), "\n", sep=""))
-    msgout(paste("number of proteins in thermo$protein is", nrow(thermo$protein), "from",
-      length(unique(thermo$protein$organism)), "organisms\n"))
+    message("info: 'species' is NULL; summarizing information about thermodynamic data...")
+    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",
+      length(unique(thermo$protein$organism)), "organisms"))
     # print information about SGD.csv, ECO.csv, HUM.csv
     more.aa(organism="Sce")
     more.aa(organism="Eco")

Modified: pkg/CHNOSZ/R/iprotein.R
===================================================================
--- pkg/CHNOSZ/R/iprotein.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/iprotein.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -31,7 +31,7 @@
   if(any(is.na(iprotein))) {
     nNA <- sum(is.na(iprotein))
     if(nNA==1) ptext <- "" else ptext <- "s"
-    msgout("iprotein: ", sum(is.na(iprotein)), " protein", ptext, " not matched\n")
+    message("iprotein: ", sum(is.na(iprotein)), " protein", ptext, " not matched")
   }
   return(iprotein)
 }
@@ -88,9 +88,9 @@
     # now the species name
     name <- paste(aa$protein, aa$organism, sep="_")
     # make some noise for the user
-    msgout("aa2eos: found ")
-    msgout(name, " (", f, ", ")
-    msgout(round(length, 3), " residues)\n")
+    message("aa2eos: found ", appendLF=FALSE)
+    message(name, " (", f, ", ", appendLF=FALSE)
+    message(round(length, 3), " residues)")
     ref <- aa$ref
     header <- data.frame(name=name, abbrv=NA, formula=f, state=state, ref1=ref, ref2=NA, date=NA, stringsAsFactors=FALSE)
     eosout <- cbind(header, eos)
@@ -128,7 +128,7 @@
   if(any(ina)) {
     aa <- aa[!ina, ]
     abundance <- abundance[!ina]
-    msgout("aasum: dropped ", sum(ina), " proteins with NA composition and/or abundance\n")
+    message("aasum: dropped ", sum(ina), " proteins with NA composition and/or abundance")
   }
   # we don't know how to deal with different numbers of polypeptide chains
   if(!all(aa$chains==aa$chains[1])) stop("different numbers of polypeptide chains")
@@ -183,7 +183,7 @@
   # return the new rownumbers
   ip <- iprotein(po)
   # make some noise
-  if(!all(ipdup)) msgout("add.protein: added ", nrow(aa)-sum(ipdup), " new protein(s) to thermo$protein\n")
-  if(any(ipdup)) msgout("add.protein: replaced ", sum(ipdup), " existing protein(s) in thermo$protein\n")
+  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/more.aa.R
===================================================================
--- pkg/CHNOSZ/R/more.aa.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/more.aa.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -12,7 +12,7 @@
   mydata <- read.csv(datafile, as.is=TRUE)
   # if protein is not supplied, just give some information about the datafile
   if(is.null(protein)) {
-    msgout("more.aa: ", datapath, " has data for ", nrow(mydata), " proteins\n")
+    message("more.aa: ", datapath, " has data for ", nrow(mydata), " proteins")
     return(invisible())
   }
   # which columns to search for matches
@@ -41,7 +41,7 @@
     inotmatch <- which(is.na(imatch)) 
     if(length(inotmatch) > 0) {
       if(length(inotmatch)==1) verb <- " was" else verb <- " were"
-      msgout("more.aa: ", paste(protein[[i]][inotmatch], collapse=" "), verb, " not matched\n")
+      message("more.aa: ", paste(protein[[i]][inotmatch], collapse=" "), verb, " not matched")
     }
     aa <- data.frame(mydata[imatch, iaa])
     # add the identifying columns

Modified: pkg/CHNOSZ/R/mosaic.R
===================================================================
--- pkg/CHNOSZ/R/mosaic.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/mosaic.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -21,7 +21,7 @@
   # a list where we'll keep the affinity calculations
   affs <- list()
   for(i in seq_along(bases)) {
-    msgout(paste("mosaic: current basis species is", bases[i], "\n", sep=" "))
+    message(paste("mosaic: current basis species is", bases[i], sep=" "))
     # set up argument list: name of swapped-in basis species
     if(!is.na(iswap)) names(myargs)[iswap] <- bases[i]
     # calculate affinities
@@ -46,7 +46,7 @@
     }
   }
   # calculate affinities of formation of basis species
-  msgout(paste("mosaic: combining diagrams for", paste(bases, collapse=" "), "\n", sep=" "))
+  message(paste("mosaic: combining diagrams for", paste(bases, collapse=" "), sep=" "))
   ispecies <- species()$ispecies
   species.logact <- species()$logact
   species(delete=TRUE)

Deleted: pkg/CHNOSZ/R/msgout.R
===================================================================
--- pkg/CHNOSZ/R/msgout.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/msgout.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -1,57 +0,0 @@
-# CHNOSZ/msgout.R
-# msgout() is a variation on message() from base R
-# 20120117 jmd, adapted from...
-
-#  File src/library/base/R/message.R
-#  Part of the R package, http://www.R-project.org
-#
-#  This program is free software; you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  A copy of the GNU General Public License is available at
-#  http://www.r-project.org/Licenses/
-
-
-# a variant of message(), using stdout instead of stderr
-# and with a default setting of appendLF = FALSE
-# this is now used for informative messages in CHNOSZ 
-# (in info() and other functions)
-# so that they show up on the console and in Sweave output, but are suppressed
-# when running the 'test_that' testing scripts
-# (messages produced by cat() would mess up the rows of green dots)
-# the appendLF = FALSE is so that the cat("...\n") statements used previously
-# can all be replaced with msgout without further modification
-msgout <-
-function(..., domain = NULL, appendLF = FALSE)
-{
-    args <- list(...)
-    cond <- if (length(args) == 1L && inherits(args[[1L]], "condition")) {
-        if(nargs() > 1L)
-            warning("additional arguments ignored in message()")
-        args[[1L]]
-    } else {
-        msg <- .makeMessage(..., domain=domain, appendLF = appendLF)
-        call <- sys.call()
-        simpleMessage(msg, call)
-    }
-    defaultHandler <- function(c) {
-        ## Maybe use special connection here?
-        #cat(conditionMessage(c), file=stderr(), sep="")
-        cat(conditionMessage(c), file="", sep="")
-    }
-    withRestarts({
-        signalCondition(cond)
-        ## We don't get to the default handler if the signal
-        ## is handled with a non-local exit, e.g. by
-        ## invoking the muffleMessage restart.
-        defaultHandler(cond)
-    }, muffleMessage = function() NULL)
-    invisible()
-}

Modified: pkg/CHNOSZ/R/nonideal.R
===================================================================
--- pkg/CHNOSZ/R/nonideal.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/nonideal.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -62,7 +62,7 @@
     proptable[[i]] <- myprops
     if(didit) ndid <- ndid + 1
   }
-  if(ndid > 0) msgout(paste('nonideal:',ndid,'species were nonideal\n'))
+  if(ndid > 0) message(paste('nonideal:',ndid,'species were nonideal'))
   return(proptable)
 }
 

Modified: pkg/CHNOSZ/R/protein.info.R
===================================================================
--- pkg/CHNOSZ/R/protein.info.R	2017-01-22 10:27:31 UTC (rev 122)
+++ pkg/CHNOSZ/R/protein.info.R	2017-01-28 08:29:14 UTC (rev 123)
@@ -163,7 +163,7 @@
 
 protein.equil <- function(protein, T=25, loga.protein=0, digits=4) {
   # show the individual steps in calculating metastable equilibrium among proteins
-  msgout("protein.equil: temperature from argument is ", T, " degrees C\n")
+  message("protein.equil: temperature from argument is ", T, " degrees C")
   TK <- convert(T, "K")
   # get the amino acid compositions of the proteins
   aa <- ip2aa(protein)
@@ -179,13 +179,13 @@
     ionize.it <- TRUE
     iword <- "ionized"
     pH <- -thermo$basis$logact[match("H+", rownames(bmat))]
-    msgout("protein.equil: pH from thermo$basis is ", pH, "\n")
+    message("protein.equil: pH from thermo$basis is ", pH)
   }
   # tell the user whose [Met] is in thermo$obigt
   info.Met <- info(info('[Met]', "aq"))
-  msgout("protein.equil: [Met] is from reference ", info.Met$ref1, "\n")
+  message("protein.equil: [Met] is from reference ", info.Met$ref1)
   ## first set of output: show results of calculations for a single protein
-  msgout("protein.equil [1]: first protein is ", pname[1], " with length ", plength[1], "\n")
+  message("protein.equil [1]: first protein is ", pname[1], " with length ", plength[1])
   # standard Gibbs energies of basis species
   G0basis <- unlist(suppressMessages(subcrt(thermo$basis$ispecies, T=T, property="G")$out))
   # coefficients of basis species in formation reactions of proteins
@@ -196,67 +196,67 @@
   G0prot <- unlist(suppressMessages(subcrt(pname, T=T, property="G")$out))
   # standard Gibbs energy of formation reaction of nonionized protein, cal/mol
   G0protform <- G0prot - G0basissum
-  msgout("protein.equil [1]: reaction to form nonionized protein from basis species has G0(cal/mol) of ", signif(G0protform[1], digits), "\n")
+  message("protein.equil [1]: reaction to form nonionized protein from basis species has G0(cal/mol) of ", signif(G0protform[1], digits))
   if(ionize.it) {
     # standard Gibbs energy of ionization of protein, cal/mol
     G0ionization <- suppressMessages(ionize.aa(aa, property="G", T=T, pH=pH))[1, ]
-    msgout("protein.equil [1]: ionization reaction of protein has G0(cal/mol) of ", signif(G0ionization[1], digits), "\n")
+    message("protein.equil [1]: ionization reaction of protein has G0(cal/mol) of ", signif(G0ionization[1], digits))
     # standard Gibbs energy of formation reaction of ionized protein, cal/mol
     G0protform <- G0protform + G0ionization
   }
   # standard Gibbs energy of formation reaction of non/ionized residue equivalents, dimensionless
   G0res.RT <- G0protform/thermo$opt$R/TK/plength
-  msgout("protein.equil [1]: per residue, reaction to form ", iword, " protein from basis species has G0/RT of ", signif(G0res.RT[1], digits), "\n")
+  message("protein.equil [1]: per residue, reaction to form ", iword, " protein from basis species has G0/RT of ", signif(G0res.RT[1], digits))
   # coefficients of basis species in formation reactions of residues
   resbasis <- suppressMessages(protein.basis(aa, T=T, normalize=TRUE))
   # logQstar and Astar/RT
   logQstar <- colSums(t(resbasis) * - thermo$basis$logact)
-  msgout("protein.equil [1]: per residue, logQstar is ", signif(logQstar[1], digits), "\n")
+  message("protein.equil [1]: per residue, logQstar is ", signif(logQstar[1], digits))
   Astar.RT <- -G0res.RT - log(10)*logQstar
-  msgout("protein.equil [1]: per residue, Astar/RT = -G0/RT - 2.303logQstar is ", signif(Astar.RT[1], digits), "\n")
-  if(!is.numeric(protein)) msgout("protein.equil [1]: not comparing calculations with affinity() because 'protein' is not numeric\n")
+  message("protein.equil [1]: per residue, Astar/RT = -G0/RT - 2.303logQstar is ", signif(Astar.RT[1], digits))
+  if(!is.numeric(protein)) message("protein.equil [1]: not comparing calculations with affinity() because 'protein' is not numeric")
   else {
     # for **Astar** we have to set the activities of the proteins to zero, not loga.protein!
     a <- suppressMessages(affinity(iprotein=protein, T=T, loga.protein=0))
     aAstar.RT <- log(10) * as.numeric(a$values) / plength
-    msgout("check it!       per residue, Astar/RT calculated using affinity() is ", signif(aAstar.RT[1], digits), "\n")
+    message("check it!       per residue, Astar/RT calculated using affinity() is ", signif(aAstar.RT[1], digits))
     if(!isTRUE(all.equal(Astar.RT, aAstar.RT, check.attributes=FALSE)))
       stop("Bug alert! The same value for Astar/RT cannot be calculated manually as by using affinity()")
   }
-  if(length(pname)==1) msgout("protein.equil [all]: all done... give me more than one protein for equilibrium calculations\n")
+  if(length(pname)==1) message("protein.equil [all]: all done... give me more than one protein for equilibrium calculations")
   else {
     ## next set of output: equilibrium calculations
-    msgout("protein.equil [all]: lengths of all proteins are ", paste(plength, collapse=" "), "\n")
-    msgout("protein.equil [all]: Astar/RT of all residue equivalents are ", paste(signif(Astar.RT, digits), collapse=" "), "\n")
+    message("protein.equil [all]: lengths of all proteins are ", paste(plength, collapse=" "))
+    message("protein.equil [all]: Astar/RT of all residue equivalents are ", paste(signif(Astar.RT, digits), collapse=" "))
     expAstar.RT <- exp(Astar.RT)
     sumexpAstar.RT <- sum(expAstar.RT)
-    msgout("protein.equil [all]: sum of exp(Astar/RT) of all residue equivalents is ", signif(sumexpAstar.RT, digits), "\n")
+    message("protein.equil [all]: sum of exp(Astar/RT) of all residue equivalents is ", signif(sumexpAstar.RT, digits))
     # boltzmann distribution
     alpha <- expAstar.RT / sumexpAstar.RT    
-    msgout("protein.equil [all]: equilibrium degrees of formation (alphas) of residue equivalents are ", paste(signif(alpha, digits), collapse=" "), "\n")
+    message("protein.equil [all]: equilibrium degrees of formation (alphas) of residue equivalents are ", paste(signif(alpha, digits), collapse=" "))
     # check with equilibrate()
     if(is.numeric(protein)) {
       loga.equil.protein <- unlist(suppressMessages(equilibrate(a, normalize=TRUE))$loga.equil)
       # here we do have to convert from logarithms of activities of proteins to degrees of formation of residue equivalents
       a.equil.residue <- plength*10^loga.equil.protein
       ealpha <- a.equil.residue/sum(a.equil.residue)
-      msgout("check it!     alphas of residue equivalents from equilibrate() are ", paste(signif(ealpha, digits), collapse=" "), "\n")
+      message("check it!     alphas of residue equivalents from equilibrate() are ", paste(signif(ealpha, digits), collapse=" "))
       if(!isTRUE(all.equal(alpha, ealpha, check.attributes=FALSE)))
         stop("Bug alert! The same value for alpha cannot be calculated manually as by using equilibrate()")
     }
     # total activity of residues
     loga.residue <- log10(sum(plength * 10^loga.protein))
-    msgout("protein.equil [all]: for activity of proteins equal to 10^", signif(loga.protein, digits), ", total activity of residues is 10^", signif(loga.residue, digits), "\n")
+    message("protein.equil [all]: for activity of proteins equal to 10^", signif(loga.protein, digits), ", total activity of residues is 10^", signif(loga.residue, digits))
     # equilibrium activities of residues
     loga.residue.equil <- log10(alpha*10^loga.residue)
-    msgout("protein.equil [all]: log10 equilibrium activities of residue equivalents are ", paste(signif(loga.residue.equil, digits), collapse=" "), "\n")
[TRUNCATED]

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


More information about the CHNOSZ-commits mailing list