From 5cba6b4cdaee9fdb24f9cea338aafb522ceb0361 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 13 Oct 2017 12:37:43 +0200 Subject: Install with drat, static documentation rebuilt by pkgdown --- GNUmakefile | 2 +- README.html | 19 ++--- README.md | 28 ++++--- docs/articles/gmkin_manual.R | 34 +++++++++ docs/index.html | 13 ++-- vignettes/gmkin_manual.html | 177 +++++++++++++++++++++++++++++++++++-------- 6 files changed, 210 insertions(+), 63 deletions(-) create mode 100644 docs/articles/gmkin_manual.R diff --git a/GNUmakefile b/GNUmakefile index a9a2ab6..441a536 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -85,7 +85,7 @@ drat: build dratwin: winbin "$(RBIN)/Rscript" -e "drat::insertPackage('$(WINBIN)', 'e:/git/drat/', commit = TRUE)" -r-forge: pd +r-forge: git archive master > $(PKGDIR)/gmkin.tar;\ cd $(RFDIR) && rm -r `ls` && tar -xf $(PKGDIR)/gmkin.tar;\ rm -r $(SDDIR)/*;\ diff --git a/README.html b/README.html index 1849925..809551b 100644 --- a/README.html +++ b/README.html @@ -4,7 +4,7 @@ - + @@ -19,7 +19,7 @@ - + @@ -134,14 +134,15 @@ $(document).ready(function () {

Installing gmkin and gWidgetsWWW2

-

Windows and Linux users running R 3.1.0 or later can make use of the package repository on R-Forge. Before installing gmkin, you should update your R packages already installed, e.g. by starting R, and pasting the command

+

Windows and Linux users running R 3.1.0 or later can make use of my drat package repository on github. Before installing gmkin, you should update your R packages already installed, e.g. by starting R, and pasting the command

update.packages()

or similar, depending on your R installation.

-

For installing gmkin or upgrading to the latest released version, please use the command

-
install.packages("gmkin", repos = c("http://r-forge.r-project.org", getOption("repos")))
-

If you have not set your CRAN mirror yet, you may have to select one from the list that appears.

-

The above command temporarily adds the R-Forge repository to your package sources. It should pull the gmkin package and its dependencies, notably the gWidgetsWWW2 package which is not available from the CRAN archive (see below). Mac users that have the necessary development files installed can probably install from the source files in this repository (not tested).

-

In a previous version of this README I have described how to permanently add the R-Forge repository to your options. However, I noticed this has unwanted side effects, so I do not recommend it any longer. Therefore, you may want to revert such changes to your R startup options.

+

For installing gmkin or upgrading to the latest released version, please install the drat package

+
install.packages("drat")
+

add my repository

+
drat::addRepo("jranke")
+

and install as usual

+
install.packages("gmkin")

The latest changes to gmkin are recorded in the NEWS file, more details can be found in the commit history.

gmkin screenshot @@ -221,7 +222,7 @@ $(document).ready(function () { (function () { var script = document.createElement("script"); script.type = "text/javascript"; - script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; + script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; document.getElementsByTagName("head")[0].appendChild(script); })(); diff --git a/README.md b/README.md index 206cf77..3a476bb 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ respective ### Installing gmkin and gWidgetsWWW2 -Windows and Linux users running R 3.1.0 or later can make use of the -package repository on R-Forge. Before installing gmkin, you should update +Windows and Linux users running R 3.1.0 or later can make use of my drat +package repository on github. Before installing gmkin, you should update your R packages already installed, e.g. by starting R, and pasting the command @@ -48,25 +48,23 @@ update.packages() or similar, depending on your R installation. For installing gmkin or upgrading to the latest released version, please -use the command +install the drat package ```s -install.packages("gmkin", repos = c("http://r-forge.r-project.org", getOption("repos"))) +install.packages("drat") ``` -If you have not set your CRAN mirror yet, you may have to select one from the list that -appears. +add my repository -The above command temporarily adds the R-Forge repository to your package -sources. It should pull the gmkin package and its dependencies, notably the -gWidgetsWWW2 package which is not available from the CRAN archive (see below). -Mac users that have the necessary development files installed can probably -install from the source files in this repository (not tested). +```s +drat::addRepo("jranke") +``` + +and install as usual -In a previous version of this README I have described how to permanently add -the R-Forge repository to your options. However, I noticed this has unwanted -side effects, so I do not recommend it any longer. Therefore, you may want -to revert such changes to your R startup options. +```s +install.packages("gmkin") +``` The latest changes to gmkin are recorded in the [NEWS](https://github.com/jranke/gmkin/blob/master/NEWS.md) file, diff --git a/docs/articles/gmkin_manual.R b/docs/articles/gmkin_manual.R new file mode 100644 index 0000000..0fd5ece --- /dev/null +++ b/docs/articles/gmkin_manual.R @@ -0,0 +1,34 @@ +## ---- include = FALSE---------------------------------------------------- +library(knitr) +opts_chunk$set(tidy = FALSE, cache = FALSE) + +## ---- eval = FALSE------------------------------------------------------- +# library(gmkin) + +## ---- eval = FALSE------------------------------------------------------- +# gmkin() + +## ---- eval = FALSE------------------------------------------------------- +# write.table(schaefer07_complex_case, sep = ",", dec = ".", +# row.names = FALSE, quote = FALSE, +# file = "schaefer07.csv") + +## ---- eval = FALSE------------------------------------------------------- +# Model cost at call 1 : 15156.12 +# Model cost at call 3 : 15156.12 +# Model cost at call 7 : 14220.79 +# Model cost at call 8 : 14220.79 +# Model cost at call 11 : 14220.79 +# Model cost at call 12 : 3349.268 +# Model cost at call 15 : 3349.268 +# Model cost at call 17 : 788.6367 +# Model cost at call 18 : 788.6366 +# Model cost at call 22 : 374.0575 +# Model cost at call 23 : 374.0575 +# Model cost at call 27 : 371.2135 +# Model cost at call 28 : 371.2135 +# Model cost at call 32 : 371.2134 +# Model cost at call 36 : 371.2134 +# Model cost at call 37 : 371.2134 +# Optimisation by method Port successfully terminated. + diff --git a/docs/index.html b/docs/index.html index 38efd2c..7d2d95a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -68,14 +68,15 @@

Installing gmkin and gWidgetsWWW2

-

Windows and Linux users running R 3.1.0 or later can make use of the package repository on R-Forge. Before installing gmkin, you should update your R packages already installed, e.g. by starting R, and pasting the command

+

Windows and Linux users running R 3.1.0 or later can make use of my drat package repository on github. Before installing gmkin, you should update your R packages already installed, e.g. by starting R, and pasting the command

update.packages()

or similar, depending on your R installation.

-

For installing gmkin or upgrading to the latest released version, please use the command

-
install.packages("gmkin", repos = c("http://r-forge.r-project.org", getOption("repos")))
-

If you have not set your CRAN mirror yet, you may have to select one from the list that appears.

-

The above command temporarily adds the R-Forge repository to your package sources. It should pull the gmkin package and its dependencies, notably the gWidgetsWWW2 package which is not available from the CRAN archive (see below). Mac users that have the necessary development files installed can probably install from the source files in this repository (not tested).

-

In a previous version of this README I have described how to permanently add the R-Forge repository to your options. However, I noticed this has unwanted side effects, so I do not recommend it any longer. Therefore, you may want to revert such changes to your R startup options.

+

For installing gmkin or upgrading to the latest released version, please install the drat package

+
install.packages("drat")
+

add my repository

+
drat::addRepo("jranke")
+

and install as usual

+
install.packages("gmkin")

The latest changes to gmkin are recorded in the NEWS file, more details can be found in the commit history.

gmkin screenshot

diff --git a/vignettes/gmkin_manual.html b/vignettes/gmkin_manual.html index ac54e6c..abcae08 100644 --- a/vignettes/gmkin_manual.html +++ b/vignettes/gmkin_manual.html @@ -4,26 +4,28 @@ - + + - + Manual for gmkin - + - - + + - + + + + - - + @@ -54,18 +84,44 @@ code { color: inherit; background-color: rgba(0, 0, 0, 0.04); } -img { - max-width:100%; - height: auto; +img { + max-width:100%; + height: auto; +} +.tabbed-pane { + padding-top: 12px; +} +button.code-folding-btn:focus { + outline: none; } + + +
+ + + + + + + + + -

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 +

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.

@@ -145,7 +216,10 @@ 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 +

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.

@@ -158,24 +232,39 @@ 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 +

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 +

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.

As the “Decimal” separator, comma “,” or period “.” can be selected.

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

+
+Screenshot of the default variable names for data in long format +

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 +

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.

Model editor

The following screenshot shows the model editor for the model ‘Z.2a.ff’ from the project workspace ‘FOCUS_2006_Z’ provided with the gmkin package.

-

Screenshot of the model editor

+
+Screenshot of the model editor +

Screenshot of the model editor

+

In the first line the name of the model can be edited. You can also specify “min” or “max” for minimum or maximum use of formation fractions. Maximum use of formation fractions means that the differential equations in the degradation model are formulated using formation fractions. When you specify “min”, then formation fractions are only used for the parent compound when you use the FOMC, DFOP or the HS model for it.

Pressing “Add observed variable” adds a line in the array of state variable specifications below. The observed variables to be added are usually transformation products (usually termed metabolites), but can also be the parent compound in a different compartment (e.g. “parent_sediment”).

Only observed variable names that occur in previously defined datasets or models can be selected. For any observed variable other than the first one, only the SFO or the SFORB model can be selected. For each observed variables, a comma separated list of target variables can be specified. In addition, a pathway to the sink compartment can be selected. If too many observed variables have been added, complete lines can be removed from the model definition by pressing the button “Remove observed variable”.

@@ -185,7 +274,10 @@ 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 +

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.

@@ -201,7 +293,10 @@ 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 +

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.

@@ -233,21 +328,33 @@ Model cost at call 37 : 371.2134 Optimisation by method Port successfully terminated.

If plotting of the fitting progress was selected, a new separate graphics window should either pop up, or a graphics window previously started for this purpose will be reused.

If your screen size allows for it, you can arrange the R plotting window and the R console in a way that you can see everything at the same time:

-

Screenshot of arrangement of plot window and console

+
+Screenshot of arrangement of plot window and console +

Screenshot of arrangement of plot window and console

+

Results and summary

Once a fit has successfully been completed, the most important results are shown in several tables in the “Result” area as shown below.

-

Screenshot of the results

+
+Screenshot of the results +

Screenshot of the results

+

The detailed summary can be accessed below these tables.

-

Screenshot of the summary

+
+Screenshot of the summary +

Screenshot of the summary

+

The complete summary can be saved into a text file by specifying a suitable file name and pressing the button “Save summary”.

Confidence interval plots

Whenever a new fit has been configured or a run of a fit has been completed, the plotting area is updated with the abovementioned plot of the data and the current model solution.

In addition, a confidence interval plot is shown below this conventional plot. In case a fit has been run and confidence intervals were successfully calculated for the fit (i.e. if the model was not overparameterised and no other problems occurred), the confidence intervals are graphically displayed as bars as shown below.

-

confidence

+
+confidence +

confidence

+
@@ -332,15 +439,21 @@ Optimisation by method Port successfully terminated.
+ +
-- cgit v1.2.1