From ee8c8a53903de1a0f480060900b706022af091b6 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 17 Apr 2023 21:53:49 +0200 Subject: 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. --- vignettes/prebuilt/2022_cyan_pathway.rmd | 42 ++++++++++++++++++++++++-------- vignettes/prebuilt/2022_dmta_pathway.rmd | 21 +++++++++++++--- 2 files changed, 49 insertions(+), 14 deletions(-) (limited to 'vignettes/prebuilt') 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 diff --git a/vignettes/prebuilt/2022_dmta_pathway.rmd b/vignettes/prebuilt/2022_dmta_pathway.rmd index ff2b527c..f787daf2 100644 --- a/vignettes/prebuilt/2022_dmta_pathway.rmd +++ b/vignettes/prebuilt/2022_dmta_pathway.rmd @@ -45,10 +45,17 @@ 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) } ``` @@ -163,6 +170,8 @@ m_hs_path_1 <- mkinmod( unload = TRUE, overwrite = TRUE, quiet = TRUE ) +cl <- start_cluster(n_cores) + deg_mods_1 <- list( sfo_path_1 = m_sfo_path_1, fomc_path_1 = m_fomc_path_1, @@ -332,6 +341,10 @@ plot(saem_sforb_path_1_tc_reduced) Plots of the remaining fits and listings for all successful fits are shown in the Appendix. +```{r} +stopCluster(cl) +``` + # Conclusions -- cgit v1.2.1 From 9ae42bd20bc2543a94cf1581ba9820c2f9e3afbd Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 20 Apr 2023 19:53:28 +0200 Subject: Fix and rebuild documentation, see NEWS I had to fix the two pathway vignettes, as they did not work with the released version any more. So they and the multistart vignette which got some small fixes as well were rebuilt. Complete rebuild of the online docs with the released version. The documentation of the 'hierarchial_kinetics' format had to be fixed as well. --- vignettes/prebuilt/2022_cyan_pathway.pdf | Bin 662810 -> 680647 bytes vignettes/prebuilt/2022_cyan_pathway.rmd | 3 +-- vignettes/prebuilt/2022_dmta_pathway.pdf | Bin 607514 -> 607671 bytes vignettes/prebuilt/2022_dmta_pathway.rmd | 3 +-- 4 files changed, 2 insertions(+), 4 deletions(-) (limited to 'vignettes/prebuilt') diff --git a/vignettes/prebuilt/2022_cyan_pathway.pdf b/vignettes/prebuilt/2022_cyan_pathway.pdf index 9d2d22ea..ec37706f 100644 Binary files a/vignettes/prebuilt/2022_cyan_pathway.pdf and b/vignettes/prebuilt/2022_cyan_pathway.pdf differ diff --git a/vignettes/prebuilt/2022_cyan_pathway.rmd b/vignettes/prebuilt/2022_cyan_pathway.rmd index d0b2c889..8463c854 100644 --- a/vignettes/prebuilt/2022_cyan_pathway.rmd +++ b/vignettes/prebuilt/2022_cyan_pathway.rmd @@ -1,7 +1,7 @@ --- title: "Testing hierarchical pathway kinetics with residue data on cyantraniliprole" author: Johannes Ranke -date: Last change on 6 January 2023, last compiled on `r format(Sys.time(), "%e +date: Last change on 20 April 2023, last compiled on `r format(Sys.time(), "%e %B %Y")` output: pdf_document: @@ -542,7 +542,6 @@ for (deg_mod in rownames(f_saem_3)) { ## Session info ```{r, echo = FALSE, cache = FALSE} -parallel::stopCluster(cl = cl) sessionInfo() ``` diff --git a/vignettes/prebuilt/2022_dmta_pathway.pdf b/vignettes/prebuilt/2022_dmta_pathway.pdf index 56534ebf..95d0964d 100644 Binary files a/vignettes/prebuilt/2022_dmta_pathway.pdf and b/vignettes/prebuilt/2022_dmta_pathway.pdf differ diff --git a/vignettes/prebuilt/2022_dmta_pathway.rmd b/vignettes/prebuilt/2022_dmta_pathway.rmd index f787daf2..1e1a0719 100644 --- a/vignettes/prebuilt/2022_dmta_pathway.rmd +++ b/vignettes/prebuilt/2022_dmta_pathway.rmd @@ -1,7 +1,7 @@ --- title: "Testing hierarchical pathway kinetics with residue data on dimethenamid and dimethenamid-P" author: Johannes Ranke -date: Last change on 8 January 2023, last compiled on `r format(Sys.time(), "%e %B %Y")` +date: Last change on 20 April 2023, last compiled on `r format(Sys.time(), "%e %B %Y")` geometry: margin=2cm bibliography: references.bib toc: true @@ -423,7 +423,6 @@ tex_listing(saem_sforb_path_1_tc_reduced, caption) ## Session info ```{r, echo = FALSE} -parallel::stopCluster(cl) sessionInfo() ``` -- cgit v1.2.1