From 524a8bba89b95840b4e9215c403947a8bb76d7b2 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 30 Nov 2020 16:05:10 +0100 Subject: Complete rebuild of static docs of dev version --- docs/dev/reference/mkinmod.html | 91 ++++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 34 deletions(-) (limited to 'docs/dev/reference/mkinmod.html') diff --git a/docs/dev/reference/mkinmod.html b/docs/dev/reference/mkinmod.html index 803be90d..9e37e664 100644 --- a/docs/dev/reference/mkinmod.html +++ b/docs/dev/reference/mkinmod.html @@ -162,9 +162,13 @@ components.

mkinmod(
   ...,
   use_of_ff = "max",
+  name = NULL,
   speclist = NULL,
   quiet = FALSE,
-  verbose = FALSE
+  verbose = FALSE,
+  dll_dir = NULL,
+  unload = FALSE,
+  overwrite = FALSE
 )
 
 # S3 method for mkinmod
@@ -200,6 +204,10 @@ formation fractions are always used (default).  If "min", a minimum use of
 formation fractions is made, i.e. each pathway to a metabolite has its
 own rate constant.

+ + name +

A name for the model. Should be a valid R object name.

+ speclist

The specification of the observed variables and their @@ -214,6 +222,23 @@ argument. Default is NULL.

verbose

If TRUE, passed to inline::cfunction() if applicable to give detailed information about the C function being built.

+ + + dll_dir +

Directory where an DLL object, if generated internally by +inline::cfunction(), should be saved. The DLL will only be stored in a +permanent location for use in future sessions, if 'dll_dir' and 'name' +are specified.

+ + + unload +

If a DLL from the target location in 'dll_dir' is already +loaded, should that be unloaded first?

+ + + overwrite +

If a file exists at the target DLL location in 'dll_dir', +should this be overwritten?

x @@ -299,18 +324,37 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media

SFO_SFO <- mkinmod( parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) -
#> Successfully compiled differential equation model from auto-generated C code.
+
#> Temporary DLL for differentials generated and loaded
print(SFO_SFO) +
#> <mkinmod> model generated with +#> Use of formation fractions $use_of_ff: max +#> Specification $spec: +#> $parent +#> $type: SFO; $to: m1; $sink: TRUE +#> $m1 +#> $type: SFO; $sink: TRUE +#> Coefficient matrix $coefmat available +#> Compiled model $cf available +#> Differential equations: +#> d_parent/dt = - k_parent * parent +#> d_m1/dt = + f_parent_to_m1 * k_parent * parent - k_m1 * m1
# \dontrun{ -# Now supplying full names used for plotting + fit_sfo_sfo <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE, solution_type = "deSolve") +
#> Warning: Observations with value of zero were removed from the data
+ # Now supplying compound names used for plotting, and write to user defined location + # We need to choose a path outside the session tempdir because this gets removed + DLL_dir <- "~/.local/share/mkin" + if (!dir.exists(DLL_dir)) dir.create(DLL_dir) SFO_SFO.2 <- mkinmod( parent = mkinsub("SFO", "m1", full_name = "Test compound"), - m1 = mkinsub("SFO", full_name = "Metabolite M1")) -
#> Successfully compiled differential equation model from auto-generated C code.
-# The above model used to be specified like this, before the advent of mkinsub() -SFO_SFO <- mkinmod( - parent = list(type = "SFO", to = "m1"), - m1 = list(type = "SFO")) -
#> Successfully compiled differential equation model from auto-generated C code.
+ m1 = mkinsub("SFO", full_name = "Metabolite M1"), + name = "SFO_SFO", dll_dir = DLL_dir, unload = TRUE, overwrite = TRUE) +
#> Copied DLL from /tmp/RtmpX9Xf3y/file6d622f3b7e08.so to /home/jranke/.local/share/mkin/SFO_SFO.so
# Now we can save the model and restore it in a new session +saveRDS(SFO_SFO.2, file = "~/SFO_SFO.rds") +# Terminate the R session here if you would like to check, and then do +library(mkin) +SFO_SFO.3 <- readRDS("~/SFO_SFO.rds") +fit_sfo_sfo <- mkinfit(SFO_SFO.3, FOCUS_2006_D, quiet = TRUE, solution_type = "deSolve") +
#> Warning: Observations with value of zero were removed from the data
# Show details of creating the C function SFO_SFO <- mkinmod( parent = mkinsub("SFO", "m1"), @@ -330,11 +374,11 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media

#> 12: } #> 13: #> 14: -#> 15: void func ( int * n, double * t, double * y, double * f, double * rpar, int * ipar ) { +#> 15: void diffs ( int * n, double * t, double * y, double * f, double * rpar, int * ipar ) { #> 16: #> 17: f[0] = - k_parent * y[0]; #> 18: f[1] = + f_parent_to_m1 * k_parent * y[0] - k_m1 * y[1]; -#> 19: }
#> Successfully compiled differential equation model from auto-generated C code.
+#> 19: }
#> Temporary DLL for differentials generated and loaded
# The symbolic solution which is available in this case is not # made for human reading but for speed of computation SFO_SFO$deg_func @@ -353,7 +397,7 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media

#> }) #> return(predicted) #> } -#> <environment: 0x55555c97f8d8>
+#> <environment: 0x55555c5b8d68>
# If we have several parallel metabolites # (compare tests/testthat/test_synthetic_data_for_UBA_2014.R) m_synth_DFOP_par <- mkinmod( @@ -367,27 +411,6 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media

quiet = TRUE) # } - - m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"), - M1 = list(type = "SFO", to = "M2"), - M2 = list(type = "SFO"), use_of_ff = "max") -
#> Successfully compiled differential equation model from auto-generated C code.
- print(m_synth_SFO_lin) -
#> <mkinmod> model generated with -#> Use of formation fractions $use_of_ff: max -#> Specification $spec: -#> $parent -#> $type: SFO; $to: M1; $sink: TRUE -#> $M1 -#> $type: SFO; $to: M2; $sink: TRUE -#> $M2 -#> $type: SFO; $sink: TRUE -#> Coefficient matrix $coefmat available -#> Compiled model $cf available -#> Differential equations: -#> d_parent/dt = - k_parent * parent -#> d_M1/dt = + f_parent_to_M1 * k_parent * parent - k_M1 * M1 -#> d_M2/dt = + f_M1_to_M2 * k_M1 * M1 - k_M2 * M2