Jump to content


Photo
- - - - -

PML learning


  • Please log in to reply
14 replies to this topic

#1 nehabatra

nehabatra

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 16 December 2016 - 06:02 AM

Hello

I'm a new to PML and I'm attending the PML school webinars.

I actually have a code but i want to write the same in the PML so I need help in it.

The code is-

 

dV/dt = Q * Cp + jiv * I - jvi * V

dI/dt = jvi * V - jiv * I

Cp = A * e^(- a * t) + B * e^(- b * t)

jiv = jvi/s

I = Tumor concentration * Vi

V = Vascular concentration * Vv

s = Vi/Vv

 

 

q1.FF = (A*exp(-a*t) + B*exp(-b*t))*fu

flux(2,4) = k(2,4) * q4

k(2,4)=k(4,2)/s

flux(4,2) = k(4,2) * q2

flux(2,1) = k(2,1) * q1

k(2,1)=Q

flux(0,4) = k(0,4) * q4

s1 = q4/(Vv*s)

 

FF = (A*exp(-a*t) + B*exp(-b*t))*fu

flux(V,I) = k(V,I) * I

k(V,I)=k(I,V)/s

flux(I,V) = k(I,V) * V

flux(V,FF) = k(V,FF) * FF

k(V,FF)=Q

flux(0,I) = k(0,I) * I

s1 = I/(Vv*s)

 

s1 is the tumor sampling site

 

For the compartmental model:

 

dX1/dt = k21 * X2 + k41 * X4 - (k12 + k10 + k13) * X1

dX2/dt = k12 * X1 - k21 * X2

dX3/dt = k13 * X1 - k34 * X3

dX4/dt = k34 * X3 - k41 * X4

 

flux(1,4) = k(1,4) * q4

flux(4,3) = k(4,3) * q3

flux(3,1) = k(3,1) * q1

flux(2,1) = k(2,1) * q1

flux(1,2) = k(1,2) * q2

flux(0,1) = k(0,1) * q1

ex1.bolus = 0.0

ex1.infusion = 0.0

s5 = q4/v4

s4 = q4/v4

s3 = q4/v4

s2 = q1/v1

s1 = q1/v1

 

s1 and s2 are sample concentration from central compartment q1 or X1.

s3, s4 and s are smple concentrations from tumor compartment q4 or X4. 



#2 bwendt@certara.com

bwendt@certara.com

    Advanced Member

  • Administrators
  • 282 posts

Posted 18 December 2016 - 03:27 PM

Your question is about direct translation of your code into PML code. If you want to do that you may want to follow two simple rules:

 

1. for differential equations, please use the deriv() statement, e.g. 

 

your code: 

 

dX1/dt = k21 * X2 + k41 * X4 - (k12 + k10 + k13) * X1

 

would become:

 

deriv(X1= k21 * X2 + k41 * X4 - (k12 + k10 + k13) * X1)

 

2. for algebraic equations, please enter as is, e.g.

 

your code:

 

s5 = q4/v4

 

would still be:

 

s5 = q4/v4

 

 

At the PML School we are trying to adopt a different way of modeling, not just simple translation, but a stepwise buildup of your model. We would start your model by building up the PK model from the built-in options, in this case a 3-compartment model with IV input and micro parametrization:

 

PML_learning_built_in.png

 

We would then switch to Graphical Model Builder and add a second dosepoint (e.g. IV Infusion), another compartment (the 4th one), you adjust the flows and parameter names between the compartments and end up with this:

 

PML_learning_graphical.png

 

This covers the PK part of you model. It is not quite clear how you add the first part of your code to the PK model. Perhaps you can add more description or a graphical representation of your model that would allow us to incorporate that into the model

 

 

Bernd

 



#3 nehabatra

nehabatra

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 19 December 2016 - 05:01 AM

Your question is about direct translation of your code into PML code. If you want to do that you may want to follow two simple rules:

 

1. for differential equations, please use the deriv() statement, e.g. 

 

your code: 

 

dX1/dt = k21 * X2 + k41 * X4 - (k12 + k10 + k13) * X1

 

would become:

 

deriv(X1= k21 * X2 + k41 * X4 - (k12 + k10 + k13) * X1)

 

2. for algebraic equations, please enter as is, e.g.

 

your code:

 

s5 = q4/v4

 

would still be:

 

s5 = q4/v4

 

 

At the PML School we are trying to adopt a different way of modeling, not just simple translation, but a stepwise buildup of your model. We would start your model by building up the PK model from the built-in options, in this case a 3-compartment model with IV input and micro parametrization:

 

attachicon.gifPML_learning_built_in.png

 

We would then switch to Graphical Model Builder and add a second dosepoint (e.g. IV Infusion), another compartment (the 4th one), you adjust the flows and parameter names between the compartments and end up with this:

 

attachicon.gifPML_learning_graphical.png

 

This covers the PK part of you model. It is not quite clear how you add the first part of your code to the PK model. Perhaps you can add more description or a graphical representation of your model that would allow us to incorporate that into the model

 

 

Bernd

 

Thank you for the quick reply.

Actually I want the PML code to be written for the model that you can find in the attachment.

Dosing is done in the central compartment by IV bolus

Attached Thumbnails

  • model.png

Edited by nehabatra, 19 December 2016 - 06:18 AM.


#4 bwendt@certara.com

bwendt@certara.com

    Advanced Member

  • Administrators
  • 282 posts

Posted 19 December 2016 - 11:54 AM

The graphical model that I showed in my reply is more or less reflecting the tumor model that you showed in your picture. I have renamed the parameters in the graphical model and rearranged the compartments so that you can see the similarity:

 

PML_learning_tmodel.png

 

If you have a dataset you might want to try the model that is included in the Phoenix project file. There are actually two Phoenix models, the PK model that I showed in my previous response and the tumor model where I simply changed the parameter names.

 

Attached File  PML Learning.phxproj   143.85KB   935 downloads

 

 

Bernd

 



#5 nehabatra

nehabatra

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 20 December 2016 - 04:25 AM

The graphical model that I showed in my reply is more or less reflecting the tumor model that you showed in your picture. I have renamed the parameters in the graphical model and rearranged the compartments so that you can see the similarity:

attachicon.gifPML_learning_tmodel.png

If you have a dataset you might want to try the model that is included in the Phoenix project file. There are actually two Phoenix models, the PK model that I showed in my previous response and the tumor model where I simply changed the parameter names.

attachicon.gifPML Learning.phxproj


Bernd


Thank you Bernd for your suggestions and support. It has helped me alot.
I have tried the model but it is not executing when I'm using dose instead of concentration.
I'm also attaching the Phoenix project file with the work done.

Attached Files


Edited by nehabatra, 20 December 2016 - 06:58 AM.


#6 bwendt@certara.com

bwendt@certara.com

    Advanced Member

  • Administrators
  • 282 posts

Posted 20 December 2016 - 10:41 AM

A few things:

 

1. I have setup the Tumor Model as Simulation not as a simple fitting run. So I changes this under the Run Options tab.

2. There is no observation in the model, so I had to add a continuous observation and linked this object to the central compartment.This allows you to map your measured amounts in the Main input

3. The dose information does not seem to be correct: 

your dose is 50 mg

but your first observation shows 58 mg!

I guess you need to adjust for the body weight.

 

Can you please check and get back.

 

Thanks,

Bernd



#7 bwendt@certara.com

bwendt@certara.com

    Advanced Member

  • Administrators
  • 282 posts

Posted 20 December 2016 - 10:56 AM

You might also consider providing the observations as concentrations instead of amounts. 

 

Bernd



#8 nehabatra

nehabatra

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 22 December 2016 - 09:45 AM

A few things:

 

1. I have setup the Tumor Model as Simulation not as a simple fitting run. So I changes this under the Run Options tab.

2. There is no observation in the model, so I had to add a continuous observation and linked this object to the central compartment.This allows you to map your measured amounts in the Main input

3. The dose information does not seem to be correct: 

your dose is 50 mg

but your first observation shows 58 mg!

I guess you need to adjust for the body weight.

 

Can you please check and get back.

 

Thanks,

Bernd

Thank You for the support.

The model is running  now.

I want to predict tumor concentration using this model so the driving force of the drug into the tumor is product of Plasma flow and Concentration in the central compartment and the drug follows 2 compartment model so I want this 2 compartment equation to be included while determining the concentration in the C3 compartment.

 

 

Cl3 (please see phoenix project file) = Q*C1     ; where 

Q= plasma flow

C1= Ae^-at + Be^-bt 

 

I'm attaching phoenix project file as well as an article for better understanding. 

 

Attached File  PML Learning.phxproj   702.31KB   463 downloads

Attached File  26074-72685-1-PB.pdf   1.09MB   851 downloads



#9 mittyright

mittyright

    Advanced Member

  • Members
  • PipPipPip
  • 98 posts

Posted 23 December 2016 - 04:41 PM

Hey there!

 

A Santa's gift:

test(){

                C = A * exp(-Alpha * t) + B * exp(-Beta * t)

                ForcingFunction = C * Q

                Av = delay(ForcingFunction, Tlag)

                deriv(Ai = Jvi * Av - Jiv * Ai - Jio * Ai)

                Cv = Av / Vv

                Ci = Ai / Vi

               

                error(CEps = 0.1)

                observe(CObs = C + C * CEps)                  

                observe(CiObs = Ci + Ci * CEps)

               

                stparm(

                               A = tvA

                               Alpha = tvAlpha

                               B = tvB

                               Beta = tvBeta

                               Tlag = tvTlag

                               Vi = tvVi

                               Vv = Vi / r

                               Jvi = tvJvi

                               Jiv = tvJiv

                               Jio = tvJio

                )

               

                fixef(

                               tvA = 4.34

                               tvAlpha = 0.055

                               tvB = 0.72

                               tvBeta = 0.0019

                               tvTlag = 25

                               r (freeze) = 3.875

                               Q (freeze) = 28.8

                               tvVi = 32.7

                               tvJvi = 0.151

                               tvJiv = 0.03897

                               tvJio = 1.85

                )

}

 

I didn't add the population distributions, you can add it by yourself with ranef/stparm using presented CVs.

I also added a tiny proportional error, it's up to you to use it or not in simulations.

Please note delay() is something new in PHX7, it would not work in PHX6.4

 

Kindly suggest to visit some Serge Guzy's courses!

He's a Guru of Phoenix simulations!

 

All the best,

Mittyright



#10 mittyright

mittyright

    Advanced Member

  • Members
  • PipPipPip
  • 98 posts

Posted 27 December 2016 - 11:30 AM

Hi Nehabatra,

 

regarding delay statement which I used here:

                Av = delay(ForcingFunction, Tlag)

 

In the article you sent there is a sentence:

In addition, we introduced a lag time (Tlag) to account for a delayed appearance of the drug in the tumor. The Tlag was estimated by a curve feathering method and subtracted from the time profile of the tumor concentrations.

 

In PHX6.4 you can use only transit statement (transit compartments) which is closer to the distributed delay. AFAIK there's no common way to get the simple delay in PHX6.4 (maybe some manipulations with sequence? Not sure...)

As I mentioned before this is something new in PHX7 (THX to developers!)

Please follow the PML User's guide for description:

delay( <expression>,<deltaT> )
Outputs the value that <expression> had at the corresponding time in the past (<deltaT>). <deltaT> must be a non-negative expression and can be estimated. If <deltaT> is negative, it is treated as zero, since future values cannot be known.
Delay statements assume an initial value of zero and work by keeping a table of past values of the expression captured at times when the ODE solver was “on trajectory”
(which includes change points like doses) and by using linear interpolation into that table. 
 

If you're interested in delay modeling, please look at the Shuhua Hu's presentation

https://www.youtube....h?v=YCXIW_uxTrs

 

BR,

Mittyright



#11 nehabatra

nehabatra

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 19 January 2017 - 04:30 AM

Hi Nehabatra,

 

regarding delay statement which I used here:

 

In the article you sent there is a sentence:

In addition, we introduced a lag time (Tlag) to account for a delayed appearance of the drug in the tumor. The Tlag was estimated by a curve feathering method and subtracted from the time profile of the tumor concentrations.

 

In PHX6.4 you can use only transit statement (transit compartments) which is closer to the distributed delay. AFAIK there's no common way to get the simple delay in PHX6.4 (maybe some manipulations with sequence? Not sure...)

As I mentioned before this is something new in PHX7 (THX to developers!)

Please follow the PML User's guide for description:

delay( <expression>,<deltaT> )
Outputs the value that <expression> had at the corresponding time in the past (<deltaT>). <deltaT> must be a non-negative expression and can be estimated. If <deltaT> is negative, it is treated as zero, since future values cannot be known.
Delay statements assume an initial value of zero and work by keeping a table of past values of the expression captured at times when the ODE solver was “on trajectory”
(which includes change points like doses) and by using linear interpolation into that table. 
 

If you're interested in delay modeling, please look at the Shuhua Hu's presentation

https://www.youtube....h?v=YCXIW_uxTrs

 

BR,

Mittyright

Thanks Mittyright.

But still Im not able to write the code in PML as Im facing the problem of incorporating the biexponential equation in the tumor compartment. I need help to write it down and it will be a great help for me.

 

Following you will see the code and and the graphical model has been attached1.png

 

dV/dt = Q * Cp + jiv * I - jvi * V

dI/dt = jvi * V - jiv * I

Cp = A * e^(- a * t) + B * e^(- b * t)

jiv = jvi/s

I = Tumor concentration * Vi

V = Vascular concentration * Vv

s = Vi/Vv

 

 

q1.FF = (A*exp(-a*t) + B*exp(-b*t))*fu

flux(2,4) = k(2,4) * q4

k(2,4)=k(4,2)/s

flux(4,2) = k(4,2) * q2

flux(2,1) = k(2,1) * q1

k(2,1)=Q

flux(0,4) = k(0,4) * q4

s1 = q4/(Vv*s)

 

FF = (A*exp(-a*t) + B*exp(-b*t))*fu

flux(V,I) = k(V,I) * I

k(V,I)=k(I,V)/s

flux(I,V) = k(I,V) * V

flux(V,FF) = k(V,FF) * FF

k(V,FF)=Q

flux(0,I) = k(0,I) * I

s1 = I/(Vv*s)

 

s1 is the tumor sampling site

 

For the compartmental model:

 

dX1/dt = k21 * X2 + k41 * X4 - (k12 + k10 + k13) * X1

dX2/dt = k12 * X1 - k21 * X2

dX3/dt = k13 * X1 - k34 * X3

dX4/dt = k34 * X3 - k41 * X4

 

flux(1,4) = k(1,4) * q4

flux(4,3) = k(4,3) * q3

flux(3,1) = k(3,1) * q1

flux(2,1) = k(2,1) * q1

flux(1,2) = k(1,2) * q2

flux(0,1) = k(0,1) * q1

ex1.bolus = 0.0

ex1.infusion = 0.0

s5 = q4/v4

s4 = q4/v4

s3 = q4/v4

s2 = q1/v1

s1 = q1/v1

 

s1 and s2 are sample concentration from central compartment q1 or X1.

s3, s4 and s are smple concentrations from tumor compartment q4 or X4.

 

 

Waiting for a reply :)



#12 mittyright

mittyright

    Advanced Member

  • Members
  • PipPipPip
  • 98 posts

Posted 19 January 2017 - 11:19 AM

Hi Nehabatra,

 

Did you investigate the code I posted before?

I do not get all the lines of your code, the image is the similar to the article scheme.

Please see the project attached with simulation of the subject using typical values presented in the article.

I strongly suggest to visit Serge Guzy's NLME courses.

 

BR,

Mittyright

 

Attached Files



#13 nehabatra

nehabatra

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 25 January 2017 - 03:43 AM

Hi Nehabatra,

 

Did you investigate the code I posted before?

I do not get all the lines of your code, the image is the similar to the article scheme.

Please see the project attached with simulation of the subject using typical values presented in the article.

I strongly suggest to visit Serge Guzy's NLME courses.

 

BR,

Mittyright

Thanks Mittyright !

yeah I need to attend this course. Can you give me more information about it??



#14 Simon Davis

Simon Davis

    Advanced Member

  • Administrators
  • 1,316 posts

Posted 25 January 2017 - 09:57 AM

Hi Nehabatra,

 

  Both classroom and on demand (i.e. online training) courses are listed here.

 

http://www.certarauniversity.com/lms/

 

probably any of the intermediate or advanced courses would help you

 

  Simon



#15 nehabatra

nehabatra

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 30 January 2017 - 05:22 AM

Hi Nehabatra,

 

  Both classroom and on demand (i.e. online training) courses are listed here.

 

http://www.certarauniversity.com/lms/

 

probably any of the intermediate or advanced courses would help you

 

  Simon

Thanks Simon!! :)






4 user(s) are reading this topic

0 members, 4 guests, 0 anonymous users