[CHNOSZ-commits] r60 - in pkg/CHNOSZ: . R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 9 13:25:41 CET 2014
Author: jedick
Date: 2014-01-09 13:25:40 +0100 (Thu, 09 Jan 2014)
New Revision: 60
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/revisit.R
pkg/CHNOSZ/inst/NEWS
pkg/CHNOSZ/man/revisit.Rd
Log:
revisit() gains loga0 argument for calculating activity ratios
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2013-12-14 23:56:57 UTC (rev 59)
+++ pkg/CHNOSZ/DESCRIPTION 2014-01-09 12:25:40 UTC (rev 60)
@@ -1,6 +1,6 @@
Date: 2013-12-15
Package: CHNOSZ
-Version: 1.0.2-1
+Version: 1.0.2-2
Title: Chemical Thermodynamics and Activity Diagrams
Author: Jeffrey M. Dick
Maintainer: Jeffrey Dick <j3ffdick at gmail.com>
Modified: pkg/CHNOSZ/R/revisit.R
===================================================================
--- pkg/CHNOSZ/R/revisit.R 2013-12-14 23:56:57 UTC (rev 59)
+++ pkg/CHNOSZ/R/revisit.R 2014-01-09 12:25:40 UTC (rev 60)
@@ -47,7 +47,7 @@
return(list(x=x, y=y))
}
-revisit <- function(eout, objective = "CV", loga2 = NULL, ispecies = NULL,
+revisit <- function(eout, objective = "CV", loga2 = NULL, loga0 = NULL, ispecies = NULL,
col = par("fg"), yline = 2, ylim = NULL, cex = par("cex"),
lwd = par("lwd"), mar = NULL, side = 1:4, xlim = NULL, labcex = 0.6,
pch = 1, main = NULL, plot.it = NULL, add = FALSE, plot.optval = TRUE,
@@ -100,13 +100,19 @@
if(nd==0) loga1 <- t(loga1)
# convert infinite values to NA
loga1[is.infinite(loga1)] <- NA
+ # if we have loga0, calculate the base-2 log ratio (loga1/loga0)
+ base <- 10
+ if(!is.null(loga0)) {
+ loga1 <- t(t(loga1) - loga0) * log2(10)
+ base <- 2
+ }
# remove logarithms if necessary
if(any(grepl("loga1", objargs))) a1 <- loga1
- else a1 <- 10^loga1
+ else a1 <- base^loga1
}
# these objectives also depend on reference activities (a2/loga2):
- # richness, RMSD, CVRMSD, spearman, pearson, DGtr
+ # RMSD, CVRMSD, spearman, pearson, DGtr
if(any(grepl("a2", objargs))) {
# check that all needed arguments are present
if(is.null(loga2)) stop(paste("loga2 must be supplied for", objective))
@@ -117,9 +123,10 @@
length(loga2), ") than list in eout (", ncol(loga1), ")", sep=""))
# remove logarithms if necessary
if(any(grepl("loga2", objargs))) a2 <- loga2
- else a2 <- 10^loga2
+ else a2 <- base^loga2
}
+
# construct array of values: Astar (for DGtr)
if(any(grepl("Astar", objargs))) {
Astar <- eout$Astar[ispecies]
Modified: pkg/CHNOSZ/inst/NEWS
===================================================================
--- pkg/CHNOSZ/inst/NEWS 2013-12-14 23:56:57 UTC (rev 59)
+++ pkg/CHNOSZ/inst/NEWS 2014-01-09 12:25:40 UTC (rev 60)
@@ -1,4 +1,4 @@
-CHANGES IN CHNOSZ 1.0.2-1 (2013-12-15)
+CHANGES IN CHNOSZ 1.0.2-2 (2013-12-17)
--------------------------------------
- Updated extdata/protein/Sce.csv.xz using Saccharomyces Genome Database
@@ -27,7 +27,10 @@
- In revisit(), extend ranges of axes of scatter plots.
+- revisit() has new argument loga0, a single vector of base-10 logarithms of
+ species activities used to calculate the base-2 log ratio ( log2(a1/a0) ).
+
CHANGES IN CHNOSZ 1.0.1 (2013-07-04)
------------------------------------
Modified: pkg/CHNOSZ/man/revisit.Rd
===================================================================
--- pkg/CHNOSZ/man/revisit.Rd 2013-12-14 23:56:57 UTC (rev 59)
+++ pkg/CHNOSZ/man/revisit.Rd 2014-01-09 12:25:40 UTC (rev 60)
@@ -10,11 +10,11 @@
}
\usage{
- revisit(eout, objective = "CV", loga2 = NULL, ispecies = NULL,
- col = par("fg"), yline = 2, ylim = NULL, cex = par("cex"),
- lwd = par("lwd"), mar = NULL, side = 1:4, xlim = NULL, labcex = 0.6,
- pch = 1, main = NULL, plot.it = NULL, add = FALSE, plot.optval = TRUE,
- style.2D = "contour")
+ revisit(eout, objective = "CV", loga2 = NULL, loga0 = NULL,
+ ispecies = NULL, col = par("fg"), yline = 2, ylim = NULL,
+ cex = par("cex"), lwd = par("lwd"), mar = NULL, side = 1:4,
+ xlim = NULL, labcex = 0.6, pch = 1, main = NULL, plot.it = NULL,
+ add = FALSE, plot.optval = TRUE, style.2D = "contour")
optimal.index(z, objective)
extremes(z, objective)
}
@@ -22,7 +22,8 @@
\arguments{
\item{eout}{list, output from \code{\link{equilibrate}}, containing logarithms of activities of species}
\item{objective}{character, name of \code{\link{objective}} function}
- \item{loga2}{numeric array, reference values of logarithm of activities}
+ \item{loga2}{numeric vector, reference values of logarithm of activities}
+ \item{loga0}{numeric vector, logarithm of activities to calculate activity ratios}
\item{ispecies}{numeric, which species to consider}
\item{col}{character, color to use for points or lines}
\item{yline}{numeric, margin line for y-axis label}
@@ -44,13 +45,16 @@
\details{
-Most commonly, the output of \code{\link{equilibrate}} is used as the value for \code{eout}.
+\code{revisit} is used to calculate the variation in the equilibrium logarithms of chemical activity (supplied in \code{eout}) or to compare the calculated values with reference (e.g. measured) values (\code{loga2}).
+Usually, the output of \code{\link{equilibrate}} is used as the value for \code{eout}.
The type of calculation is indicated by \code{objective}, giving the name of an \code{\link{objective}} function.
-The list of logarithms of chemical activities in \code{eout$loga.equil} is passed as \code{loga1} to the objective function.
-If the objective function has an argument \code{a1} instead of \code{loga1}, the activities instead of their logarithms are passed.
-Reference logarithms of activities, for those objective functions that require them, are supplied in the \code{loga2} argument.
+Generally, \code{loga2} is expressed in base-10 logarithms.
+However, if \code{loga0} (base 10) is supplied, it is used to calculate the base-2 log ratio (log2(a1/a0)); these calculated values are then compared with values in \code{loga2} interpreted as base-2 logarithms.
+
+Internally, the list of logarithms of chemical activities in \code{eout$loga.equil} is passed as \code{loga1} to the objective function.
+If the objective function has an argument \code{a1} instead of \code{loga1}, the activities instead of their logarithms are passed to the function.
Generally, \code{loga2} must be a numeric vector with length equal to that of \code{loga1} (i.e., number of species).
-If a single numeric value is supplied for \code{loga2}, it is recycled to the length of \code{loga1}.
+However, if a single numeric value is supplied for \code{loga2}, it is recycled to the length of \code{loga1}.
For calculations at a single condition (0-D, no variation), with the \samp{qqr} objective, a quantile-quantile plot (\code{\link{qqnorm}}) is shown.
For \samp{rmsd} and other objective functions having reference values (\code{loga2}), a scatter plot is shown with a smooth line calculated using \code{\link{loess.smooth}}.
@@ -162,7 +166,7 @@
w <- "ribosomal"
# locate entries whose names contain w
j <- grep.file(f, w)
-# get the amino acid compositions of these protein
+# get the amino acid compositions of these proteins
aa <- read.fasta(f, j)
# add these proteins to CHNOSZ's inventory
ip <- add.protein(aa)
More information about the CHNOSZ-commits
mailing list