+ - 0:00:00
Notes for current slide
Notes for next slide

Tutorial 1: Walk-through of working models


Nan-Hung Hsieh

April 25, 2019

1 / 30

Outline

1. Model file (*.model.R)

2. Input/Simulation file (*.in.R)

3. Tetrachloroethylene PBPK

4. Ethylbenzene PBPK

5. Demo & Exercise

2 / 30

Model

3 / 30

Syntax

# Model description file (this is a comment)
<Global variable specifications>
States = {
<state variables for the model, such as quantity>
}
Outputs = {
<output variables, such as concentration>
}
Inputs = {
<input variables, such as exposure dose>
}
Initialize {
<Equations for initializing or scaling model parameters>
}
Dynamics {
<Equations for computing derivatives of the state variables>
}
CalcOutputs {
<Equations for computing output variables>
}
End. # mandatory ending keyword
4 / 30

# Comments

  • Brief description of this model
  • What is the version number
  • When you create this model
  • Summarize the unit used in this model
## Description ####
# 1-compartment model with 1st-order absorption rate and
# linear elimination
#
# version: 1
#
# Date: 04-25-2019
#
# Units:
# - time in hr
# - volumes in L
# - masses of substances in mg
# - concentrations of substances in mg/L
5 / 30

States

States are variables for which a first-order differential equation is defined in the Dynamics{} section


States = {A_central, # Quantity in central compartment (mg)
A_elim}; # ~ eliminated
6 / 30

Outputs

Outputs are dependent model variables (obtainable at any time as analytical functions of the states, inputs or parameters) that do not have dynamics.

They must receive assignments in either the Dynamics{} or CalcOutputs{} sections.


Outputs = {C_central, # Concentration in central compartment (mg/l)
A_total}; # Total quantity for mass balance
7 / 30

Inputs

Inputs are variables independent of the others variables, but eventually varying with time (for example an exposure concentration to a chemical).


Inputs = {Oral_input}; # Chemical input (mg)
8 / 30

Global variable specifications

# Chemical-specific parameter
Ke = 0.1; # Elimination rate constant (1/h)
Pct_M_central = 0.05; # % body weight, fractional volume of distribution
# Physiological-specific parameter
BW = 60; # Body weight (kg)
# Exposure parameter
OralDose = 100; # Oral dose (mg/kg)
Period = 12.0; # period of the exposure/no exposure cycle (h)
Tlag = 0.0; # Absorption lagtime (h)
Ka = 0.1; # Intestinal absorption rate constant (1/h)
# Scale parameter computed in Initialize
V_central; # Distribution volume of central compartment (L)
IngDose; # Ingested dose (mg)
Oral_input = PerExp (IngDose, Period, Tlag, Ka);

[*] The Oral_input can be defined in input file

9 / 30

Initialize{}

The equations given in this section will define a function (subroutine) that will be called by GNU MCSim after the assignments specified in each Simulation section are done.


Initialize {
IngDose = BW * OralDose;
V_central = BW * Pct_M_central;
}
10 / 30

Dynamics{}

The equations given in this section will be called by the integration routines at each integration step.


Dynamics {
dt (A_elim) = Ke * A_central;
dt (A_central) = Ka * Oral_input - Ke * A_central;
}
11 / 30

CalcOutputs{}

The equations given in this section will be called by the simulation program at each output time.


CalcOutputs {
C_central = A_central / V_central;
A_total = A_central + A_elim;
}
12 / 30

Common pitfalls

** Error: End keyword is missing in file modeling/one.model.R.
One or more fatal errors: Exiting...
** Error: State variable 'A_central' has no dynamics.
State equations missing.
One or more fatal errors: Exiting...
** Error: Output variable 'A_total' is not computed anywhere.
Output equations missing.
One or more fatal errors: Exiting...
** Error: line 37: Undefined identifier 'Period'.
One or more fatal errors: Exiting...
** Error: Output variable 'l' is not computed anywhere.
Output equations missing.
One or more fatal errors: Exiting...
13 / 30

Input / Simulation

14 / 30

Syntax

# Input-file (text after # are comments)
<Global assignments and specifications>
Simulation {
<Local assignments and specifications>
<Specifications for first simulation>
}
Simulation {
<Local assignments and specifications>
<Specifications for second simulation>
}
# Unlimited number of simulation specifications
End. # Mandatory End keyword. Everything after this line is ignored
15 / 30

Moving back to the MCSim syntax, this is an example of basic simulation. The only thing you need to do is provide the given condition in your simulation, which is the output time points and the output variables.

You can also use multiple sections to define your simulation. For example, the simulation one can be used to specify the low dose exposure scenario and the second section can be used to specified the high dose exposure scenario.

Input functions

These functions can use to different exposure types

- PerDose(): # specifies a periodic input of constant
PerDose(<magnitude>, <period>, <initial-time>, <exposure-time>);
- PerExp(): # specifies a periodic exponential input.
PerExp(<magnitude>, <period>, <initial-time>, <decay-constant>);
- PerTransit(): models a delayed input mechanism
PerTransit(<magnitude>, <period>, <initial-time-in-period>,
<decay-constant>, <number-of-input-compartments>);
- NDoses(): specifies a number of stepwise inputs of variable magnitude and their starting times
NDoses(<n>, <list-of-magnitudes>, <list-of-initial-times>);
- Spikes(): specifies a number of instantaneous inputs of variable magnitude and their exact times of occurrence.
Spikes(<n>, <list-of-magnitudes>, <list-of-times>);
16 / 30

Here is the list of supported input function in MCSim that can be used to describe the different exposure type. For example, the first one PerDose can be used to describe the periodic intake of the specific compound, so we can use this method to predict the steady state under the particular exposure scenario.

Besides, the NDoses function can let you used the different level of exposure and the starting time points based on the exposure scenario. Also, in pharmacology research, the spikes function can be used to describe the intravenous PK data.

Example: One-compartment model

# ./mcsim.one.model.R.exe one.in.R
Integrate (Lsodes, 1e-12, 1e-15, 1);
Period = 1E6; # One-time dose
Ka = 1.3;
Pct_M_central = 1;
Simulation { # 1
OralDose = 100;
BW = 60;
PrintStep (Oral_input, A_central, A_elim, A_total, C_central, 0, 96, 0.5);
}
Simulation { # 2
OralDose = 150;
BW = 80;
PrintStep (Oral_input, A_central, A_elim, A_total, C_central, 0, 96, 0.5);
}
End.
17 / 30

Common pitfalls

Error: line 10: Expected <model-variable> before 'Kb'
Reading experiment 1.
Error: line 14: Bad definition of experiment 1
Error: line 11: Expected ';' before 'S'.
Error: line 15: Unclosed level statement
Fatal errors. Exiting.
18 / 30

Toxicokinetic Modeling of Tetrachloroethylene

19 / 30

Toxicokinetic Modeling of Ethylbenzene

20 / 30

Demo & Exercise

21 / 30

Exercise 1

Run EB-PBPK model under 100 ppm exposure for 4 hours and plot the time-course of blood concentration from 0 to 6 hour.


Input file: EB_exercise_1.in.R

# ./mcsim.EB.model.R.exe EB_exercise_1.in.R
Integrate (Lsodes, 1e-9, 1e-11 , 1);
Simulation {
# Inhalation concentration in ppm
Cppm = NDoses (2, 100, 0, 0, 4 );
PrintStep(Cvtot, 0, 6, 0.01);
}
End.
22 / 30

Exercise 2

Estimate the steady-state of arterial and venous blood concentrations associated with EB exposures (0.1 ppm to 1000 ppm).

23 / 30

Input file: EB_exercise_2.in.R

# ./mcsim.EB.model.R.exe EB_exercise_2.in.R
Integrate (Lsodes, 1e-9, 1e-11 , 1);
Simulation { # 1 1 ppm
# Inhalation concentration in ppm
Cppm = NDoses (2, 1, 0, 0, 96 );
PrintStep(Cart, Cvtot, 0, 96, 1);
}
Simulation { # 2 10 ppm
# Inhalation concentration in ppm
Cppm = NDoses (2, 10, 0, 0, 96 );
PrintStep(Cart, Cvtot, 0, 96, 1);
}
Simulation { # 3 100 ppm
# Inhalation concentration in ppm
Cppm = NDoses (2, 100, 0, 0, 96 );
PrintStep(Cart, Cvtot, 0, 96, 1);
}
Simulation { # 4 1000 ppm
# Inhalation concentration in ppm
Cppm = NDoses (2, 1000, 0, 0, 96 );
PrintStep(Cart, Cvtot, 0, 96, 1);
}
End.
24 / 30

Exercise 3

Construct the relationships for the estimated inhalation exposure level and the fraction of EB metabolized after 8-hr continuous exposure (0.1 ppm to 1000 ppm).

In addition, estimate the percentage metabolized from liver, lung, and richly perfused tissue.

25 / 30

Hint: Add following information in model file:

Amet_Rl, # Amount metabolized in liver (moles)
Amet_Rlu, # Amount metabolized in lung (moles)
Amet_Rvrg # Amount metabolized in richly perfused tissue (moles)
dt(Amet_Rl) = Rl;
dt(Amet_Rlu) = Rlu;
dt(Amet_Rvrg) = Rvrg;
26 / 30

Input file: EB_exercise_3.in.R

# ./mcsim.EB.model.R.exe EB_exercise_3.in.R
Integrate (Lsodes, 1e-9, 1e-11 , 1);
Simulation { # 1 1 ppm
# Inhalation concentration in ppm
Cppm = NDoses (2, 1, 0, 0, 8 );
PrintStep(Ain, Amet_Rl, Amet_Rlu, Amet_Rvrg, Amet, 0, 8, 0.5);
}
Simulation { # 2 10 ppm
# Inhalation concentration in ppm
Cppm = NDoses (2, 10, 0, 0, 8 );
PrintStep(Ain, Amet_Rl, Amet_Rlu, Amet_Rvrg, Amet, 0, 8, 0.5);
}
Simulation { # 3 100 ppm
# Inhalation concentration in ppm
Cppm = NDoses (2, 100, 0, 0, 8 );
PrintStep(Ain, Amet_Rl, Amet_Rlu, Amet_Rvrg, Amet, 0, 8, 0.5);
}
Simulation { # 4 1000 ppm
# Inhalation concentration in ppm
Cppm = NDoses (2, 1000, 0, 0, 8 );
PrintStep(Ain, Amet_Rl, Amet_Rlu, Amet_Rvrg, Amet, 0, 8, 0.5);
}
End.
27 / 30

Exercise 4

Add additional exposure routes include oral ingestion in the EB-PBPK model and estimate the Cmax and Tmax after received a single gavage dose of 180 mg/kg.

28 / 30

Hint: Add following information in model file:

Oral_input
PO_dose = 0.0; # Ingested dose (mg/kg)
Oral_dose; # Oral dose (mg)
Period = 1e2; # Period of the exposure/no exposure cycle (h)
Tlag = 0.0; # Absorption lagtime (h)
Ka = 1.0; # Intestinal absorption rate constant (1/h)
Oral_input = PerExp (Oral_dose, Period, Tlag, Ka);
Oral_dose = PO_dose * BW;
dt(Al) = Oral_input + Ql*(Cart - Cvl) - Rl;
29 / 30

Input file: EB_exercise_4.in.R

# ./mcsim.EB.model.R.exe EB_exercise_4.in.R
Integrate (Lsodes, 1e-9, 1e-11 , 1);
Simulation { # 1
PO_dose = 180;
Ka = 0.6;
PrintStep(Oral_input, Cvtot, 0, 24, 0.1);
}
End.
30 / 30

Outline

1. Model file (*.model.R)

2. Input/Simulation file (*.in.R)

3. Tetrachloroethylene PBPK

4. Ethylbenzene PBPK

5. Demo & Exercise

2 / 30
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow