From: "Vanapalli, Sreenivasa" 
Subject:[NMusers] Enterohepatic Circulation!!!
Date:Fri, 31 May 2002 13:16:50 -0700

Hello

I'm trying to model a second peak after oral administration. It looks like
enterohepatic circulation. Can someone suggest me if I'm doing right?

I ran the following model. But output is not showing any second peak. Is
there anything I need to modify the Data file?

Thanks

Sreenivasa Rao Vanapalli, Ph.D.


$PROBLEM  
$INPUT  ID DOSE=AMT TIME DV CMT EVID MDV
$DATA  
$SUBROUTINES ADVAN6 TOL=5

$MODEL NCOMPARTMENTS=6 COMP=(DEPOT, DEFDOSE) COMP=(CENTRAL, DEFOBS)
COMP=(PERI)
                       COMP=(ENT) COMP=(DUMMY1) COMP=(DUMMY2)

$PK (LAGGED)
CALLFL=-2 

KA=THETA(1) 
CL=THETA(2)*EXP(ETA(1))
VC=THETA(3)*EXP(ETA(2)) 
VP=THETA(4) 
Q=THETA(5)
FENT=THETA(6)

ALAG5=THETA(7)
ALAG6=ALAG5+THETA(8)
K24=THETA(9)
K42=THETA(10)

K23=Q/VC
K32=Q/VP 

KEL=CL/VC

IF (NEWIND.LT.2) THEN
EHYN=0 
OLDTIM=0
ENDIF
IF (OLDTIM.EQ.ALAG5) EHYN=1 
IF (OLDTIM.EQ.ALAG6) EHYN=0 

$DES
DADT(1)=-KA*A(1)
DADT(2)=KA*A(1)-(1-FENT)*KEL*A(2)-K23*A(2)+K32*A(3)-FENT*K24*A(2)+EHYN*K42*A
(4)
DADT(3)=K23*A(2)-K32*A(3)
DADT(4)=FENT*K24*A(2)-EHYN*K42*A(4)

DADT(5)=0
DADT(6)=0

$THETA 


$OMEGA 


$ERROR
DEL=0
IF (F.EQ.0) DEL=1
W=F+DEL
Y=F*(1+ERR(1))+ERR(2)
IPRED=F
IRES=DV-IPRED
IWRES=IRES/W

$SIGMA 


Sreenivasa Rao Vanapalli, Ph.D.
Scientist, Pharmacology,
Theravance Inc.,
South San Francisco, CA-94080
Phone: 650-808-6454
Fax    : 650-808-6441 




*******

From:VPIOTROV@PRDBE.jnj.com
Subject:RE: [NMusers] Enterohepatic Circulation!!!
Date:Mon, 3 Jun 2002 10:16:52 +0200


It seems something is missing in your control: 

... 
IF (NEWIND.LT.2) THEN 
EHYN=0 
OLDTIM=0 
ENDIF 
IF (OLDTIM.EQ.ALAG5) EHYN=1 
IF (OLDTIM.EQ.ALAG6) EHYN=0 
; the following is missing 
OLDTIM=DOSTIM 
... 

Best regards, 
Vladimir

*******


From:Johan.Rosenborg@astrazeneca.com
Subject:RE: [NMusers] Enterohepatic Circulation!!!
Date:Sun, 9 Jun 2002 10:52:54 +0200

Sreenivasa and Vladimir,

I have tried to model a second peak (I suspect enterohepatic recirculation,
too) after oral administration using your model Sreenivasa. It seems that
the NEWIND argument and ALAG5 and ALAG6 are ignored, even with your
modification Vladimir - could someone explain this part of the code?

Johan Rosenborg


*******

From:VPIOTROV@PRDBE.jnj.com
Subject:RE: [NMusers] Enterohepatic Circulation!!!
Date:Mon, 10 Jun 2002 21:51:10 +0200

Johan, 

The control used by Sreenivasa was proposed by Stu Beal in his Intermediate
level NONMEM workshop. I recommended to Sreenivasa to include one line of
code because it was in the original control. I did not test it myself. Below you
will find my own control stream which may help you with your problem. It needs
some tuning of course. The idea is to use 2 dummy compartments for switching
EHC on and off. The data set for simulations is attached to this mail. 

Best regards, 
Vladimir 

  
$PROBLEM EHC 
$INPUT ID TIME AMT DV CMT 
$DATA nmd.txt 
$SUB ADVAN9 TOL=5 
$MODEL 
 COMP = (DEPOT,DEFDOSE)  ; 1 
 COMP = (CENTRAL,DEFOBS) ; 2 
 COMP = (GALLBLD)        ; 3 
 COMP = (DUMMY1)         ; 4 
 COMP = (DUMMY2)         ; 5 
$PK 
 CL   = THETA(1) 
 V    = THETA(2) 
 CLBI = THETA(3) ; CL for bile excretion 
 KA   = THETA(4) 
 KREL = THETA(5) ; K for release from gall bladder 
 ALAG4= THETA(6) ; Delay in release 
 ALAG5= ALAG4 + THETA(7) ; Release stop 
  K12 = KA 
  K20 = CL/V 
  K23 = CLBI/V 
  K31 = KREL 
  S2  = V 
$DES 
 DADT(1) = -K12 * A(1) + K31 * A(4) * (1-A(5)) * A(3) 
 DADT(2) =  K12 * A(1) - K20 * A(2) - K23 * A(2) 
 DADT(3) =  K23 * A(2) - K31 * A(4) * (1-A(5)) * A(3) 
 DADT(4) =  0 
 DADT(5) =  0 
$ERROR 
 Y  = F*(1+ERR(1)) 
$THETA 
 (0   2) ; CL 
 (0  50) ; V 
 (0   2) ; CLBI 
 (0   5) ; KA 
 (100 FIX) ; KREL 
 (0   2) ; ALAG4 
 (0  .1) ; ALAG5 
$OMEGA .001 
$SIM (97834) 
$EST

Data Set:

1 0 10 0 1
1 0 1 0 4
1 0 1 0 5
1 0.4 0 1 2
1 0.8 0 1 2
1 1.2 0 1 2
1 1.6 0 1 2
1 2 0 1 2
1 2.4 0 1 2
1 2.8 0 1 2
1 3.2 0 1 2
1 3.6 0 1 2
1 4 0 1 2
1 4.4 0 1 2
1 4.8 0 1 2
1 5.2 0 1 2
1 5.6 0 1 2
1 6 0 1 2
1 6.4 0 1 2
1 6.8 0 1 2
1 7.2 0 1 2
1 7.6 0 1 2
1 8 0 1 2 


*******


From:Johan.Rosenborg@astrazeneca.com
Subject:RE: [NMusers] Enterohepatic Circulation!!!
Date:Tue, 11 Jun 2002 09:06:24 +0200

Vladimir,
 
Thank you very much! Apparently, my problem was that I forgot to insert
unit doses in the dummy compartments. I just got a similar hint via Bengt Hamrén.
 
/ Johan

*******

From:VPIOTROV@PRDBE.jnj.com
Subject:RE: [NMusers] Enterohepatic Circulation!!!
Date:Tue, 11 Jun 2002 16:13:18 +0200


In NONMEM, especially if you deal with complicated models, the data set is in
fact a part of the model. A general advice: if you have troubles first check the
consistency between the control stream and the data set.

Best regards, 
Vladimir

*******


From:Luann Phillips 
Subject:Re: [NMusers] Enterohepatic Circulation!!!
Date:Tue, 11 Jun 2002 17:58:53 -0400

The models suggested work for single dose datasets. If you need to model
enterhepatic circulation for multiple dose datasets, you can use the
code provided below.

This code was adapted from code that Dr. Beal wrote for a model with a
changing Ka value.

Regards,

Luann Phillips
Manager of Pharmacometrics R&D
Cognigen Corporation
395 Youngs Rd.
Williamsville, NY 14221
(716) 633-3463 ext. 236


$PROB ENTEROHEPATIC Circulation for multiple doses - GB Empties twice
following each dose

;Data Description
; Doses of Drug go into CMT=1 with ADDL=10 and II=24
; Dummy Dose into CMT=5 with ADDL=10, II=24, and AMT=1
; Dummy Dose into CMT=6 with ADDL=10, II=24, and AMT=1
; Dummy Dose into CMT=7 with ADDL=10, II=24, and AMT=1 
; Dummy Dose into CMT=8 with ADDL=10, II=24, and AMT=1

; Structural Model
; 3 compartment model plus a depot compartment
; compartment 1 serves as the depot
; compartment 2 and 3 serve as a standard 2 cmt model (central + peri.)
; compartment 4 represents the gall bladder (GB)

; To control the 'on' and 'off' of flow to the GB and from the GB to the
depot a 'change point'
;  modeling technique will be used. This technique uses dummy dose
compartments
;  to allow the estimation of lag times which will be used to control
the 
;  on-off switch for transport to and from the GB.

;   flow into the GB (K24) will be 'on' from 0 to 8 hours after each
dose and
;      then will be turned 'off' until the following dose
;   flow from the GB to the depot compartment (K41) will be turned 'on'
at 
;      the time of lunch and dinner(known times) and turned 'off' at an
estimated time later



$INPUT ID TIME AMT DV CMT EVID ADDL II
$DATA 

$SUBROUTINES ADVAN6 TRANS1 TOL=5

$MODEL 
  COMP=(DEPOT,DEFDOSE,INITIALOFF);dosing compartment - also used to turn
on GB entry
  COMP=(CENTRAL,NODOSE,DEFOBS)   ;central compartment
  COMP=(PERI,NODOSE)             ;peripherial compartment
  COMP=(GB,NODOSE)               ;gall bladder
  COMP=(GB4ON)                   ;dummy cmt to turn on GB exit at lunch
  COMP=(GB4OFF)                  ;dummy cmt to turn off GB exit at lunch
  COMP=(GB8ON)                   ;dummy cmt to turn on GB exit at dinner
and turn off GB entry
  COMP=(GB8OFF)                  ;dummy cmt to turn off GB exit at
dinner


$PK

;this allows PK to be called at LAGGED dose times - critical
  CALLFL=-2

  KA=THETA(1)
  ALAG1=THETA(2)

  TVCL=THETA(3)
  CL=TVCL*EXP(ETA(1))

  TVVC=THETA(4)
  V2=TVVC*EXP(ETA(2))

;flows to and from the peripherial compartment
  K23=THETA(5)
  K32=THETA(6)

;to prevent drug from accumulating in the gall bladder after the gall
bladder empties
; K24 will be turned off from the last modeled time the gall bladder
empties for a day 
; until the next day
;K24= flow from central to the gall bladder (this will be turned on and
off)
;K41= flow from gall bladder to depot (this will be turned on and off)
  K24=THETA(7)
  K41=THETA(8)


;for this model it was assumed that the amount of elapsed time the gall
bladder exit rate will
; be on each time it empties will be the same (GBL)

;ALAG5 and ALAG7 were set to fixed values based upon the known time of
lunch and dinner
; 0.0001 was added in each case to prevent the possibility of an
infinite value of OBJ value
; because the dataset had PK samples at time=4 and time=8
;ALAG5 AND ALAG7 could be estimated

GBL=THETA(9)

ALAG5=4.0001
ALAG6=ALAG5+GBL
ALAG7=8.0001
ALAG8=ALAG7+GBL

;SCALE FACTOR
S2=V2/1000

;the following code sets up indicator variables to control K24 and K41
in the
; $DES block- JON/JOFF/Z control K41 and GBON/GBOFF/Z2 control K24

;first record in an individual K24 is 'on' and K41 is 'off'
IF(NEWIND.LT.2)THEN
JON=0
JOFF=1
GBON=1
GBOFF=0
ENDIF

;set the values of the on'off indicator variables
IF(JON.EQ.1) Z=1
IF(JOFF.EQ.1) Z=0
IF(GBON.EQ.1) Z2=1
IF(GBOFF.EQ.1) Z2=0

;reset control switches to zero - note these do not change the value of
Z or Z2
JON=0
JOFF=0
GBON=0
GBOFF=0

;note that DOSREC(variable)=0 except at the time a dose actually enters
the system
; (doses enter the system at TIME + n*II + ALAG#)

;dose records to cmt 1 should turn on GB entry (K24)
IF(DOSREC(CMT).EQ.1) GBON=1

;dose record to cmt 7 should turn off GB entry (K24)
IF(DOSREC(CMT).EQ.7) GBOFF=1

;dose records to cmt=5 and cmt=7 should turn on GB exit (K41)
IF(DOSREC(CMT).EQ.5.OR.DOSREC(CMT).EQ.7) JON=1

;dose records to cmt=6 or 8 should turn off GB exit (K41)
IF(DOSREC(CMT).EQ.6.OR.DOSREC(CMT).EQ.8) JOFF=1

$DES

K10=CL/V2

DADT(1) = -KA*A(1)+K41*Z*A(4)
DADT(2) = KA*A(1) + K32*A(3) - K23*A(2) - K24*Z2*A(2) - K10*A(2)
DADT(3) = K23*A(2) - K32*A(3)
DADT(4) = K24*Z2*A(2) - K41*Z*A(4)
DADT(5) = 0
DADT(6) = 0
DADT(7) = 0
DADT(8) = 0


$ERROR

  Y = F * (1 + EPS(1))

$THETA 
(0, 0.8)    ;Ka :theta 1
(0, 0.3)    ;lag time for depot 1 cmt:theta 2
(0,20)      ;clearance:theta 3
(0,80)      ;Vc:theta 4
(0,0.15)    ;k23:theta 5
(0,0.09)    ;k32: theta 6      
(0, 0.2)    ;K24:theta 7
(0, 1)      ;K41:theta 8
(0, 0.5)    ;elapsed time GB exit is 'on' (Theta9)

$OMEGA 0.25 0.25
$SIGMA 0.04