using Random
using Pumas
using PumasUtilities
using AlgebraOfGraphics
using CairoMakie
using CSV
using DataFramesMeta
using Dates
PK09 - Modeling of fraction absorbed and nonlinear bioavailability across the liver
1 Background
- Structural model - Two compartment model with non-linear elimination from the hepatic compartment
- Route of administration - Oral and IV on separate occasions
- Dosage Regimen - 2 μmol/kg IV and 6 μmol/kg Oral
- Number of Subjects - 1
2 Learning Outcomes
Semi-physiologic model with elimination from the hepatic compartment and dose administered by IV bolus. The drug follows a two compartment model. This data was modeled taking into account the hepatic elimination component and hepatic blood flow. Hepatic distribution and elimination from the liver is modeled as an additional compartment with physiological values of blood flow reported from the literature. Oral doses are administered into a Depot. This Depot compartment was connected to the liver compartment. This study was conducted with an Oral suspension of 6 μmol/kg and an IV bolus of 2 μmol/kg.
3 Objective
The exercise aims to simulate data using a two compartment model and an additional hepatic compartment. The elimination is non-linear metabolic clearance from the liver. In the case of oral administration, the administered dose reaches the hepatic compartment with a lag-time.
4 Libraries
Call the necessary libraries to get started
5 Model
This model is written for both oral and IV dosing regimen
= @model begin
pk_09 @metadata begin
= "Semi-Physiologic Model"
desc = u"hr"
timeu end
@param begin
"""
Volume of Central Compartment (L/kg)
"""
∈ RealDomain(lower = 0)
tvvc """
Inter-compartmental Clearance (L/hr/kg)
"""
∈ RealDomain(lower = 0)
tvq """
Volume of Peripheral Compartment (L/kg)
"""
∈ RealDomain(lower = 0)
tvvp """
Maximum Metabolic Rate (μmol/hr/kg)
"""
∈ RealDomain(lower = 0)
tvvmax """
Michaelis Menton Constant (μmol/L)
"""
∈ RealDomain(lower = 0)
tvkm """
Absorption Rate Constant (hr⁻¹)
"""
∈ RealDomain(lower = 0)
tvka """
Lag-time (hr)
"""
∈ RealDomain(lower = 0)
tvtlag """
Fraction of drug absorbed
"""
∈ RealDomain(lower = 0)
tvfa ∈ PDiagDomain(8)
Ω """
Proportional RUV
"""
∈ RealDomain(lower = 0)
σ²_prop end
@random begin
~ MvNormal(Ω)
η end
@pre begin
= tvvc * exp(η[1])
Vc = tvq * exp(η[2])
Q = tvvp * exp(η[3])
Vp = tvvmax * exp(η[4])
Vmax = tvkm * exp(η[5])
Km = tvka * exp(η[6])
Ka = 3.3
Qh = 0.02
Vh end
@dosecontrol begin
= (Depot = tvtlag * exp(η[7]),)
lags = (Depot = tvfa * exp(η[8]),)
bioav end
@vars begin
:= Vmax * (Hepatic / Vh) / (Km + (Hepatic / Vh))
VMKM end
@dynamics begin
' = -Ka * Depot
Depot' = Ka * Depot - (Qh / Vh) * Hepatic + (Qh / Vc) * Central - VMKM
Hepatic' =
Central/ Vh) * Hepatic - (Qh / Vc) * Central - (Q / Vc) * Central +
(Qh / Vp) * Peripheral
(Q ' = (Q / Vc) * Central - (Q / Vp) * Peripheral
Peripheralend
@derived begin
= @. Central / Vc
cp """
Observed Concentration (μg/L)
"""
~ @. Normal(cp, sqrt(cp^2 * σ²_prop))
dv end
end
PumasModel
Parameters: tvvc, tvq, tvvp, tvvmax, tvkm, tvka, tvtlag, tvfa, Ω, σ²_prop
Random effects: η
Covariates:
Dynamical system variables: Depot, Hepatic, Central, Peripheral
Dynamical system type: Nonlinear ODE
Derived: cp, dv
Observed: cp, dv
6 Parameters
Parameters provided for simulation. Note that tv
represents the typical value for parameters.
Vc
- Volume of Central Compartment (L/kg)Q
- Intercompartmental Clearance (L/kg)Vp
- Volume of Peripheral Compartment (L/kg)Vmax
- Maximum Metabolic Rate (μmol/hr/kg)Km
- Michaelis Menton Constant (μmol/L)Ka
- Absorption Rate Constant (hr⁻¹)fa
- Fraction of drug absorbedtlag
- lag time (hr)
= (
param = 0.34,
tvvc = 1.84,
tvq = 0.38,
tvvp = 0.13,
tvvmax = 0.31,
tvkm = 11.3,
tvka = 0.38,
tvfa = 0.062,
tvtlag = Diagonal([0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04, 0.04]),
Ω = 0.001,
σ²_prop )
7 Dosage Regimen
7.1 Oral
Dose of 6 μmol/kg is administered orally at time=0
= DosageRegimen(6, time = 0, cmt = :Depot) ev1
Row | time | cmt | amt | evid | ii | addl | rate | duration | ss | route |
---|---|---|---|---|---|---|---|---|---|---|
Float64 | Symbol | Float64 | Int8 | Float64 | Int64 | Float64 | Float64 | Int8 | NCA.Route | |
1 | 0.0 | Depot | 6.0 | 1 | 0.0 | 0 | 0.0 | 0.0 | 0 | NullRoute |
= Subject(id = "1: PO", events = ev1) sub1
Subject
ID: 1: PO
Events: 1
7.2 IV
Dose of 2 μmol/kg is administered as IV-bolus at time=0
= DosageRegimen(2, time = 0, cmt = :Central) ev2
Row | time | cmt | amt | evid | ii | addl | rate | duration | ss | route |
---|---|---|---|---|---|---|---|---|---|---|
Float64 | Symbol | Float64 | Int8 | Float64 | Int64 | Float64 | Float64 | Int8 | NCA.Route | |
1 | 0.0 | Central | 2.0 | 1 | 0.0 | 0 | 0.0 | 0.0 | 0 | NullRoute |
= Subject(id = "2: IV", events = ev2) sub2
Subject
ID: 2: IV
Events: 1
8 Simulation
8.1 Oral
Random.seed!(123)
The random effects are zero’ed out since we are simulating means
= zero_randeffs(pk_09, sub1, param) zfx
(η = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],)
=
sim_sub1_oral simobs(pk_09, sub1, param, zfx, obstimes = [0.08333, 0.25, 0.5, 1, 2, 4, 6, 8, 23])
SimulatedObservations
Simulated variables: cp, dv
Time: [0.08333, 0.25, 0.5, 1.0, 2.0, 4.0, 6.0, 8.0, 23.0]
8.2 IV
The random effects are zero’ed out since we are simulating means
= zero_randeffs(pk_09, sub2, param) zfx
(η = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],)
= simobs(
sim_sub2_iv
pk_09,
sub2,
param,
zfx,= [0.0056, 0.03333, 0.13333, 0.25, 0.75, 1, 2, 3, 4, 6, 8, 10, 12, 15, 20, 23],
obstimes )
SimulatedObservations
Simulated variables: cp, dv
Time: [0.0056, 0.03333, 0.13333, 0.25, 0.75, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 12.0, 15.0, 20.0, 23.0]
9 Visualization
= @chain DataFrame(sim_sub1_oral) begin
po_plt @rtransform :Route = "Oral"
dropmissing(:cp)
data(_) *
mapping(:time => "Time (hours)", :cp => "PK9 Concentration (μM)", color = :Route) *
visual(ScatterLines, color = :blue, linewidth = 4)
end
= @chain DataFrame(sim_sub2_iv) begin
iv_plt @rtransform :Route = "IV"
dropmissing(:cp)
data(_) *
mapping(:time => "Time (hours)", :cp => "PK9 Concentration (μM)", color = :Route) *
visual(ScatterLines, color = :black, linewidth = 4)
end
draw(
+ iv_plt;
po_plt = (;
axis = 0:5:25,
xticks = map(i -> 10^i, -1:0.5:1),
yticks = log10,
yscale = x -> string.(round.(x; digits = 1)),
ytickformat = 3,
ygridwidth = true,
yminorticksvisible = true,
yminorgridvisible = IntervalsBetween(20),
yminorticks = true,
xminorticksvisible = true,
xminorgridvisible = IntervalsBetween(5),
xminorticks
),= (; fontsize = 22),
figure )
10 Population simulation
= (
par = 0.34,
tvvc = 1.84,
tvq = 0.38,
tvvp = 0.13,
tvvmax = 0.31,
tvkm = 11.3,
tvka = 0.38,
tvfa = 0.062,
tvtlag = Diagonal([0.0081, 0.044, 0.0081, 0.0121, 0.184, 0.0225, 0.0009, 0.0025]),
Ω = 0.0152,
σ²_prop
)
## Oral
= DosageRegimen(6, time = 0, cmt = :Depot)
ev1 = map(i -> Subject(id = i, events = ev1), 1:30)
pop_oral
Random.seed!(1234)
=
sim_pop_oral simobs(pk_09, pop_oral, par, obstimes = [0.08333, 0.25, 0.5, 1, 2, 4, 6, 8, 23])
= DataFrame(sim_pop_oral)
df_pop_oral :route] .= "Oral"
df_pop_oral[!,
## IV
= DosageRegimen(2, time = 0, cmt = :Central)
ev2 = map(i -> Subject(id = i, events = ev2), 1:30)
pop_iv
Random.seed!(1234)
= simobs(
sim_pop_iv
pk_09,
pop_iv,
par,= [0.0056, 0.03333, 0.13333, 0.25, 0.75, 1, 2, 3, 4, 6, 8, 10, 12, 15, 20, 23],
obstimes
)sim_plot(sim_pop_iv)
= DataFrame(sim_pop_iv)
df_pop_iv :route] .= "IV"
df_pop_iv[!,
= vcat(df_pop_oral, df_pop_iv);
df_sim
#CSV.write("pk_09.csv", df_sim)