aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--DESCRIPTION5
-rw-r--r--GNUmakefile2
-rw-r--r--R/mkinfit.R1
-rw-r--r--R/mkinpredict.R3
-rw-r--r--data/FOCUS_2006_Z_gmkin.RDatabin0 -> 69594 bytes
-rw-r--r--data/FOCUS_2006_gmkin.RDatabin0 -> 1352 bytes
-rw-r--r--inst/GUI/gmkin.R89
-rw-r--r--inst/unitTests/runit.mkinfit.R4
-rw-r--r--man/FOCUS_2006_Z_gmkin.Rd27
-rw-r--r--man/FOCUS_2006_gmkin.Rd28
11 files changed, 133 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index eba6d92..e132782 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,19 @@
-2013-12-04 Johannes Ranke <jranke@uni-bremen.de> for mkin (0.9-25)
+2014-02-27 Johannes Ranke <jranke@uni-bremen.de> for mkin (0.9-25)
* Change vignette format from Sweave to knitr
* Split examples vignette to FOCUS_L and FOCUS_Z
- * Add a starter function for the GUI: gmkin()
* Remove warning about constant formation fractions in mkinmod
as it was based on a misconception
+ * Restrict the unit test with the Schaefer data to parent and primary
+ metabolites as formation fraction and DT50 for A2 are higly correlated and
+ passing the test is platform dependent. For example, the test fails in 1
+ out of 14 platforms on CRAN as of today.
+ * Add Eurofins Regulatory AG copyright notices
+ * Import FME and deSolve instead of depending on them to have clean startup
+ * Add a starter function for the GUI: gmkin()
+ * Change the format of the workspace files of gmkin so they can be
+ distributed and documented in the package
+ * Add gmkin workspace datasets FOCUS_2006_gmkin and FOCUS_2006_Z_gmkin
2013-11-06 Johannes Ranke <jranke@uni-bremen.de> for mkin (0.9-24)
diff --git a/DESCRIPTION b/DESCRIPTION
index 7b478e4..c7687ee 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -3,7 +3,7 @@ Type: Package
Title: Routines for fitting kinetic models with one or more state
variables to chemical degradation data
Version: 0.9-25
-Date: 2014-01-22
+Date: 2014-02-27
Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre"),
email = "jranke@uni-bremen.de"),
person("Katrin", "Lindenberger", role = "ctb"),
@@ -14,7 +14,8 @@ Description: Calculation routines based on the FOCUS Kinetics Report (2006).
and a choice of the optimisation methods made available by the FME package
(default is a Levenberg-Marquardt variant). Please note that no warranty is
implied for correctness of results or fitness for a particular purpose.
-Depends: FME, deSolve, minpack.lm
+Depends: minpack.lm
+Imports: FME, deSolve
Suggests: knitr, RUnit, gWidgetsWWW2, RSVGTipsDevice
License: GPL
LazyLoad: yes
diff --git a/GNUmakefile b/GNUmakefile
index cf5c845..4511b07 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -21,7 +21,7 @@ help:
@echo " check Invoke build and then check the package"
@echo " check-no-vignettes Invoke build without rebuilding vignettes, and then check"
@echo " install Invoke build and then install the result"
- @echo " install Invoke build without rebuilding vignettes and then install the result"
+ @echo " install-no-vignettes Invoke build without rebuilding vignettes and then install the result"
@echo " test Install a new copy of the package and run it "
@echo " through the testsuite"
@echo " test-no-vignettes Invoke build without rebuilding vignettes, and then run it"
diff --git a/R/mkinfit.R b/R/mkinfit.R
index 6c976a3..326f404 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -1,4 +1,5 @@
# Copyright (C) 2010-2014 Johannes Ranke
+# Portions of this code are copyright (C) 2013 Eurofins Regulatory AG
# Contact: jranke@uni-bremen.de
# The summary function is an adapted and extended version of summary.modFit
# from the FME package, v 1.1 by Soetart and Petzoldt, which was in turn
diff --git a/R/mkinpredict.R b/R/mkinpredict.R
index 07c1a81..14efc56 100644
--- a/R/mkinpredict.R
+++ b/R/mkinpredict.R
@@ -1,4 +1,5 @@
-# Copyright (C) 2010-2013 Johannes Ranke
+# Copyright (C) 2010-2014 Johannes Ranke
+# Some lines in this code are copyright (C) 2013 Eurofins Regulatory AG
# Contact: jranke@uni-bremen.de
# This file is part of the R package mkin
diff --git a/data/FOCUS_2006_Z_gmkin.RData b/data/FOCUS_2006_Z_gmkin.RData
new file mode 100644
index 0000000..9e9aeac
--- /dev/null
+++ b/data/FOCUS_2006_Z_gmkin.RData
Binary files differ
diff --git a/data/FOCUS_2006_gmkin.RData b/data/FOCUS_2006_gmkin.RData
new file mode 100644
index 0000000..22c8625
--- /dev/null
+++ b/data/FOCUS_2006_gmkin.RData
Binary files differ
diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R
index 07f892e..6de4de2 100644
--- a/inst/GUI/gmkin.R
+++ b/inst/GUI/gmkin.R
@@ -1,9 +1,8 @@
-# $Id: mkinGUI.R 122 2013-10-21 20:19:57Z jranke $ {{{1
+# gWidgetsWWW2 GUI for mkin {{{1
-# gWidgetsWWW2 GUI for mkin
-
-# Copyright (C) 2013 Johannes Ranke
-# Contact: jranke@uni-bremen.de, johannesranke@eurofins.com
+# Copyright (C) 2013,2014 Johannes Ranke
+# Portions of this file are copyright (C) 2013 Eurofins Regulatory AG, Switzerland
+# Contact: jranke@uni-bremen.de
# This file is part of the R package mkin
@@ -19,10 +18,11 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>
+
require(mkin) # {{{1
# Set the GUI title and create the basic widget layout {{{1
-w <- gwindow("Browser based GUI for kinetic evaluations using mkin")
-sb <- gstatusbar("Powered by gWidgetsWWW2 and Rook", cont = w)
+w <- gwindow("gmkin - Browser based GUI for kinetic evaluations using mkin")
+sb <- gstatusbar(paste("Powered by gWidgetsWWW2, ExtJS, Rook, FME, deSolve and minpack.lm --- Working directory is", getwd()), cont = w)
pg <- gpanedgroup(cont = w, default.size = 300)
center <- gnotebook(cont = pg)
left <- gvbox(cont = pg)
@@ -35,7 +35,8 @@ override <- function(d) {
}
# Set default values for project data {{{1
# Initial project file name {{{2
-project_file <- "mkin_FOCUS_2006.RData"
+project_name <- "mkin_FOCUS_2006"
+project_file <- paste0(project_name, ".RData")
# Initial studies {{{2
studies.df <- data.frame(Index = as.integer(1),
Citation = "FOCUS (2006) Guidance on degradation kinetics",
@@ -133,53 +134,79 @@ upload_file_handler <- function(h, ...)
{
# General
tmpfile <- normalizePath(svalue(h$obj), winslash = "/")
- try(load(tmpfile))
project_file <<- pr.gf$filename
- svalue(pr.ge) <- project_file
+ project_name <<- try(load(tmpfile))
+ if (inherits(project_name, "try-error")) {
+ galert(paste("Failed to load", project_file, "from", getwd()), parent = w)
+ }
+
+ svalue(sb) <- paste("Loaded project file", project_file, "from working directory", getwd())
+ svalue(pr.ge) <- project_name
+ workspace <- get(project_name)
# Studies
- studies.gdf[,] <- studies.df
+ studies.gdf[,] <- studies.df <- workspace$studies.df
# Datasets
- ds.cur <<- ds.cur
- ds <<- ds
+ ds.cur <<- workspace$ds.cur
+ ds <<- workspace$ds
update_ds.df()
ds.gtable[,] <- ds.df
update_ds_editor()
# Models
- m.cur <<- ds.cur
- m <<- m
+ m.cur <<- workspace$m.cur
+ m <<- workspace$m
update_m.df()
m.gtable[,] <- m.df
update_m_editor()
# Fits
- f.cur <<- f.cur
- f <<- f
- s <<- s
- if (length(f) > 0) update_f.df()
- else f.df <- f.df.empty
+ f.cur <<- workspace$f.cur
+ f <<- workspace$f
+ s <<- workspace$s
+ if (length(f) > 0) {
+ update_f.df()
+ ftmp <<- f[[f.cur]]
+ stmp <<- s[[f.cur]]
+ ds.i <<- ds.cur
+ update_plotting_and_fitting()
+ } else {
+ f.df <<- f.df.empty
+ update_ds_editor()
+ svalue(center) <- 1
+ }
f.gtable[,] <- f.df
- ftmp <<- f[[f.cur]]
- stmp <<- s[[f.cur]]
- ds.i <<- ds.cur
- update_plotting_and_fitting()
}
save_to_file_handler <- function(h, ...)
{
- studies.df <- data.frame(studies.gdf[,], stringsAsFactors = FALSE)
- save(studies.df, ds, ds.cur, m, m.cur, f, s, f.cur, file = project_file)
- galert(paste("Saved project contents to", project_file), parent = w)
+ studies.df <- data.frame(studies.gdf[,], stringsAsFactors = FALSE)
+ workspace <- list(
+ studies.df = studies.df,
+
+ ds = ds,
+ ds.cur = ds.cur,
+
+ m = m,
+ m.cur = m.cur,
+
+ f = f,
+ f.cur = f.cur,
+
+ s = s)
+ assign(project_name, workspace)
+ save(list = project_name, file = project_file)
+ svalue(sb) <- paste("Saved project contents to", project_file, "in working directory", getwd())
}
-change_project_file_handler = function(h, ...) {
- project_file <<- as.character(svalue(h$obj))
+change_project_name_handler = function(h, ...) {
+ project_name <<- as.character(svalue(h$obj))
+ project_file <<- paste0(project_name, ".RData")
}
# Project data management GUI elements {{{2
pr.gf <- gfile(text = "Select project file", cont = prg,
handler = upload_file_handler)
-pr.ge <- gedit(project_file, cont = prg,
- handler = change_project_file_handler)
+pr.ge <- gedit(project_name, cont = prg, label = "Project", width = 240,
+ handler = change_project_name_handler)
# The save button is always visible {{{1
gbutton("Save current project contents", cont = left,
handler = save_to_file_handler)
diff --git a/inst/unitTests/runit.mkinfit.R b/inst/unitTests/runit.mkinfit.R
index 89f4daf..9a6bd72 100644
--- a/inst/unitTests/runit.mkinfit.R
+++ b/inst/unitTests/runit.mkinfit.R
@@ -1,6 +1,6 @@
# $Id: runit.mkinfit.R 68 2010-09-09 22:40:04Z jranke $
-# Copyright (C) 2010-2012 Johannes Ranke
+# Copyright (C) 2010-2013 Johannes Ranke
# Contact: jranke@uni-bremen.de
# This file is part of the R package mkin
@@ -288,7 +288,7 @@ test.mkinfit.schaefer07_complex_example <- function()
s$distimes["A2", "DT50"])
r$means <- (r$KinGUI + r$ModelMaker)/2
r$mkin.deviation <- abs(round(100 * ((r$mkin - r$means)/r$means), digits=1))
- checkIdentical(r$mkin.deviation < 10, rep(TRUE, length(r$mkin.deviation)))
+ checkIdentical(r$mkin.deviation[1:11] < 10, rep(TRUE, 11))
} # }}}
# vim: set foldmethod=marker ts=2 sw=2 expandtab:
diff --git a/man/FOCUS_2006_Z_gmkin.Rd b/man/FOCUS_2006_Z_gmkin.Rd
new file mode 100644
index 0000000..4f6a5e4
--- /dev/null
+++ b/man/FOCUS_2006_Z_gmkin.Rd
@@ -0,0 +1,27 @@
+\name{FOCUS_2006_Z_gmkin}
+\Rdversion{1.1}
+\alias{FOCUS_2006_Z_gmkin}
+\docType{data}
+\title{
+ Example gmkin workspace for Dataset Z from the FOCUS Kinetics report
+}
+\description{
+ Data taken from FOCUS (2006), Appendix 7, p. 350.
+}
+\usage{FOCUS_2006_Z_gmkin}
+\format{
+ A list named \code{FOCUS_2006_Z_gmkin} containing the components
+ needed to populate the \code{\link{gmkin}} user interface.
+}
+\examples{
+ save(FOCUS_2006_Z_gmkin, file = "FOCUS_2006_gmkin_Z.RData")
+ # Now you can load the file "FOCUS_2006_gmkin_Z.RData" from gmkin
+}
+\source{
+ FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence and
+ Degradation Kinetics from Environmental Fate Studies on Pesticides in EU
+ Registration} Report of the FOCUS Work Group on Degradation Kinetics,
+ EC Document Reference Sanco/10058/2005 version 2.0, 434 pp,
+ \url{http://focus.jrc.ec.europa.eu/dk}
+}
+\keyword{datasets}
diff --git a/man/FOCUS_2006_gmkin.Rd b/man/FOCUS_2006_gmkin.Rd
new file mode 100644
index 0000000..371ddc7
--- /dev/null
+++ b/man/FOCUS_2006_gmkin.Rd
@@ -0,0 +1,28 @@
+\name{FOCUS_2006_gmkin}
+\Rdversion{1.1}
+\alias{FOCUS_2006_gmkin}
+\docType{data}
+\title{
+ Example gmkin workspace for Datasets C and D from the FOCUS Kinetics report
+}
+\description{
+ Data taken from FOCUS (2006), Appendix 3. This is the the workspace that is
+ loaded into \code{\link{gmkin}} by default.
+}
+\usage{FOCUS_2006_gmkin}
+\format{
+ A list named \code{FOCUS_2006_gmkin} containing the components
+ needed to populate the gmkin user interface.
+}
+\examples{
+ save(FOCUS_2006_gmkin, file = "FOCUS_2006_gmkin.RData")
+ # Now you can load the file "FOCUS_2006_gmkin.RData" from gmkin
+}
+\source{
+ FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence and
+ Degradation Kinetics from Environmental Fate Studies on Pesticides in EU
+ Registration} Report of the FOCUS Work Group on Degradation Kinetics,
+ EC Document Reference Sanco/10058/2005 version 2.0, 434 pp,
+ \url{http://focus.jrc.ec.europa.eu/dk}
+}
+\keyword{datasets}

Contact - Imprint