11/14/2018 Multiscale modeling & Simulation methodology Selected Ch 8 material Time delays approx translocation dynamics Transcription Factor Autoregulation Dynamics K P 2 (t ) dP (t ) b kdeg P (t ) 2 1 dt P (t ) K 2 Constituitive Production & degradaton Regulation: NL + feedback mRNA not modeled here. Only the protein 1 11/14/2018 Modeling transcription factor autoregulation via homdimer positive feedback A Visual Tour from Cartoons To Differential Equations (& Back) Doug Dang, BE Undergrad Student Prof. Joe DiStefano III CARTOON DIAGRAM 𝑘 τ TF‐RE 𝑘 𝑘 TF‐Gene 2 11/14/2018 SIMPLE MODEL WITH TIME DELAY τ1 𝑘 TF‐RE TF‐Gene 𝑘 P τ2 𝑘 τ1 τ2 τ DIMERIZATION 3 11/14/2018 HOMODIMER TRANSLOCATION MRNA TRANSCRIPTION AND TRANSLATION 4 11/14/2018 PROTEIN DIMERIZATION: COMPLETE 𝑘 𝑘 P Pτ TF‐RE 𝑘 P TF‐Gene DIRECTED GRAPH MODEL 𝑘 τ 𝑘 𝑘 5 11/14/2018 ODE MODEL 𝑏 𝑘 𝑃 𝑡 = constituent production ‐ degradation + positive f.b. regulation term A MULTISCALE MODEL RIBOSOME dP(t ) K1P 2 (t ) b kdeg P(t ) 2 dt P (t ) K 2 REGULATION TERM 11/14/2018 Constituent production & degradation terms 12 6 11/14/2018 K P 2 (t ) dP (t ) b 2 1 kdeg P (t ) dt P (t ) K 2 SIMULATION CONDITIONS P(0) = 200 molecules of TF in some unit volume of cytoplasm over 0 < t < 180 min basal synthesis rate b = 20 molecs/min K1 2,000 min 1 , K 2 =400,000 molecules 2 and kdeg 1min 1 time delay τ = 0, 5,10 mins 11/14/2018 13 Simulink Implementation 11/14/2018 14 7 11/14/2018 kdeg GAIN – 1 s + + × INTEGRATOR ADD ÷ DIVIDE + dP(t ) K P (t ) b 2 1 kdeg P(t ) dt P (t ) K 2 2 + ADD K2 CONSTANT Pow K1 Delay GAIN STEP‐ RESPONSES Zero delay Zero delay mindelay delay 55min 10 min delay 10 min delay 11/14/2018 15 subsystem 11/14/2018 Based on DSBMS JJ DiStefano III Academic Press 2015 16 8 11/14/2018 NUMERICAL ALGORITHMS (“SOLVERS”) FOR SOLN OF ODEs BASIC THEORY IN A NUTSHELL 11/14/2018 17 Initial Value Problems Consider the NL vector ODE: x f (x, u, t ) x (t0 ) x0 Two basic categories of methods for numerically solving ODE's: 11/14/2018 • One-step methods: No iterations required. Self-starting. • Multi-step methods: Not self-starting 18 9 11/14/2018 x f ( x, u, t ) f ( x, t ), x(t0 ) x0 Most algs use Taylor series expansion of f: x (tm 1 ) x (tm ) x (tm ) t t stepsize x m 1 x(tm ) 2 t 2! x (tm ) x m , shorthand for "mth step" xm 2 x x t t 2! m m m = 0, 1, 2,…. 11/14/2018 19 Simplest Solver – the Euler Method (Euler Formula) for x f Given the solution x (t m ) x m at the discrete-time instant tm, x(tm 1 ) x(tm ) f [ x(t m ), u(tm ), t ]t t t m 1 t m abbreviated: x m 1 x m f m t x m 1 x m f m t ET2 O(t2) truncation error 𝐸 10 11/14/2018 Euler's Method: First-order Runge-Kutta Uses only first two terms of Taylor series expansion to predict soln at tm+1: x = xm + (t – tm)f m x m 1 ~ x m f m t xm+1 ET2 xm TRUE x(t) t tm+1 tm 11/14/2018 21 Problem: Truncation error 0(∆t2)ET can be large. Example: dy y2 0 dt or dy y 2 dt y(0) = 1 Exact solution is: y = 1 / (1 + t) 2 Apply Euler algorithm: ym 1 y m t ( ym ) Starting at t = 0 (m = 0), with t = 0.1, y at t = 0.1: y1 = 1 + (0.1)(-12 ) = 0.9 Exact solution at this point is yexact (0.1) 11/14/2018 1 0.9090909 1 0.1 Based on DSBMS JJ DiStefano III Academic Press 2015 22 11 11/14/2018 Next, at t = 0.2, 2 y2 = 0.9 + (0.1)(-(0.9) ) = 0.819 Exact solution is 1 0.8333333 1 0.2 yexact (0.2 ) After 10 steps of t = 0.1, y10 = 0.4627810 yexact (1.0) 1 0.5 1 1 ET is building up fast 11/14/2018 23 Example of Roundoff error buildup for small step-sizes 1.00 0.00 TOTAL ERROR vs. STEP-SIZE 𝑑𝑥 𝑑𝑡 Euler’s Method 𝑥 x x x(0) = 1 -1.00 16-bit word length precision TOTAL ERROR -2.00 -3.00 -4.00 -5.00 h = e-15 -6.00 -30.00 -25.00 -20.00 -15.00 h =1 -10.00 -5.00 0.00 Ln h Increasing step-size 11/14/2018 24 12 11/14/2018 t stepsize= tm tm1 x (tm-1) x (tm) x (tm+1) tm-1 tm tm+1 t x (tm ) x m , shorthand for "mth step" 11/14/2018 Based on DSBMS JJ DiStefano III Academic Press 2015 25 ERRORS IN DIGITAL COMP SOLNS of ODEs Truncation Error: ET .. error in finite approx of series (incl deriv approxs) Roundoff Error: ER ..error in truncating numbers in calcs to finite word size (e.g. 64 bits) Total Error: ET + ER Relative Error: (E T+ ER) / Exact Soln x*(t) Overall, most important Numerical (computational) Stability (NS) … bounded relative errors Stable algorithm: numerically stable 11/14/2018 Based on DSBMS JJ DiStefano III Academic Press 2015 26 13 11/14/2018 RUNGE-KUTTA SELF-STARTING METHODS Properties (1) One-step methods: to find xm+1, only need info avail at prior point, xm. (2) agree with Taylor series thru terms in ∆tp, where p is called the order of the method. (3) do not require eval of any derivs of f, only f itself. 11/14/2018 Based on DSBMS JJ DiStefano III Academic Press 2015 27 HIGHER-ORDER R-K METHODS f (x, t ) evaluated not only at (x m , tm ) but also at one or more m closely adjacent points BETWEEN ( x , tm ) Then soln at tm+1, i.e., x m +1 and (x . m +1 , t m+1 ) , is obtained as a . weighted sum of these expressions for the fcn f (x, t ) at different points btwn tm and tm+1, over t 11/14/2018 Based on DSBMS JJ DiStefano III Academic Press 2015 28 14 11/14/2018 Most Popular (ODE4): 4th-Order Formula (Evals half‐way btwn) x m 1 x m where k1 f ( x m , tm ) t 6 k1 2k2 2k3 k4 t t k2 f x m k1 , tm f x1/2* , t1/2* half‐way pt 2 2 t t k 3 f x m k 2 , tm 2nd half‐way pt 2 2 k4 f x m k3t , tm t and ET ~ O(h5) 11/14/2018 Based on DSBMS JJ DiStefano III Academic Press 2015 P(t) 2000 P R O T E IN C O N C E N T R A T IO N 29 dP(t ) K P 2 (t ) b 2 1 kdeg P(t ) dt P (t ) K 2 1500 RUNGA-KUTTA 4TH-ORDER Varying Fixed Step-Sizes 1000 t = 0.05 t = 0.1 t = 0.5 t = 1 500 t = 2 0 0 20 40 60 80 100 MINUTES 120 140 160 180 4th–order Runge‐Kutta solutions for 5 different fixed stepsizes 11/14/2018 30 15 11/14/2018 EXTRAS MULTISTEP PREDICTOR-CORRECTOR METHODS (Advanced) ꞏ Use vals of y determined at 2 or more preceding points. ꞏ Therefore, not self-starting. ꞏ Also, can be explicit or implicit formulas. Example - EXPLICIT FORMULA: 2ND-order ADAMS-BASHFORD: x m 1 x m t ( 3 f m f m 1 ) 2 past vals of f Example IMPLICIT FORMULA: ADAMS-MOULTON 2nd-order x m1 x m t ( f m1 f m ) 2 current value 11/14/2018 32 16 11/14/2018 Derivation of Multistep Algorithms: The Approach NL Eq: x f ( x , t ) Taylor Series Solution: t m x m 1 x m t f m f ( t 3 ) 2! Method: Replace derivs f & fdot, etc by backward-difference approxs, e.g. another 2nd‐order (EXPLICIT) ADAMS FORMULA: : f m f m1 f m t t f m f m1 m 1 m 3 x x t f m O ( t ) 2 t 1 3 x m1 x m t f m f m 1 O ( t 3 ) 2 2 11/14/2018 Based on DSBMS JJ DiStefano III Academic Press 2015 33 Or also substitute for the 2nd deriv (backward diff): m m 1 f m2 f m f 2 f ( t ) 2 23 m 16 m 1 5 m 2 O(t 4 ) x m 1 x m t f f f 12 12 12 A 3rd-order explicit ADAMS FORMULA 11/14/2018 Based on DSBMS JJ DiStefano III Academic Press 2015 34 17 11/14/2018 Another Example: 4TH-ORDER ADAMS Predictor Algorithm x m 1 x m t 55 f m 59 f m 1 37 f m 2 9 f m 3 24 where f m i f ( x m i , tm i ) i 1, 2,3 f m 1 f ( x m1 , tm1 ) • alg requires 4 prev vals of x, i.e., xm-3, xm-2, xm-1, xm to predict xm+1. • 4th-order algorithm: errors are order of t5, similar to 4th-order Runge-Kutta algorithm 11/14/2018 Based on DSBMS JJ DiStefano III Academic Press 2015 35 Digression: common kinetic terminology • Time constant T • Half‐life T1/2 • Rate constant k 1 exp kt exp t /T 0.37 for T t 0.5 for t T1/2 k ln2 / T1/2 0.5 0.37 18