MATH 1180: Calculus for Biologists II (Spring 2011) Lab Meets: February 23, 2011 Report due date: March 2, 2011 Section 002: Wednesday 9:40−10:30am Section 003: Wednesday 10:45−11:35am Lab location − LCB 115 Lab instructor − Erica Graham, graham@math.utah.edu Lab webpage − www.math.utah.edu/~graham/Math1180.html Lab office hours − Monday, 9:00 − 10:30 a.m., LCB 115 Lab 06 General Lab Instructions In−class Exploration Review: In the last lab, we played around with some of Maple’s random number generators. Background: This time, we will put some of these generators to use, as we explore a discrete−time stochastic diffusion model in the context of an intracellular toxic molecule. We will revisit the idea of glucose metabolism, in that this molecule (hypothetically) appears within the muscle cell in the presence of an excessive amount of glucose. Recall that a stochastic process describes an event that happens by chance. In the case of the aforementioned toxic molecule, we’ll assume that some amount of glucose causes it to enter a muscle cell at time t = 0, and it will remain inside with a certain probability. Let’s call this toxic molecule ROS, for ReallyObnoxiousStuff. Our goal for this lab is to determine, under ’experimental’ conditions, the frequency with which ROS is found inside the muscle cell at a particular time t. restart; with(Statistics): Let’s assume that the probability, p, that ROS stays in the cell is a function of the excessive glucose in our blood. Excess is measured by how far above the normal concentration, gb, the current glucose level reached. We’ll define this as a piecewise function. Notice the output of p(g). gb:=5: gmax:=6: p:=g−>piecewise(g<=gb,0,g<gmax,0.9*(g−gb)/(gmax−gb),0.9); p(g); 0.9 g gb p := g piecewise g gb, 0, g gmax, , 0.9 gmax gb 0 4.5 0.9 g 0.9 g 5 g 6 (2.1) otherwise The following plot of p(g) tells us that ROS never enters in the cell if glucose is less than gb. The probability of entering and subsequently remaining increases if glucose is between gb and gmax, and beyond gmax, the probability is no more than 0.9. So, at best, ROS has a 90% chance of staying inside the cell. plot(p(g),g=4..7,thickness=2,labels=["glucose (mmol/l)","prob. of staying"]); 0.9 0.8 0.7 0.6 0.5 prob. of staying 0.4 0.3 0.2 0.1 0 4 5 6 glucose (mmol/l) 7 Our experiments can be set up in terms of the following discrete−time equation: R[t+1] = R[t]*q[p(g) ], where R[t] is the current state of ROS. If R[t] = 1, ROS is outside the cell at time t; R[t] = 0 means ROS is inside the cell. Since the probability of ROS staying the cell is p(g), q = 1 with probability p(g), and q = 0 with probability [1−p(g)]. Notice that if q = 1 when ROS is inside, it will stay inside. But, if q = 0, ROS exits and can’t return. For the particular set of experiments we will run, assume that the concentration of blood glucose is g = 6.5 at t = 0. Then we can compute p(g) accordingly. We will iterate each experiment for 20 time steps, with a total of N = 10 experiments. We’ll also assume that each experiment begins with ROS inside the cell (R = 1). g_init:=6.5; # initial glucose t0:=1; # initial time + 1 tf:=20; # number of iterations (final time) N:=10; # number of experiments R0:=1; # initial state of ROS g_init := 6.5 t0 := 1 tf := 20 N := 10 R0 := 1 (2.2) To code this experiment, we will use the ProbabilityTable( ) command we learned last week, to randomly choose when intracellular ROS will remain. PT:=[1−p(g_init),p(g_init)]; X:=RandomVariable(ProbabilityTable(PT)): PT := 0.1, 0.9 (2.3) Recall that the output of Sample(X) will give us either a 1 or 2 (since we only have two options in PT), as we found in our biased coin example from last week. To restrict the output to either 0 or 1, we will simply subtract 1 from any sampled number. But, sampling X also gives us a bracketed "list," even for one number, so we need to take the first (and only) element before we can substract 1 from it. Here’s an example: test1:=Sample(X,1); test1−1; test2:=test1[1]−1; test1 := 2 Error, (in rtable/Sum) invalid arguments test2 := 1 (2.4) Now that that’s settled, we’re ready to start. To run the actual experiments, we will iterate the discrete system written above N times. This is going to require TWO do loops! Also, we will need to save our results to a matrix R that indicates the state of ROS at all times for all experiements (because Maple is temperamental). To set up a matrix into which we will put our experimental results, we need the new Matrix( ) command, which works in a manner similar to Array( ). R:=Matrix(t0..(tf+1),1..N,fill=0): ## Matrix(rows=no.iterations, columns=no.experiments,start value=0) for k from 1 to N do; ## start experiment k R[1,k]:= R0; ## set initial location for experiment k to R0 for j from t0 to tf do; ## now start at time j q:=Sample(X,1)[1]−1: R[j+1,k]:=R[j,k]*q; ## get random location (0 or 1) and update ROS status end do: ## end iteration j end do: ## end experiment k We can also compute the fraction of our N experiments in which ROS was inside the cell at each time. We use the add( ) command to add up all of the inside states (R = 1) for all experiments at each time point. Essentially, we’re adding all of the row entries in the matrix. So, the second item in the resulting list will tell us the fraction of our 10 experiments in which ROS was inside at t = 2. inside:=[seq(add(R[j,k],k=1..N)/N,j=t0..(tf+1))]; # j = time step, k = experiment number 9 9 3 3 3 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 inside := 1, , , , , , , , , , , , , , , , , , , , (2.5) 10 10 5 5 5 2 2 2 2 2 5 5 5 5 10 10 10 10 10 10 It appears that ROS has a better chance of being inside the cell at earlier times. The actual probability of ROS being inside the cell at a particular time is governed by the discrete equation target[t+1] = target[t]*p (g_init), with the initial probability of being inside set to 1, i.e. target[0] = 1. The ’target’ discrete equation has the solution target[t] = target[0]*p(g_init)^t = p(g_init)^t. We’ll save this solution as a function of t and then plot this along with the ’inside’ list for comparison. target:=t−>p(g_init)^t; p1:=plot(target(t),t=0..tf,0..1,color="Black",linestyle=4,legend= "actual probability"); p2:=plot([seq([m−1,inside[m]],m=1..(tf+1))],color="DodgerBlue", thickness=2,legend="estimated probability"); plots[display](p1,p2,title="Proportion of experiments in which ROS is inside at time t"); target := t p g_init t p1 := PLOT ... p2 := PLOT ... Proportion of experiments in which ROS is inside at time t 1 0.8 0.6 0.4 0.2 0 0 5 10 t 15 20 actual probability estimated probability Please copy the entire section below into a new worksheet, and save it as something you’ll remember. Lab 06 Homework Problems Your Full Name: Your (registered) Lab Section: Useful Tip #1: Read each problem carefully, and be sure to follow the directions specified for each question! I will take a vow of silence if you ask me a question that is clearly stated in a problem. Useful Tip #2: Try to minimize your code by not simply copying and pasting absolutely everything we do in class. See if you can eliminate unnecessary commands by knowing what it is you have to do and what tools you (minimally) need to do it. Useful Tip #3: Don’t be afraid to troubleshoot! Does your answer make sense to you? If not, explore why. If you’re still unsure, ask me. Useful Tip #4: When in doubt, restart! Paper−saving tip: Make the size of your output graphs smaller to save paper when you print them. Please ask me if you’re unsure of how to do this. (You can see how much paper you’d use beforehand by going to File Print Preview.) Also, please DO NOT attach printer header sheets (usually yellow, pink or blue) to your assignment. Recycle them instead! NOTE: For this assignment, you should re−define/assign any parameters or functions we used in class, as needed. This will require an understanding of what’s being asked of you. Again, everything that we did in class does not necessarily need to be done here. (0) Import the Maple Statistics package we used in class. with(Statistics): (1)(a) What could you do to get the estimated probability to match the actual ’target’ probability more closely? (b) Test your hypothesis by creating a new version of the appropriate parameter (there should only be one to change), and re−creating the last graph from the in class portion that illustrates the match, with your new and old parameter values. You should have 3 different curves on your final graph. Required: [1] Modify the legend entries in your simulation results to indicate the new and old parameter values. [2] Leave everything else the same as it was in class. [3] Suppress all output EXCEPT for the new parameter and your final graph. [4] Choose a unique line color for your new curve. Keep in mind: Because this is a stochastic process, every set of experiments will be different each time you execute the command. So, if you think you are on the right track, but want a better looking ’new’ curve, just try executing the command again. If it doesn’t look like it’s improving, modify your new parameter choice. ## run two sets of experiments and plot results (c) Why did the change you made lead to better agreement between your estimated and actual probabilities? (2)(a) What model parameters would be affected if the level of ambient glucose that triggered initial ROS entry were reduced to g_init = 5.8? HOW would they change? (b) How might your graph be altered if this occurred? (c) Change g_init to 5.8, and compute the new actual probability, target(t), of having ROS inside the cell. ## g_init ## target(t) (3)(a) Run a set of N = 10 experiments using these new numbers and produce a new graph of actual and estimated probabilites. Required: [1] Only execute commands that need to be changed. Everything else can be used from Maple’s memory of your code in problem (1). [2] Suppress all output except for the graph. ## run experiments and plot (b) How does your simulation result compare to the actual probability? (c) Given your results, is a lower g_init more beneficial or more harmful to the cell? Explain. The next few exercises are based on the following situation: * Imagine that every ROS molecule follows the same behavior as depicted in your most recent set of experiments. * Assume that each ROS is responsible for generating inside a cell an amount ’s’ of SuperNastyStuff (SNS) per ROS per minute, and that a single muscle cell will apoptose if the amount of SNS within it ever exceeds 100. (4)(a) Suppose you modified your set of experiments so that the target probabililty is virtually indistinguishable from the estimated probability. Using the target probability function you most recently computed, derive the formula that describes the total amount of SNS that would build up as a function of time, given an initial number of ’r’ ROS within the cell and no SNS at t = 0. (b) Define the formula you just wrote as the function SNS(t). ## define SNS(t) (5)(a) On the same set of axes, plot SNS(t) with r = 4 and s = 3, 6, 9 and 12, for times between 0 and 5, and SNS levels from 0 to 100. Required: [1] Choose a single color to use for all of your curves. [2] Specify a different line syle for each curve. [3] Add gridlines to your plot. [4] Include a legend to distinguish your curves. ## plot SNS(t) (b) What happens to SNS levels as the number generated per ROS increases? (c) Which values(s) of ’s’ cause the cell to apoptose? (d) About how many minutes does it take for the cell to die given these ’s’ values? (6) What are some adjustments (name at least three) that would reduce the likelihood of apoptosis? Consider all pieces of the general model, and explain why these particular changes would lead to a better outcome for the cell. (7) What new commands (there are 3 of them) did we use today? Describe what they do. Did you remember to save paper?