0:17

What we're going to talk about today in this lecture Are some of

Â the prac, practical aspects of implementing

Â this mathematical model we've been talking about.

Â So we've been discussing the 1993 Novak and Tyson model of the cell cycle.

Â 0:30

We're going to talk a little bit about the

Â model equations and, and the notation that we use.

Â And then I'm going to discuss some of the

Â practical considerations of implementing this model in MATLAB.

Â And that's going to force us to review a concept from one of the

Â early lectures on introduction to MATLAB the

Â idea of MATLAB scripts versus MATLAB functions.

Â Because that's critical to how we have

Â implemented this Novak and Tyson cell cycle model.

Â and then that's going to allow us to discuss

Â how you can use MATLAB's built-in ordinary differential equation solvers.

Â 1:07

The Novak and Tyson cell cycle model as

Â we've discussed, consists of seven ordinary differential equations.

Â For the seven unique molecular species in this model.

Â By unique in this case I mean is there are some

Â species that can be either the

Â phospholated form or the unphospholated form.

Â For instance we want one of these

Â examples, but because the total amount of We

Â one is constant, you only have to keep

Â track of either the phospholated or the unphosfolated.

Â And you can always get the whatever the, the other

Â state is by taking the total amount and subtracting that.

Â So, we have, only have one equation for the phosphorylated we want

Â because if we want to calculate unphosphorylated

Â we want, it's just this term here.

Â The total we want minus the phosphorylated form.

Â 1:49

So once Novak and Tyson made those simplifications based on conservation of

Â mass, they come up, came up with seven ODEs for seven molecular species.

Â And we reviewed structure of a couple of

Â these equations in, in one of our previous lectures.

Â But I just have all the equations here for completeness, and this set of equations

Â came from this very nice review article

Â by Sible and Tyson that we've encountered previously.

Â 2:14

Although we've discussed some of the equations

Â in the Novak-Tyson 1993 cell cycle model.

Â But we haven't spent a lot of time

Â discussing all of the parameters of the model.

Â All of the different numbers that have to be defined

Â in order to implement this model and, and to run it.

Â And I'm just going to summarize these here in, in a few categories.

Â There are a bunch of maximal rates.

Â These are usually kcats of enzymes.

Â They can also be rates of of synthesis or degradation.

Â And these are, are denoted with, with small ks here.

Â So you've got little k1, little k3, little k a, b, c etcetera.

Â And these are the values that are used in

Â the implementation, and that we're going to provide you with.

Â 2:56

There are also a, a number of Michaelis

Â constants, and these are denoted with a capital K.

Â Rather than lowercase k, over here.

Â 3:06

Then something else that needs to be defined in the model

Â are a number of total protein concentrations, total amount of CDK cdc25.

Â These are the species that don't get synthesized or degraded.

Â We want intermediate.

Â And so.

Â And you see that cycling, for instance, is not

Â out here as a parameter of total protein concentration.

Â That's because cycling gets synthesized, cycling gets degraded.

Â So that's a variable that changes as a function of time.

Â These are total amounts of the proteins that,

Â that don't change as a function of time.

Â And therefore, whatever the, the mac, the total amount is has to be defined.

Â At the beginning before the simulation runs.

Â 3:41

The Novak-Tyson model also can aide several parameters that

Â I've grouped down here that I call weighting parameters.

Â What I mean by that is that some of the rate

Â constants are weighted averages that are

Â calculated using these parameters down here.

Â For instance Kwee, which is one of the rate constants

Â that involves Wee1, depends on

Â the phosphorylated amount of phosphorylated Wee1.

Â It also depends on the amount of non-phosphorylated Wee1.

Â And these are grouped together, they're weighted

Â together based on these two terms Vwee.

Â Prime, V Wee prime [INAUDIBLE].

Â These, this is a notation used by Tyson.

Â The, the terminology that I used in

Â the MATLAB implementation is vwee_1 and vwee_2.

Â And these are the two that are used

Â to, to weight the phosphorylated wee1, the non-phosphorylated wee1.

Â You come up with this overall rate constant here.

Â So you can see that there's a, a number or

Â parameters that are necessary to simulate the Novak-Tyson cell cycle model.

Â Some are k cats, some are Michaelis constants, some are total

Â protein concentrations, and a series of them are these weighting parameters.

Â Now let's talk, more specifically.

Â About some of the things we need to consider when

Â implementing the Novac Tyson model in the MATLAB programming environment.

Â We encountered this slide before when we discussed Oyler's

Â method in the context of dynamical systems, and we said

Â this is the general way you structure a script that

Â implements a mathematical model that solves a system of ODEs.

Â 5:14

we, first we defined constants, then we set the time step and

Â the simulation time, then we defined the initial conditions for our system.

Â We had a for loop that implemented Euler's method.

Â And at each time step in the for loop, we saved the output into

Â some vector that kept all the output, or some array that kept all the output.

Â We computed the derivative of all the variables with respect to time,

Â and then we computed all the variables at the next time step.

Â And when our "for" loop was over, we plot it and we output the results.

Â 5:48

And when we encountered this before, this was a specific example that we discussed.

Â Very simple ordinary differential equation, dx dt equals a minus bx

Â for these values of little a, little b, and little c.

Â And we wrote this MATLAB script that we called euler.m.

Â This solves this differential equation numerically.

Â But, one of the things we discussed when we talked about Euler's method before.

Â Is that, this is really that the simplest

Â and most straight forward way to solve ODE systems.

Â In the over 200 years since Euler died there have been

Â many improvements made of, of ways to solve ODE systems numerically.

Â And we talked a little bit about

Â the Runge-Kutta method or the variable time-step methods.

Â And what I've discussed last time is I said these

Â algorithms are available in MATLAB as the built-in ODE solvers.

Â So we dis-, I think it was worth talking about Euler's method.

Â So that, conceptually, you can understand how ODE systems are, are solved.

Â But, in practice Euler's method is not usually used.

Â Usually you'll use one of these more sophisticated algorithms.

Â And that's what we're going to do to to solve the Novak and Tyson model.

Â But we're not going to write Sophisticated algorithm ourselves.

Â We're going to exploit the fact that MATLAB has already done this, and these

Â ode solvers that are, that are provided with the software, things like ode 23.

Â Ode 15s.

Â Now, when we use MATLAB's built-in solvers to solve to integrate ode systems, we're

Â going to have to make a couple of changes to the structure of our program.

Â We're still going to find, find the constants at the beginning.

Â 7:20

We're going to set the initial conditions in set three and

Â we're going to apply and output the results in step five.

Â But you can see steps two and four are changed a little bit.

Â For one thing we're not going to explicitly set a

Â time step like we did when we used Oiler's method.

Â 7:34

MATLAB is going to compute the steps automatically for us.

Â And then at step four, rather than having a four loop.

Â That goes through, calculate the derivatives,

Â integrates moves to the next time step.

Â We're going to do all of this using MATLAB's solvers.

Â 7:50

And so step four is going to be altered a little

Â bit when we do this for the Novak and Tyson model.

Â But in order to do number four, we're going to have to write a

Â function that is going to compute the set of derivatives in our In our model.

Â Given the current collection of state variables.

Â And that term function that I just

Â mentioned should sound familiar to you, because

Â that's something we also discussed in the

Â introduction to MATLAB lectures at the very beginning.

Â 8:15

This is the slide we showed back then to illustrate the schematic relationship.

Â Between, between scripts and functions.

Â Remember that if you call a function, sample function, A, B, C.

Â What this is going is it's taking the variables,

Â A, B, and C, that are defined in your script.

Â Sending them to your function, sample function .m.

Â Sample function.m is going to perform a lot of calculations, some of which are

Â going to involve the vari the variables, A, B, and C that you sent.

Â And then it's going to return results.

Â And a couple of things we discussed when we talked

Â about scripts versus functions is that the variables that are called

Â capital A, capital B and capital C in the script are

Â called x, y and z in the function and that's okay.

Â It's okay for the variables to have different

Â names in the script and in the function.

Â 9:03

And similarly, sample function is going to

Â calculate something called little a and little a

Â is the thing that is going to get

Â returned to whatever whatever the function was called.

Â And when, when it comes back to this script it's going to

Â be called results and, again, it's a different name but this is okay.

Â So, these are things that we discussed in the beginning when

Â we talked about the differences between MATLAB's scripts and MATLAB functions.

Â And another lesson we learned when we

Â talked about scripts versus function is, is

Â that after the function is called the

Â variables defined within the function are gone.

Â 9:38

So, we called sample function.

Â We sent it these variables: capital A, capital B, capital C.

Â It referred to these variables as little x, little y, and little z, but then by

Â the time the function is over little x,

Â little y, and little z didn't exist anymore.

Â Why did we just go back and review

Â the difference between MATLAB scripts and MATLAB functions?

Â Well, this distinction is critical to understand in order to

Â use MATLAB's built-in solvers to integrate systems of, of ODEs.

Â For one thing the ode solvers are themselves functions.

Â So ode23 or ode15s is a MATLAB function, and in order to know how to use a

Â MATLAB function you need to know what variables

Â should get sent to the, to the MATLAB function.

Â 10:21

For instance this is for instance a way that you could.

Â Integrate the Novak-Tyson and cell cycle model, using Matlab's solver ode23.

Â So let's review what these, what these variables represent here.

Â You call ode23 and then you have

Â a parenthesis and you say, at dydt_novak comma.

Â Brack, you know, square bracket, zero comma t last, end square

Â bracket, and then a comma and then state variable underscore i.

Â 10:52

The three things that are getting sent to ODE two three.

Â The first is what's called a function handle.

Â And the way that you know this is a function handle, rather than just

Â say, a regular old variable, It's because of this at symbol in front of it.

Â So dydt_novak is not just a variable, it's

Â equal to the number four or something like that.

Â This at symbol in front of it, tells MATLAB

Â that that you should look fora file, called dydt_novak.

Â So that at symbol here is is a special code.

Â That MatLab understands that this is not just a regular

Â old variable, this is a file I should look for.

Â The second variable that is getting sent here, you can

Â probably deduce this looking at the variable names I have choose.

Â This is saying the time over which to perform this

Â integration start at time 0, end at time t last.

Â Meaning it's defined that way, because it's like the last time.

Â 11:45

And then this final one, is the set of initial conditions.

Â So if you have a bunch of variables

Â in your model, that are sometimes called state variables

Â of that model, then statevar_i is the variable

Â name that represents initial conditions for the state variable.

Â Little i, in this case Meaning initial.

Â And then what are the variables that get computed by ode23,

Â and get sent back to the script, he call to ode23?

Â 12:15

Well, you can see that there's two variables that are going to get sent back.

Â One is time, this is going to be a vector with all the time points in it.

Â And then statevars is going to be a two dimensional array.

Â Where each row is going to represent a different

Â time point, and each column and statevars is going to

Â represent a different variable with seven new variables in the

Â case of the the Novak and Tyson cell cycle model.

Â And then the second reason for going over scripts versus functions again, is

Â that in order to MATLAB ODE solver, you need to create a function.

Â In this function will compute the derivatives

Â of your variables, so in the MATLAB code

Â we will provide you with to do

Â your homework assignment, there's going to be two files.

Â And one of them is going to be a function called dydt_novac and you know its a

Â function because the first line of that function will

Â look like this, function deriv equals dydt_novac T comma.

Â Stavar, meaning that if you send dydt novak time

Â point and a vector containing all the state variables

Â in it, then dydt_novak is going to compute seven

Â derivatives and send them back to whatever script called it.

Â So it's worth reviewing scripts versus functions to understand how all this.

Â 13:31

Model is implemented with a script called

Â novak.m and then a function called dydt_novak.m.

Â Now that we've discussed scripts versus functions

Â again, let's go back to our simple example,

Â of the var the one variable ordinary

Â differential equation that we previously solved using Euler.m.

Â Knowing what we know now about how MATLAB's ode solvers work.

Â This is how we would divide it, into a script and

Â a function to solve it using ODE through three in MATLAB.

Â Ode.m would set our would define our, our constants here.

Â It would set the last time.

Â We want to integrate this for up to, up to four minutes.

Â Set the initial condition x0 equals c, and then this line, instead of a

Â four loop we have this single line

Â here that would perform the integration, call Ode23

Â dxdt is the name of the function the computes the derivative, integrate

Â it at time zero up to time t last tlast in this case equal to 4 minutes.

Â And then send it x0 as my as my initial condition.

Â What about dxdt, what's that going to contain?

Â Well, this is going to be a function where we compute the derivative.

Â 14:45

If we know t and we know x.

Â And the derivative is just computed in this one line here a minus b times x.

Â And, there's one more thing in this in this arrangement that you may have

Â noticed which is that we like to define our, our parameters in the very beginning.

Â Whatever our, our, whatever is controlling the behavior of our

Â system, whatever our total concentrations are, or our rate constants etcetera.

Â It's good to define them at the very beginning.

Â That way, they're all in one place if you want to go change them.

Â 15:17

So, I prefer to structure things this way, where at the very beginning

Â you say, okay, a, b, and c are the parameters that control the system.

Â I'm going to define them at the beginning, but

Â if they're defined in the script here A

Â and B have to get used in the

Â in the function over here that computes the derivative.

Â So the way I've set this up, is to have,

Â is to define A and B as global in the script.

Â And then, in the function, I also defined A and B as global.

Â And we talked about global variables versus local

Â variables before, in the introduction to MATLAB lectures.

Â Global variables can be used in both a script.

Â 15:59

And this general structure like we've shown here with ode.m and

Â dxdt.m has been followed in in the two files novak.m and dydt_novak.m.

Â To solve the Novak and Tyson cell cycle model.

Â To summarize this lecture, one way to use

Â MATLAB's built-in ODE solvers is to write a

Â script that sets up the model and then

Â a function that computes the ordinary differential equations.

Â I want to emphasize there are other ways to solve this, and

Â we're not going to go into all the different ways to do this.

Â There are things called embedded functions.

Â You can have the whole thing in one file.

Â 16:33

With one function that sets up the model and

Â a second function that just computes the, the derivatives.

Â But this is a structure that I like and this

Â is the structure that you're going to be provided with.

Â Where the script, Novac.m, sets up the

Â parameters, tells you how long to integrate

Â it for, and then actually tells MATLAB to solve it and does the post processing.

Â The plotting the computations etcetera.

Â And then there's a function and the purpose of the

Â function is to compute the derivatives and send them back.

Â 17:03

So this is one way to use MATLAB's ODE solvers to solve a system of ODEs.

Â And then the second thing that goes along with that is that.

Â Parameters can be defined in the script and then used in

Â the function and so, in that case, it can be very helpful

Â to define these as global variables, and that's also the pattern

Â that I've used in solving the Novak and Tyson cell cycle model.

Â 17:28

So this concludes our lectures on the cell cycle model.

Â Particularly the the cell cycle models designed by Novak at all.

Â And in your homework assignment you're going to use this, the

Â MATLAB script and the MATLAB function that we provide you with.

Â And you're going to reproduce some of the plots

Â that we talked about in, in the lectures

Â when we discussed what the Novak and Tyson

Â cell cycle model actually was able to show.

Â [BLANK_AUDIO]

Â