Exercise PK51 - Multi-compartment drug/metabolite

2020-11-12

Background

  • Structural model - Multi-Compartment Drug/metabolite

  • Route of administration - IV administration to one subject and Oral administration to another subject

  • Dosage Regimen - 5000 mg IV and 8000 mg Oral

  • Number of Subjects - 2

PK06 Graphic Model

Learning Outcome

In this model, drug is administered both IV and orally at different occasions to different subjects and plasma data is collected, The concentrations are obtained for both the drugs and metabolite. This will help you learn the two compartment parent - metabolite kinetics

Objectives

In this tutorial, you will learn how to build multi compartment drug/metabolite model and to simulate the model for different subjects and dosage regimens.

Libraries

call the "necessary" libraries to get start.

using Pumas
using Plots
using CSV
using StatsPlots
using Random

Model

In this one compartment model, we administer dose on oral and central compartment at two different occasions.

pk_51               = @model begin
  @param begin
    tvvc             RealDomain(lower=0)
    tvcl             RealDomain(lower=0)
    tvcld            RealDomain(lower=0)
    tvvt             RealDomain(lower=0)
    tvvcm            RealDomain(lower=0)
    tvclm            RealDomain(lower=0)
    tvcldm           RealDomain(lower=0)
    tvvtm            RealDomain(lower=0)
    tvka             RealDomain(lower=0)
    tvf              RealDomain(lower=0)
    tvlag            RealDomain(lower=0)
    Ω                PDiagDomain(9)
    σ²_prop_cp       RealDomain(lower=0)
    σ²_prop_met      RealDomain(lower=0)
  end

  @random begin
    η               ~ MvNormal(Ω)
  end

  @pre begin
    Vc              = tvvc * exp(η[1])
    Cl              = tvcl * exp(η[2])
    Cld             = tvcld * exp(η[3])
    Vt              = tvvt * exp(η[4])
    Vcm             = tvvcm * exp(η[5])
    Clm             = tvclm * exp(η[6])
    Cldm            = tvcldm * exp(η[7])
    Vtm             = tvvtm * exp(η[8])
    Ka              = tvka * exp(η[9])
    bioav           = (Depot = tvf , Metabolite = (1-tvf))
    lags            = (Depot = tvlag,)
  end

  @dynamics begin
    Depot'          = -Ka*Depot
    Central'        =  Ka*Depot - (Cl/Vc)*Central - (Cld/Vc)*Central + (Cld/Vt)*Peripheral
    Peripheral'     = (Cld/Vc)*Central - (Cld/Vt)*Peripheral
    Metabolite'     =  Ka*Depot + (Cl/Vc)*Central - (Clm/Vcm)*Metabolite - (Cldm/Vcm)*Metabolite + (Cldm/Vtm)*PeriMetabolite
    PeriMetabolite' = (Cldm/Vcm)*Metabolite - (Cldm/Vtm)*PeriMetabolite
  end

  @derived begin
    cp              = @. Central/Vc
    dv_cp           ~ @. Normal(cp, sqrt(cp^2*σ²_prop_cp))
    met             = @. Metabolite/Vcm
    dv_met          ~ @. Normal(met, sqrt(met^2*σ²_prop_met))
  end
end
PumasModel
  Parameters: tvvc, tvcl, tvcld, tvvt, tvvcm, tvclm, tvcldm, tvvtm, tvka, t
vf, tvlag, Ω, σ²_prop_cp, σ²_prop_met
  Random effects: η
  Covariates: 
  Dynamical variables: Depot, Central, Peripheral, Metabolite, PeriMetaboli
te
  Derived: cp, dv_cp, met, dv_met
  Observed: cp, dv_cp, met, dv_met

Parameters

The parameters are as given below. tv represents the typical value for parameters.

  • Cl - Clearance (L/hr)

  • Clm - Clearance of metabolite (L/hr)

  • Cld - Inter Compartmental Clearance (L/hr)

  • Cldm - Inter Compartmental Clearance of metabolite (L/hr)

  • Vc - Volume of Central Compartment (L)

  • Vcm - Volume of Central Compartment of Metabolite (L)

  • f - Fraction of drug absorbed

  • lags - Lag time (hr)

  • Ka - Absorption rate constant (hr⁻¹)

  • Vt - Volume of Peripheral Compartment (L)

  • Vtm - Volume of Peripheral Compartment of metabolite (L)

  • Ω - Between Subject Variability

  • σ - Residual error

param = ( tvvc        = 18.7,
          tvcl        = 0.55,
          tvcld       = 0.073,
          tvvt        = 10,
          tvvcm       = 4.9,
          tvclm       = 0.08,
          tvcldm      = 0.58,
          tvvtm       = 55,
          tvka        = 0.03,
          tvf         = 0.24,
          tvlag       = 21,
          Ω           = Diagonal([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]),
          σ²_prop_cp  = 0.015,
          σ²_prop_met = 0.015)
(tvvc = 18.7, tvcl = 0.55, tvcld = 0.073, tvvt = 10, tvvcm = 4.9, tvclm = 0
.08, tvcldm = 0.58, tvvtm = 55, tvka = 0.03, tvf = 0.24, tvlag = 21, Ω = [0
.0 0.0 … 0.0 0.0; 0.0 0.0 … 0.0 0.0; … ; 0.0 0.0 … 0.0 0.0; 0.0 0.0 … 0.0 0
.0], σ²_prop_cp = 0.015, σ²_prop_met = 0.015)

Dosage Regimen

IV

A single dose of 5000 mg given as a rapid IV injection

ev1  = DosageRegimen(5000, time=0, cmt=2)
sub1 = Subject(id=1, events=ev1)
Subject
  ID: 1
  Events: 1
ORAL

A single dose of 8000 mg given orally

ev2      = DosageRegimen(8000, time=0, cmt=1)
sub2     = Subject(id=2, events=ev2)
pop2_sub = [sub1,sub2]
Population
  Subjects: 2
  Covariates:

Simulation

Simulate using the simobs function.

Random.seed!(123)
sim_pop2_sub = simobs(pk_51, pop2_sub, param, obstimes=0:0.1:1500)
df1          = DataFrame(sim_pop2_sub);

Dataframe & Plot

Use the dataframe for plotting

df1_dv  = filter(x -> x.time in [2,5,10,15,30,45,60,90,120,180,240,360,480,720,1440], df1)
df1_id1 = filter(x -> x.id == "1", df1)
df1_id2 = filter(x -> x.id == "2", df1)

@df df1_id1 plot(:time, :cp, yaxis=:log, legend=:bottomright,
                 title="Concentratio vs Time",  xlabel="Time (min)", ylabel="Concentration (..)", label="Pred - ID1 Parent", linewidth=3,
                 yticks=[0.01,0.1,1,10,100,1000], ylims=(0.01,1000), xticks=[0,150,300,450,600,750,900,1050,1200,1350,1500], xlims=(0,1500))
@df df1_id2 plot!(:time, :cp, label="Pred - ID2 Parent", linewidth=3)
@df df1_id1 plot!(:time, :met, label="Pred - ID1 Metabolite", linewidth=3)
@df df1_id2 plot!(:time, :met, label="Pred - ID2 Metabolite", linewidth=3)
@df df1_dv scatter!(:time, :dv_cp, label="Obs - Parent")
@df df1_dv scatter!(:time, :dv_met, label="Obs - Metabolite")