Skip to content

Commit

Permalink
updates of inline docs and vignettes for CRAN release (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkehrein authored May 2, 2024
1 parent d9a2dac commit b467b45
Showing 67 changed files with 1,191 additions and 1,047 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@

# GitHub files
^\.github$
^README\.html$
^README\.md$
^README\.Rmd$
^LICENSE\.md$
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,8 +5,9 @@ inst/doc
/.docker
/dev
# any outputs in package directory that may have been created during testing
/*.png
/*.csv
/Meta/
# Exclude vignette outputs
/doc/
# Exclude some vignette outputs
/doc/*.R
/doc/*.Rmd
/doc/*.html
*.html
14 changes: 8 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
Package: cvasi
Type: Package
Title: Calibration, Validation, and Simulation of TKTD Models in R
Version: 0.10.3
Title: Calibration, Validation, and Simulation of TKTD Models
Version: 0.10.5
Authors@R: c(
person("Nils", "Kehrein", email="nils.kehrein@gmail.com", role=c("aut", "cre")),
person("Dirk", "Nickisch", role="aut"),
person("Johannes", "Witt", role="ctb"),
person("Andre", "Gergs", role="ctb")
)
Description: Eases the use of ecotox effect models. Can simulate common
effect models such as GUTS and Lemna; can derive effects and
effect profiles (EPx) from scenarios. It supports the use of tidyr workflows
employing the pipe symbol. Time-consuming tasks can be parallelized.
Description: Eases the use of ecotoxicological effect models. Can simulate
common toxicokinetic-toxicodynamic (TK/TD) models such as
General Unified Threshold models of Survival (GUTS) and Lemna. It can
derive effects and effect profiles (EPx) from scenarios. It supports the
use of 'tidyr' workflows employing the pipe symbol. Time-consuming
tasks can be parallelized.
URL: https://github.com/cvasi-tktd/cvasi
BugReports: https://github.com/cvasi-tktd/cvasi/issues
License: GPL (>= 3)
17 changes: 10 additions & 7 deletions R/class-Algae.R
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
#' population modeling to assess the effects of time-variable exposure of
#' isoproturon on the green algae Desmodesmus subspictatus and
#' Pseudokirchneriella subcapitata. Environmental Toxicology and
#' Chemistry, 31, 899908. \doi{10.1002/etc.1765}
#' Chemistry, 31, 899-908. \doi{10.1002/etc.1765}
#'
#' @name Algae-models
#' @family algae models
@@ -98,7 +98,7 @@ setClass("AlgaeSimpleScenario", contains = "Algae")
#' population modeling to assess the effects of time-variable exposure of
#' isoproturon on the green algae Desmodesmus subspictatus and
#' Pseudokirchneriella subcapitata. Environmental Toxicology and
#' Chemistry, 31, 899908. \doi{10.1002/etc.1765}
#' Chemistry, 31, 899-908. \doi{10.1002/etc.1765}
#'
#' EFSA PPR Panel (EFSA Panel on Plant Protection Products and their Residues),
#' Ockleford C, Adriaanse P, Berny P, Brock T, Duquesne S, Grilli S,
@@ -110,6 +110,7 @@ setClass("AlgaeSimpleScenario", contains = "Algae")
#' of pesticides for aquatic organisms. EFSA Journal, 16(8), 5377.
#' \doi{10.2903/j.efsa.2018.5377}
#'
#' @return an S4 object of type [AlgaeWeberScenario-class]
#' @seealso [Scenarios], [Transferable]
#' @family algae models
#' @export
@@ -143,9 +144,9 @@ Algae_Weber <- function() {

#' Algae model with exponential growth, forcings (P, I) and scaled damage
#'
#' Constructor to ease creation of *Algae* ‘EffectScenario’s. Model is a variant
#' of the `Algae_Weber` model (Weber 2012) as cited in EFSA TKTD opinion (2018).
#' This Algae model, `Algae_TKTD()`, a) provides an additional
#' Creates an *Algae* scenario. The model is a variant
#' of the [Algae_Weber()] model (Weber 2012) as cited in EFSA TKTD opinion (2018).
#' This Algae model, [Algae_TKTD()], a) provides an additional
#' possibility to simulate the dose-response curve (probit) and b) considers an
#' scaled internal damage instead of the external concentration.
#'
@@ -196,8 +197,9 @@ Algae_Weber <- function() {
#' population modeling to assess the effects of time-variable exposure of
#' isoproturon on the green algae Desmodesmus subspictatus and
#' Pseudokirchneriella subcapitata. Environmental Toxicology and
#' Chemistry, 31, 899908. \doi{10.1002/etc.1765}
#' Chemistry, 31, 899-908. \doi{10.1002/etc.1765}
#'
#' @return an S4 object of type [AlgaeTKTDScenario-class]
#' @seealso [Scenarios], [Transferable]
#' @family algae models
#' @export
@@ -275,8 +277,9 @@ Algae_TKTD <- function() {
#' population modeling to assess the effects of time-variable exposure of
#' isoproturon on the green algae Desmodesmus subspictatus and
#' Pseudokirchneriella subcapitata. Environmental Toxicology and
#' Chemistry, 31, 899908. \doi{10.1002/etc.1765}
#' Chemistry, 31, 899-908. \doi{10.1002/etc.1765}
#'
#' @return an S4 object of type [AlgaeSimpleScenario-class]
#' @seealso [Scenarios], [Transferable]
#' @family algae models
#' @export
4 changes: 2 additions & 2 deletions R/class-Deb.R
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ setClass("DebDaphnia", contains="DebScenario")
#' which considers exposure to a toxicant and one simulation without exposure, i.e.
#' a control. See also [effect()].
#'
#' @return A `DEB_abj` scenario
#' @return an S4 object of type [DebAbj-class]
#' @export
#' @family DEB models
#' @aliases DebAbj-class
@@ -224,7 +224,7 @@ DEB_abj <- function() {
#' - `xG`, factor for growth dilution
#' - `xR`, factor for losses with repro
#'
#' @return A `DEB_Daphnia` scenario
#' @return an S4 object of type [DebDaphnia-class]
#' @export
#' @family DEB models
#' @aliases DebDaphnia-class
45 changes: 22 additions & 23 deletions R/class-ExposureSeries.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
#' Exposure time-series
#'
#' The `ExposureSeries` class encapsulates an exposure time-series with its
#' metadata, such as formatted datetime strings and file name where the
#' series was loaded from. The constructor `ExposureSeries()` can be used to
#' ease object creation. `no_exposure()` is shorthand to create a time-series
#' of constant zero exposure.
#'
#' @slot dates original time points of time-series, e.g. time stamps of the form `2000-01-01 12:00`
#' @slot file `character`, file name where data originates from, may be empty
#' @slot meta `list`, contains metadata
#' @slot context `list`, contains contextual metadata, such as project ids
#' @slot series `data.frame` containing the actual time-series
#' @rdname ExposureSeries
#' @export
setClass("ExposureSeries",
slots=list(
@@ -25,18 +11,27 @@ setClass("ExposureSeries",



#' ExposureSeries constructor
#' Exposure time-series
#'
#' Eases the creation of \linkS4class{ExposureSeries} objects. Can be used
#' to initialize the object's slots.
#' Creates an object that encapsulates an exposure time-series with its
#' metadata, such as formatted datetime strings and file name where the
#' series was loaded from. [no_exposure()] is shorthand to create a time-series
#' of constant zero exposure.
#'
#' @slot dates original time points of time-series, e.g. time stamps of the form `2000-01-01 12:00`
#' @slot file `character`, file name where data originates from, may be empty
#' @slot meta `list`, contains metadata
#' @slot context `list`, contains contextual metadata, such as project ids
#' @slot series `data.frame` containing the actual time-series
#' @param series `data.frame` with two columns containing a time-series
#' @param dates `vector`, optional original list of time stamps
#' @param file `character`, optional file name where data originates from
#' @param meta `list`, optional metadata
#' @param context `list` optional contextual metadata such as project ids
#' @return an S4 object of type [ExposureSeries-class]
#'
#' @rdname ExposureSeries
#' @seealso [no_exposure()]
#' @aliases ExposureSeries-class
#' @export
ExposureSeries <- function(series, dates, file, meta, context) {
if(!is.data.frame(series))
@@ -65,21 +60,25 @@ ExposureSeries <- function(series, dates, file, meta, context) {
)
}


#' Zero exposure
#'
#' Creates an \linkS4class{ExposureSeries} with zero concentration. When setting
#' Creates an [ExposureSeries] with zero concentration. When setting
#' the zero exposure, pay attention not to accidentally reset the output times
#' of your scenario as the zero exposure series contains only a single time point.
#' See the examples.
#'
#' @return an S4 object of type [ExposureSeries-class]
#' @seealso [set_noexposure()]
#' @export
#' @examples
#' # this will reset the output times of the sample scenario,
#' # simulate() will quit with an error
#' \dontrun{
#' minnow_it %>%
#' set_exposure(no_exposure()) %>%
#' simulate()}
#' try(
#' minnow_it %>%
#' set_exposure(no_exposure()) %>%
#' simulate()
#' )
#'
#' # set zero exposure, but keep original output times
#' minnow_it %>%
4 changes: 2 additions & 2 deletions R/class-GutsRed.R
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ setClass("GutsRedIt", contains="EffectScenario")
#'
#' @param param optional named `list` or `vector` with model parameters
#' @param init optional named numeric `vector` to use as initial state
#' @return GUTS_RED_IT scenario
#' @return an S4 object of type [GutsRedIt-class]
#'
#' @export
#' @family GUTS-RED models
@@ -114,7 +114,7 @@ GUTS_RED_IT <- function(param, init) {
#' @inheritSection GUTS-RED-models Effects
#' @inherit GUTS-RED-models references
#' @inheritParams GUTS_RED_IT
#' @return GUTS_RED_SD scenario
#' @return an S4 object of type [GutsRedSd-class]
#'
#' @export
#' @family GUTS-RED models
8 changes: 5 additions & 3 deletions R/class-Lemna.R
Original file line number Diff line number Diff line change
@@ -172,6 +172,7 @@ setClass("LemnaSetacScenario", contains="Lemna")
#' @param param optional named `list` or `vector` of model parameters
#' @param init optional named numeric `vector` of initial state values
#'
#' @return an S4 object of type [LemnaSchmittScenario-class]
#' @seealso [Lemna-models], [Macrophyte-models], [Transferable], [Scenarios]
#' @references
#' Schmitt W., Bruns E., Dollinger M., and Sowig P., 2013:
@@ -232,8 +233,8 @@ Lemna_SchmittThold <- function(param, init) {
#' Lemna model (Klein et al. 2021)
#'
#' The model was described and published by the SETAC Europe Interest Group
#' Effect Modeling (Klein et al. 2022). The *Lemna* model based on the *Lemna*
#' model by Schmitt (2013). The model is a mechanistic combined
#' Effect Modeling (Klein et al. 2022). It is based on the *Lemna* model
#' by Schmitt (2013). The model is a mechanistic combined
#' toxicokinetic-toxicodynamic (TK/TD) and growth model for the aquatic
#' macrophytes *Lemna spp.*. The model simulates the development of Lemna biomass
#' under laboratory and environmental conditions. Growth of the Lemna population
@@ -347,7 +348,7 @@ Lemna_SchmittThold <- function(param, init) {
#' @references
#' Klein J., Cedergreen N., Heine S., Reichenberger S., Rendal C.,
#' Schmitt W., Hommen U., 2021: *Refined description of the Lemna TKTD growth model
#' based on Schmitt et al. (2013) equation system and default parameters*.
#' based on Schmitt et al. (2013) - equation system and default parameters*.
#' Report of the working group *Lemna* of the SETAC Europe Interest Group Effect
#' Modeling. Version 1, uploaded on 22. Sept. 2021.
#' https://www.setac.org/group/effect-modeling.html
@@ -357,6 +358,7 @@ Lemna_SchmittThold <- function(param, init) {
#' *Mechanistic TK/TD-model simulating the effect of growth inhibitors on
#' Lemna populations*. Ecol Model 255, pp. 1-10. \doi{10.1016/j.ecolmodel.2013.01.017}
#'
#' @return an S4 object of type [LemnaSetacScenario-class]
#' @seealso [Lemna-models], [Macrophyte-models], [Transferable], [Scenarios]
#' @family Lemna models
#' @family macrophyte models
2 changes: 2 additions & 0 deletions R/class-Myriophyllum.R
Original file line number Diff line number Diff line change
@@ -95,6 +95,7 @@ setClass("MyrioLogScenario", contains="Myriophyllum")
#' Modeling. Version 1, uploaded on 22. Sept. 2021.
#' https://www.setac.org/group/effect-modeling.html
#'
#' @return an S4 object of type [MyrioExpScenario-class]
#' @seealso [Macrophyte-models], [Transferable], [Scenarios]
#' @family Myriophyllum models
#' @family macrophyte models
@@ -153,6 +154,7 @@ Myrio <- function() {
#' @inheritSection Transferable Biomass transfer
#' @inherit Myrio references
#'
#' @return an S4 object of type [MyrioLogScenario-class]
#' @seealso [Transferable], [Scenarios]
#' @family Myriophyllum models
#' @family macrophyte models
7 changes: 4 additions & 3 deletions R/class-ScenarioSequence.R
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
#'
#' Only simulation of sequences are supported, at the moment.
#' Effects and effect profiles (EPx values) cannot be derived, yet.
#'
#' @return an S4 object of type [ScenarioSequence-class]
#' @examples
#' # create two scenarios that need to be simulated one after the other
#' scen1 <- minnow_it %>% set_times(0:3)
@@ -34,8 +34,9 @@
# effect(sq)
#'
#' @name sequence
#' @aliases ScenarioSequence-class scenario<-,ScenarioSequence-method scenarios,ScenarioSequence-method
#' scenarios<-,ScenarioSequence-method
#' @aliases ScenarioSequence-class sequence
# @aliases ScenarioSequence-class scenario<-,ScenarioSequence-method scenarios,ScenarioSequence-method
# scenarios<-,ScenarioSequence-method sequence
NULL

# Scenario sequence class
17 changes: 6 additions & 11 deletions R/class-parameter_set.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
#' Set of model parameters
#'
#' @slot model `character`, a string containing a model name, e.g. `"GUTS-RED-IT"`
#' @slot tag `character`, an optional identifier
#' @slot param named `list` of model parameters
#' @export
#'
#' @examples
#' parameter_set("GUTS-RED-IT", list(kd=0.01, hb=0))
setClass("parameter_set",
slots=list(
model="character",
@@ -19,8 +11,13 @@ setClass("parameter_set",
#' @param model `character`, a string containing a model name, e.g. `"GUTS-RED-IT"`
#' @param tag `character`, an optional identifier
#' @param param named `list` of model parameters
#' @slot model `character`, a string containing a model name, e.g. `"GUTS-RED-IT"`
#' @slot tag `character`, an optional identifier
#' @slot param named `list` of model parameters
#' @return an S4 object of type [parameter_set-class]
#'
#' @export
#' @aliases parameter_set-class
#' @examples
#' # create a parameter set and assign it
#' ps <- parameter_set("GUTS-RED-IT", list(kd=0.12, hb=0.3))
@@ -31,9 +28,7 @@ setClass("parameter_set",
#' set_param(ps)
#'
#' # model names must match, otherwise an error will be raised
#' \dontrun{
#' GUTS_RED_SD() %>% set_param(ps)
#' }
#' try(GUTS_RED_SD() %>% set_param(ps))
parameter_set <- function(model, param=list(), tag=NA_character_) {
if(!is.character(model))
stop("model name must be of type character")
4 changes: 2 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@
#'
#' Klein J., Cedergreen N., Heine S., Reichenberger S., Rendal C.,
#' Schmitt W., Hommen U., 2021: Refined description of the *Lemna* TKTD growth model
#' based on *Schmitt et al.* (2013) equation system and default parameters.
#' based on *Schmitt et al.* (2013) - equation system and default parameters.
#' Report of the working group *Lemna* of the SETAC Europe Interest Group Effect
#' Modeling. Version 1, uploaded on 22. Sept. 2021.
#' <https://www.setac.org/group/effect-modeling.html>
@@ -138,5 +138,5 @@
#' population modeling to assess the effects of time-variable exposure of
#' isoproturon on the green algae Desmodesmus subspictatus and
#' Pseudokirchneriella subcapitata. Environmental Toxicology and
#' Chemistry, 31, 899908. \doi{10.1002/etc.1765}
#' Chemistry, 31, 899-908. \doi{10.1002/etc.1765}
"Rsubcapitata"
Loading
Oops, something went wrong.

0 comments on commit b467b45

Please sign in to comment.