system_fetch_template function

Create New Analysis Template

Create New Analysis Template

Building a system file will produce templates for R and other languages. This function provides a method to make local copies of these templates.

system_fetch_template( cfg, template = "Simulation", overwrite = FALSE, output_directory = getwd() )

Arguments

  • cfg: ubiquity system object
  • template: template type
  • overwrite: if TRUE the new system file will overwrite any existing files present
  • output_directory: directory where workshop files will be placed (getwd())

Returns

List with vectors of template sources, destinations

and corresponding write success (write_file), also a list element indicating the overall success of the function call (isgood)

Details

The template argument can have the following values for the R workflow:

  • "Simulation" produces analysis_simulate.R: R-Script named with placeholders used to run simulations
  • "Estimation" produces analysis_estimate.R: R-Script named with placeholders used to perform naive-pooled parameter estimation
  • "NCA" produces analysis_nca.R: R-Script to perform non-compartmental analysis (NCA) and report out the results
  • "ShinyApp" produces ubiquity_app.R, server.R and ui.R: files needed to run the model through a Shiny App either locally or on a Shiny Server
  • "Model Diagram" produces system.svg: SVG template for producing a model diagram (Goto https://inkscape.org for a free SVG editor)
  • "Shiny Rmd Report" produces system_report.Rmd and test_system_report.R: R-Markdown file used to generate report tabs for the Shiny App and a script to test it

And this will create files to use in other software:

  • "Adapt" produces system_adapt.for and system_adapt.prm: Fortran and parameter files for the currently selected parameter set in Adapt format.
  • "Berkeley Madonna" produces system_berkeley_madonna.txt: text file with the model and the currently selected parameter set in Berkeley Madonna format
  • "nlmixr" produces system_nlmixr.R For the currently selected parameter set to define the system in the nlmixr format.
  • "NONMEM" produces system_nonmem.ctl For the currently selected parameter set as a NONMEM conntrol stream.
  • "Monolix" produces system_monolix.txt and system_monolix.mlxtran For the currently selected parameter set.
  • "mrgsolve" produces system_mrgsolve.cpp: text file with the model and the currently selected parameter set in mrgsolve format

Examples

# Creating a system file from the mab_pk example fr = system_new(file_name = "system.txt", system_file = "mab_pk", overwrite = TRUE, output_directory = tempdir()) # Building the system cfg = build_system(system_file = file.path(tempdir(), "system.txt"), output_directory = file.path(tempdir(), "output"), temporary_directory = tempdir()) # Creating a simulation template fr = system_fetch_template(cfg, template = "Simulation", output_directory = tempdir())
  • Maintainer: John Harrold
  • License: BSD_2_clause + file LICENSE
  • Last published: 2025-01-07