aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--R/hierarchical_kinetics.R4
-rw-r--r--_pkgdown.yml4
-rw-r--r--vignettes/prebuilt/2022_cyan_pathway.rmd42
-rw-r--r--vignettes/prebuilt/2022_dmta_pathway.rmd21
4 files changed, 54 insertions, 17 deletions
diff --git a/R/hierarchical_kinetics.R b/R/hierarchical_kinetics.R
index ae60d43c..46623356 100644
--- a/R/hierarchical_kinetics.R
+++ b/R/hierarchical_kinetics.R
@@ -30,7 +30,9 @@
#'
#' \dontrun{
#' library(rmarkdown)
-#' draft("example_analysis.rmd", template = "hierarchical_kinetics", package = "mkin")
+#' # The following is now commented out after the relase of v1.2.3 for the generation
+#' # of online docs, as the command creates a directory and opens an editor
+#' #draft("example_analysis.rmd", template = "hierarchical_kinetics", package = "mkin")
#' }
#'
#' @export
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 5c67d88f..6bf7c14a 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -1,8 +1,8 @@
url: https://pkgdown.jrwb.de/mkin
development:
- mode: devel
- version_label: info
+ mode: release
+ version_label: default
template:
bootswatch: spacelab
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

Contact - Imprint