Dynamic QSP reporting with R and Jupiter

This is an example of creation of a dynamic QSP report in R and Jupiter based on heta-compiler and mrgsolve. The content of this file and modeling platform is published in GitHub repository https://github.com/insysbio/insulin-signaling-t2d

Preamble

The QSP model which is used as an example of QSP model was published in the article:

Brannmark C, Nyman E, Fagerholm S, Bergenholm L, Ekstrand EM, Cedersund G, Stralfors P. Insulin Signaling in Type 2 Diabetes: Experimental and modeling analyses reveal mechanisms of insulin resistance in human adipocytes. Journal of biological chemistry.. 2013 288(14):9867–9880. DOI: 10.1074/jbc.M112.432062

The SBML code was downloaded from BioModels https://www.ebi.ac.uk/biomodels/BIOMD0000000448 and used as the part of the Heta-based modeling platform.

The report includes the steps to reproduce simulations from the original article demonstration facilities of the approach and necessary setups.

All necessary files can also be found in the repository.

Preparations

1. Heta compiler

For easier creation of the Heta-based platform install heta compiler.

In command line interface (console) run the code below to create heta platform template

heta init

The minimal content will be created.

Download the SBML model from the database and copy it into src/BIOMD0000000448.xml

Update the src/index.heta with the following content:

heta
// load SBML model as a content of the platform
include BIOMD0000000448_url.xml type sbml

// make the records of a model observable
block {output: true} begin
  measuredIRp;
  measuredIRint;
  measuredIRS1p;
  measuredIRS1307;
  measuredPKB308p;
  measuredPKB473p;
  measuredAS160p;
  measuredmTORC1a;
  measuredS6Kp;
  glucoseuptake;
  measuredmTORC2a;
  measuredS6p;
end

// make insulin to be an input of the model
insulin @Const = 10; // nM

// make IR (insuline resistance) specific parameters to be input of the model
IR_total @Const = 100;    // reduce to 55%
GLUT4_total @Const = 100; // GLUT4 reduce to 50%
diabetes @Const = 1;      // reduce to 15%

// recalculate initial values for IR and base conditions
IR .= IR_total * 99.87/100; // 99.87
IRp .= 0;
IRins .= 0;
IRip .= IR_total * 0.02/100;      // 0.02
IRi .= IR_total * 0.11/100;       // 0.11
//
GLUT4 .= GLUT4_total * 73.48/100;   // 73.48
GLUT4m .= GLUT4_total * 26.52/100;  // 26.52

// variable parameters
k1a @Const = 0.6331;
k1basal @Const = 0.03683;
k1c @Const = 0.8768;
k1d @Const = 31.01;

#export { format: Mrgsolve, filepath: _mrgsolve };

2. Anaconda and Jupiter

Before creation of notebook the Jupiter environment must be installed. For installation steps and R support see documentation part 1 and part 2.

This approach installs a separate R environment of version 0.3.6. It will not use your global installation.

3. R-tools

Download and install the appropriate version of R-Tools. If you use R of version 3.6.1 download and install R-tool of version 3.5. See the compatibility table.

4. Notebook run

In windows search and run anaconda prompt.

Use the name of the created environment and file locations below.

conda activate snowflakes
jupyter notebook --notebook-dir=Y:/PLATFORMS/insulin-signaling-t2d/r-jupiter

Select or create .ipynb file.

Loading platform

Install R, RStudio and add all necessary packages:

# must be run once inside R environment
install.packages('mrgsolve')
install.packages('ggplot2')
install.packages('dplyr')

Load the packages

The approach uses mrgsolve package as a simulation engine and Heta compiler is a connector to SBML and Heta formats. Heta compiler can be run from the R environment. Mind the current working directory and the location of the Heta-based platform: ...

After compiling model it can be loaded into mrgsolve.

Default simulation

To simulate the observables only one line of code is required. Here we are using “chain” with %>% syntax.

Based on the original publication the insuline resistance (IR) can be set by updating three parameters.

Simulation scenarios

Mrgsolve does not operate with "scenario/condition" terms. This functionality can be reproduced by update function.

Advanced visualization

If you need to reshape and visualize different simulation results the easier way is to convert simulation results into data.frame.

The following simulations reproduce the figures from the original paper.

Titration-like simulations

The simulations of another type (not time dependence) can be performed and visualized by applying idata approach. For example in the original article the titration-like experiment is simulated: intake of insulin and measurements of different observables after 10 minutes.

To reproduce the figures the following idata table should be created:

Multiple simulations

idata can also be used to run Monte-Carlo simulations based on parameter variability. For the demonstration purposes we will generate a random set of parameters: k1a, k1basal, k1c, k1d. This simulations mimic the uncertainty in the selected parameters.