aboutsummaryrefslogtreecommitdiff
path: root/vignettes/prebuilt/2022_cyan_pathway.rmd
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2023-04-17 21:53:49 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2023-04-17 21:58:17 +0200
commitee8c8a53903de1a0f480060900b706022af091b6 (patch)
tree381d9663c9865fa727cafd966244337e809b2799 /vignettes/prebuilt/2022_cyan_pathway.rmd
parent57ca408fda3fb8e42e0d5f3d9fc808d54268fa08 (diff)
Post release changes to the docs
The cyantraniliprole and dmta pathway vignettes were not working any more with the latest changes in deSolve and mkin. All docs need a rebuild.
Diffstat (limited to 'vignettes/prebuilt/2022_cyan_pathway.rmd')
-rw-r--r--vignettes/prebuilt/2022_cyan_pathway.rmd42
1 files changed, 32 insertions, 10 deletions
diff --git a/vignettes/prebuilt/2022_cyan_pathway.rmd b/vignettes/prebuilt/2022_cyan_pathway.rmd
index df34a6f2..d0b2c889 100644
--- a/vignettes/prebuilt/2022_cyan_pathway.rmd
+++ b/vignettes/prebuilt/2022_cyan_pathway.rmd
@@ -50,11 +50,19 @@ library(knitr)
library(saemix)
library(parallel)
n_cores <- detectCores()
-if (Sys.info()["sysname"] == "Windows") {
- cl <- makePSOCKcluster(n_cores)
-} else {
- cl <- makeForkCluster(n_cores)
+
+# We need to start a new cluster after defining a compiled model that is
+# saved as a DLL to the user directory, therefore we define a function
+# This is used again after defining the pathway model
+start_cluster <- function(n_cores) {
+ if (Sys.info()["sysname"] == "Windows") {
+ ret <- makePSOCKcluster(n_cores)
+ } else {
+ ret <- makeForkCluster(n_cores)
+ }
+ return(ret)
}
+cl <- start_cluster(n_cores)
```
\clearpage
@@ -135,6 +143,10 @@ illparms(cyan_saem_reduced)
anova(cyan_saem_reduced) |> kable(digits = 1)
```
+```{r}
+stopCluster(cl)
+```
+
# Pathway fits
## Evaluations with pathway established previously
@@ -178,6 +190,7 @@ cyan_path_1 <- list(
JSE76 = mkinsub("SFO"), quiet = TRUE,
name = "hs_path_1", dll_dir = "cyan_dlls", overwrite = TRUE)
)
+cl_path_1 <- start_cluster(n_cores)
```
To obtain suitable starting values for the NLHM fits, separate pathway fits are
performed for all datasets.
@@ -187,7 +200,7 @@ f_sep_1_const <- mmkin(
cyan_path_1,
cyan_ds,
error_model = "const",
- cluster = cl,
+ cluster = cl_path_1,
quiet = TRUE)
status(f_sep_1_const) |> kable()
@@ -209,7 +222,7 @@ currently under development.
```{r, f-saem-1, dependson = "f-sep-1"}
f_saem_1 <- mhmkin(list(f_sep_1_const, f_sep_1_tc),
no_random_effect = illparms(cyan_saem_full),
- cluster = cl)
+ cluster = cl_path_1)
```
```{r dependson = "f-saem-1"}
@@ -253,6 +266,9 @@ at later time points are strongly and systematically underestimated.
\clearpage
+```{r}
+stopCluster(cl_path_1)
+```
## Alternative pathway fits
@@ -294,11 +310,13 @@ cyan_path_2 <- list(
overwrite = TRUE
)
)
+
+cl_path_2 <- start_cluster(n_cores)
f_sep_2_const <- mmkin(
cyan_path_2,
cyan_ds,
error_model = "const",
- cluster = cl,
+ cluster = cl_path_2,
quiet = TRUE)
status(f_sep_2_const) |> kable()
@@ -319,7 +337,7 @@ Sassafras dataset.
```{r f-saem-2, dependson = c("f-sep-2-const", "f-sep-2-tc")}
f_saem_2 <- mhmkin(list(f_sep_2_const, f_sep_2_tc),
no_random_effect = illparms(cyan_saem_full[2:4, ]),
- cluster = cl)
+ cluster = cl_path_2)
```
```{r dependson = "f-saem-2"}
@@ -384,11 +402,11 @@ no_ranef[["sforb_path_2", "const"]] <- c("cyan_free_0",
"f_JCZ38_qlogis", "f_JSE76_qlogis")
no_ranef[["sforb_path_2", "tc"]] <- c("cyan_free_0", "log_k_cyan_free_bound",
"f_JCZ38_qlogis", "f_JSE76_qlogis")
-clusterExport(cl, "no_ranef")
+clusterExport(cl_path_2, "no_ranef")
f_saem_3 <- update(f_saem_2,
no_random_effect = no_ranef,
- cluster = cl)
+ cluster = cl_path_2)
```
```{r dependson = "f-saem-3"}
@@ -413,6 +431,10 @@ two-component error) are lower than in the previous fits with the alternative
pathway, the practical value of these refined evaluations is limited
as no confidence intervals are obtained.
+```{r}
+stopCluster(cl_path_2)
+```
+
\clearpage
# Conclusion

Contact - Imprint