# Specify the SFO model (this is not needed any more, as we can now mkinfit("SFO", ...)
SFO <- mkinmod(parent = mkinsub("SFO"))
# One parent compound, one metabolite, both single first order
SFO_SFO <- mkinmod(
parent = mkinsub("SFO", "m1"),
m1 = mkinsub("SFO"))
print(SFO_SFO)
if (FALSE) {
fit_sfo_sfo <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE, solution_type = "deSolve")
# 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"),
name = "SFO_SFO", dll_dir = DLL_dir, unload = TRUE, overwrite = TRUE)
# 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")
# Show details of creating the C function
SFO_SFO <- mkinmod(
parent = mkinsub("SFO", "m1"),
m1 = mkinsub("SFO"), verbose = TRUE)
# The symbolic solution which is available in this case is not
# made for human reading but for speed of computation
SFO_SFO$deg_func
# If we have several parallel metabolites
# (compare tests/testthat/test_synthetic_data_for_UBA_2014.R)
m_synth_DFOP_par <- mkinmod(
parent = mkinsub("DFOP", c("M1", "M2")),
M1 = mkinsub("SFO"),
M2 = mkinsub("SFO"),
quiet = TRUE)
fit_DFOP_par_c <- mkinfit(m_synth_DFOP_par,
synthetic_data_for_UBA_2014[[12]]$data,
quiet = TRUE)
}
Run the code above in your browser using DataLab