https://github.com/biometris/sbmlpbk

Package to load SBML PBK models in R for running simulations

https://github.com/biometris/sbmlpbk

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.9%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Package to load SBML PBK models in R for running simulations

Basic Info
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created 11 months ago · Last pushed 9 months ago
Metadata Files
Readme License

README.md

The sbmlpbk package

An R package for importing Physiologically Based Kinetic (PBK) models encoded in the Systems Biology Markup Language (SBML) format, enabling simulation using the deSolve package. This package is still under development.

Installation

Install from GitHub (using the remotes package):

r remotes::install_github("Biometris/sbmlpbk", ref = "main", dependencies = TRUE, build_vignettes = TRUE)

Quickstart

Loading SBML files

To load an SBML model from a file, simply use the load_sbml function. The following example loads the file simple_oral.sbml provided with the package:

``` r

Load package

library(sbmlpbk)

Get filename

filesimpleoral <- system.file("extdata/", "simple_oral.sbml", package = "sbmlpbk")

Load model

model <- loadsbml(filesimple_oral)

Get model summary

summary(model) ```

Running simulations

The code below shows how to run simulations on the model loaded above using the ode function of deSolve.

``` r

Load package deSolve

library(deSolve)

Load model functions

load_functions(model)

Load params

paramscsv <- system.file("extdata/", "simpleoralparams.csv", package = "sbmlpbk") params <- loadparams(model, file = paramscsv, paraminstance = "simple_PARAM")

Set input species

input_species <- "AGut"

Set input events (single unit bolus at time 1)

eventdat <- data.frame(var = c(input_species), time = c(1), value = c(1), method = c("add"))

Set initial states

initial_states <- setNames(rep(0, length(model$species)), names(model$species))

Set simulation times

times <- seq(0, 40, 1)

Load deSolve model function

func <- createdesolvefunc(model)

Simulate

out <- ode( y = initial_states, times = times, func = func, parms = params, events = list(data = eventdat) )

Plot results

plot(out) ```

Helper functions for unit alignment and simulation

sbmlpbk offers a number of functions to make it easier to run simulations with deSolve on loaded models for which time units have been specified. These functions automatically align e.g. time resolution and substance amount units of the model with the desired units for dosing and simulation.

The code below how the functions create_desolve_times and create_desolve_events are used to generate the deSolve timings and events, for a simulation of 10 days with a dosing pattern of a repeated bolus dose with amount 10, starting at day 4, repeating every day until time day 10.

``` r

Create deSolve timings; 10 days with hourly evaluation resolution

times <- createdesolvetimes( model, duration = 10, step = 1/24, unit = 'd' # time unit day )

Create and set deSolve dosing events for the model

eventdat <- createdesolveevents( model, dosingevents = list( list( target = "AGut", dosetype = "repeatedbolus", time = 4, amount = 10, interval = 1, until = 10 ) ), timeunit = 'd', # events time unit was in days amount_unit = 'ug' )

Set initial states

initial_states <- setNames(rep(0, length(model$species)), names(model$species))

Load deSolve model function

func <- createdesolvefunc(model)

Simulate

out <- ode( y = initial_states, times = times, func = func, parms = model$params, events = list(data = eventdat) )

Set up plotting layout

ncols <- 3 nrows <- ceiling(length(model$species) / ncols) par(mfrow = c(nrows, n_cols), mar = c(4, 4, 2, 1))

Loop through species and plot

for (species in names(model$species)) { plot(out[,1], out[,species], type = "l", main = species, xlab = paste("time [", summary(model)$timeunit, "]", sep=""), ylab = paste(species, " [", summary(model)$amountunit, "]", sep="")) } ```

Detailed example

For a more details, see the vignette.

r vignette('sbmlpbk', package='sbmlpbk')

Owner

  • Name: Wageningen Universtiy & Research, Biometris
  • Login: Biometris
  • Kind: organization
  • Email: biometris@wur.nl
  • Location: Wageningen, The Netherlands

Biometris develops statistical and mathematical methods for the quantification of biological processes and processes in our living environment.

GitHub Events

Total
  • Push event: 5
  • Create event: 1
Last Year
  • Push event: 5
  • Create event: 1

Dependencies

DESCRIPTION cran
  • Deriv * imports
  • xml2 * imports
  • deSolve * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • tinytest * suggests