From 5dee39bf3a8b5f4c30d68d29f5b396b1fdeba627 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 27 Nov 2015 23:46:34 +0100 Subject: Some manual updates and fixes to the import of wide data --- DESCRIPTION | 2 +- GNUmakefile | 2 +- NEWS.md | 4 +++- inst/GUI/gmkin.R | 9 +++++++-- vignettes/gmkin_manual.html | 24 ++++++++++++------------ vignettes/img/configuration.png | Bin 66452 -> 100479 bytes vignettes/img/dataset_Z.png | Bin 81502 -> 77074 bytes vignettes/img/generatedatagrid.png | Bin 74037 -> 78599 bytes vignettes/img/gmkin_start.png | Bin 102926 -> 97244 bytes vignettes/img/import.png | Bin 49396 -> 50967 bytes vignettes/img/new_project.png | Bin 31691 -> 30713 bytes vignettes/img/plotoptions.png | Bin 17189 -> 15186 bytes vignettes/img/successfulupload.png | Bin 84334 -> 94126 bytes vignettes/img/upload_dialogue.png | Bin 19617 -> 18848 bytes vignettes/img/uploadarea.png | Bin 28560 -> 28306 bytes 15 files changed, 24 insertions(+), 17 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d20271e..7e8335a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: gmkin Type: Package Title: Graphical User Interface for Fitting Kinetic Models to Chemical Degradation Data Version: 0.6.3 -Date: 2015-11-27 +Date: 2015-11-28 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de"), person("Eurofins Regulatory AG", role = "cph")) diff --git a/GNUmakefile b/GNUmakefile index a9849b8..25e3cc1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -62,7 +62,7 @@ README.html: README.md vignettes/gmkin_manual.html: vignettes/gmkin_manual.Rmd "$(RBIN)/Rscript" -e "tools::buildVignette(file = 'vignettes/gmkin_manual.Rmd', dir = 'vignettes')" -vignettes/gmkin_manual.md: vignettes/gmkin_manual.Rmd +vignettes/gmkin_manual.md: vignettes/gmkin_manual.Rmd vignettes/img/* cd vignettes; \ "$(RBIN)/Rscript" -e "knitr::knit('gmkin_manual.Rmd', out = 'gmkin_manual.md')"; \ diff --git a/NEWS.md b/NEWS.md index 9aab2b9..5504d39 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # NEWS for package 'gmkin' -## gmkin 0.6-3 (2015-11-27) +## gmkin 0.6-3 (2015-11-28) - Various small layout and GUI logic improvements based on the suggestions by Stefan Meinecke (Umweltbundesamt Germany). Thanks! @@ -16,6 +16,8 @@ - Some graphical errors in the model gallery were fixed +- Importing data in wide format corrupted the array of observed variables as `mkin_wide_to_long` returns 'name' as a factor + ## gmkin 0.6-2 (2015-11-10) - Make it possible to export model predictions as CSV diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R index bbce29b..2028fbc 100644 --- a/inst/GUI/gmkin.R +++ b/inst/GUI/gmkin.R @@ -663,6 +663,9 @@ new_ds_from_csv_handler <- function(h, ...) { stringsAsFactors = FALSE)) if(svalue(ds.e.up.widelong) == "wide") { tmpdl <- mkin_wide_to_long(tmpd, time = as.character(svalue(ds.e.up.wide.time))) + tmpdl$name <- as.character(tmpdl$name) + tmpdl$override <- NA + tmpdl$err <- 1 } else { tmpdl <- data.frame( name = tmpd[[svalue(ds.e.up.long.name)]], @@ -736,8 +739,10 @@ visible(ds.e.import) <- FALSE ds.e.preview <- ggroup(cont = ds.e.import, width = 400, height = 150, ext.args = list(layout = list(type="vbox", align = "center"))) ds.e.up.text <- ghtml("
", cont = ds.e.preview, width = 380, height = 150)
-ds.e.up.import <- gbutton("Import using options specified below", cont = ds.e.import,
-                          handler = new_ds_from_csv_handler)
+
+ds.e.up.import.line <- ggroup(cont = ds.e.import)
+ds.e.up.import <- gbutton("Import using options specified below", cont = ds.e.up.import.line,
+                          width = 250, handler = new_ds_from_csv_handler)
 ds.e.up.options <- ggroup(cont = ds.e.import, width = 200, horizontal = FALSE)
 ds.e.up.skip <- gedit(tmptextskip, label = "Comment lines", width = 20, cont = ds.e.up.options)
 ds.e.up.header <- gcheckbox(cont = ds.e.up.options, label = "Column names",
diff --git a/vignettes/gmkin_manual.html b/vignettes/gmkin_manual.html
index c6e17f2..ed3ca7f 100644
--- a/vignettes/gmkin_manual.html
+++ b/vignettes/gmkin_manual.html
@@ -10,7 +10,7 @@
 
 
 
-
+
 
 Manual for gmkin
 
@@ -65,7 +65,7 @@ img {
 
 
 
@@ -107,7 +107,7 @@ img {

This will cause the default browser to start up or, if it is already running, to pop up and open a new tab for displaying the gmkin user interface.

In the R console, you should see a message that the httpd help server is started, if it wasn’t already started before.

In the browser, you should see something like the screenshot below.

-

Screenshot of the newly started gmkin GUI

+

Screenshot of the newly started gmkin GUI

The statusbar at the bottom of the gmkin window shows, among others, the working directory that gmkin uses.

If the browser only shows “Loading ExtJS…” and nothing else happens for about 10 to 15 seconds, please enter the gmkin() command again in the R console. If this still does not bring up the gmkin GUI, please close the browser and try again.

@@ -121,17 +121,17 @@ img {

At startup, the project explorer to the left shows the two project workspaces ‘FOCUS_2006’ and ‘FOCUS_2006_Z’ delivered with the package. The project manangement area in the center gives the possibility to save these projects under a new name, or to start a new, empty project.

A gmkin project workspace contains datasets, kinetic models for fitting, and so-called fits, i.e. the results of fitting models to data. The project area also shows the current working directory, where project workspace files are saved using the file extension .gmkinws.

Once a project has been saved by the user, the project explorer to the left will show it in the project list.

-

Screenshot of saving a new project

+

Screenshot of saving a new project

The current state of a project should repeatedly be saved during the work in order to avoid loosing data. This can be achieved by selecting the ‘Project’ tab in the center and pressing the ‘Save project to project file’ button. More conveniently, the keyboard shortcut Ctrl-X can be used to save the current status of the project.

In the project file management area, datasets and models can be imported from one of the projects in the project list, once it has been selected in the droplist labelled ‘Import from:’.

-

Screenshot of importing datasets and models

+

Screenshot of importing datasets and models

Once the project has been set up, you may want to minimize the project explorer, especially if you are limited in vertical screen space.

Screenshot of minimized project explorer

Dataset editor

When you select one of the datasets in the dataset explorer to the left, some summary information about the dataset is shown in the center, and the data itself is loaded into the data editor to the right.

-

Screenshot of the GUI after loading a dataset

+

Screenshot of the GUI after loading a dataset

When you have added information about the units, or edited the data to the right, you should hit the button ‘Keep changes’. This will add a new entry in the dataset explorer.

In the dataset editor to the right, you can override original data (for example in order to follow FOCUS recommendations for time zero samples or values below the limit of detection) by entering numbers in the override column.

When saving a dataset, the sampling times, the number of replicates and the list of observed variables will be computed from the current data in the data editor.

@@ -140,7 +140,7 @@ img {

Entering data directly

For entering new data manually, there are two possibilities. You can either change the Dataset title of the current dataset and edit the data in the Data editor to the right. Or, if the new data should have a different structure, e.g. different sampling times, observed variables and replicates, click on “New dataset”, edit the dataset title, sampling times, number of replicates and the list of observed variables, and press the button ‘Generate grid for entering kinetic data’, in order to prepare the Data editor to the right.

For sampling times and short names of the relevant compounds, a comma separated list must be entered, with a space after each comma. An example of filling out the respective fields is shown below.

-

Screenshot of generating a data grid

+

Screenshot of generating a data grid

After that, the actual measurements can be entered into the Data editor to the right, in the column ‘value’.

If everything is OK, press “Keep changes” to save the dataset in the current workspace. Note that you need to save the project file (see above) in order to be able to use the dataset that you created in a future gmkin session.

@@ -153,9 +153,9 @@ img { file = "schaefer07.csv")

This produces a text file with comma separated values in the current working directory of R.

Loading this text file into gmkin using the “Browse” and “Upload” buttons

-

Screenshot of the browse and upload dialogue

+

Screenshot of the browse and upload dialogue

results in an an import configuration area showing the top lines of the imported file, and giving the possibility to chose the import options matching the file format.

-

Screenshot of the import configuration area

+

Screenshot of the import configuration area

In the import configuration area, the following options can be specified. In the field “Comment lines”, the number of lines in the beginning of the file that should be ignored can be specified.

The checkbox on the next line should be checked if the first line of the file contains the column names, i.e. the names of the observed variables when the data are in wide format.

As “Separator”, whitespace, semicolon or comma can be chosen. If whitespace is selected, files in which the values are separated by a fixed or varying number of whitespace characters should be read in correctly. As the tabulator counts as a whitespace character, this is also the option to choose for tabulator separated values.

@@ -163,7 +163,7 @@ img {

In the next line, it can be specified if the data are in wide or in long format. If in wide format, the only option left to specify is the title of the column containing the sampling times. If the data is in long format, the column headings specifying the columns containing the observed variables (default is “name”), the sampling times (default is “time”), the observed values (default is “value”) and, if present in the data, the relative errors (default is “err”) can be adapted. The default settings appearing if the long format is selected are shown below.

Screenshot of the default variable names for data in long format

In our example we have data in the wide format, and after adapting the “Separator” to a comma, we can press the button “Import using options specified below”, and the data should be imported. If successful, the dataset editor should show the sampling times and the names of the observed variables, and the Data editor should show the imported data in a grid for further editing or specifying overrides.

-

Screenshot of a successful upload

+

Screenshot of a successful upload

After adapting the dataset title and possibly the units, press “Keep changes” to save the dataset in the current workspace. Again, you need to save the project file in order to be able to use the dataset that you created in a future gmkin session.

@@ -180,7 +180,7 @@ img {

Configuring the fit

If a dataset and a kinetic model are selected, the button “Configure fit” below in the Explorer window “Configuration” becomes active. Pressing it opens the “Configuration” area in the center and loads the dataset into the Data editor to the right, for viewing only.

After pressing the button ‘Plot unoptimised’, the data and the kinetic model with default starting parameters are plotted in the ‘Plot’ area to the right.

-

Screenshot of the fit configuration area

+

Screenshot of the fit configuration area

Fit options

The most important fit options of the mkinfit function can be set via the controls in the fit configuration area shown above. If the “plot” checkbox is checked (and on Windows, the R GUI is used for running gmkin), an R graphics device started via the R console shows the fitting progress, i.e. the change of the model solution together with the data during the optimisation.

@@ -196,7 +196,7 @@ img {

Plot options

In the right part of the fit configuration area, the file format can be chosen, the legend can be turned off, and the observed variables for which the data and the model fit should be plotted can be selected as shown below.

-

plot options

+

plot options

On systems running the Windows operating system, the windows metafile (wmf) format can be additionally chosen. Changing the file format for plotting will also change the extension of the proposed filename for saving the plot.

diff --git a/vignettes/img/configuration.png b/vignettes/img/configuration.png index 80d01eb..1a18608 100644 Binary files a/vignettes/img/configuration.png and b/vignettes/img/configuration.png differ diff --git a/vignettes/img/dataset_Z.png b/vignettes/img/dataset_Z.png index 7162b76..c76cbe8 100644 Binary files a/vignettes/img/dataset_Z.png and b/vignettes/img/dataset_Z.png differ diff --git a/vignettes/img/generatedatagrid.png b/vignettes/img/generatedatagrid.png index ac547e1..bc70099 100644 Binary files a/vignettes/img/generatedatagrid.png and b/vignettes/img/generatedatagrid.png differ diff --git a/vignettes/img/gmkin_start.png b/vignettes/img/gmkin_start.png index f15a798..9b494ec 100644 Binary files a/vignettes/img/gmkin_start.png and b/vignettes/img/gmkin_start.png differ diff --git a/vignettes/img/import.png b/vignettes/img/import.png index ec884e8..94e56dd 100644 Binary files a/vignettes/img/import.png and b/vignettes/img/import.png differ diff --git a/vignettes/img/new_project.png b/vignettes/img/new_project.png index 3800f4e..d946cbd 100644 Binary files a/vignettes/img/new_project.png and b/vignettes/img/new_project.png differ diff --git a/vignettes/img/plotoptions.png b/vignettes/img/plotoptions.png index f158913..24cda2d 100644 Binary files a/vignettes/img/plotoptions.png and b/vignettes/img/plotoptions.png differ diff --git a/vignettes/img/successfulupload.png b/vignettes/img/successfulupload.png index 0fbc84c..d6ebe89 100644 Binary files a/vignettes/img/successfulupload.png and b/vignettes/img/successfulupload.png differ diff --git a/vignettes/img/upload_dialogue.png b/vignettes/img/upload_dialogue.png index 9d0d813..c9ec223 100644 Binary files a/vignettes/img/upload_dialogue.png and b/vignettes/img/upload_dialogue.png differ diff --git a/vignettes/img/uploadarea.png b/vignettes/img/uploadarea.png index 92e4cc7..60f71aa 100644 Binary files a/vignettes/img/uploadarea.png and b/vignettes/img/uploadarea.png differ -- cgit v1.2.1