-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathexample_5_SolveSSITModels_EscapeTimes.m
More file actions
101 lines (80 loc) · 3.8 KB
/
example_5_SolveSSITModels_EscapeTimes.m
File metadata and controls
101 lines (80 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
%% SSIT/Examples/example_5_SolveSSITModels_EscapeTimes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Section 2.2: Finding and visualizing master equation solutions
% * Solve a first-passage time problem (escape times)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Preliminaries
% Use the models from example_1_CreateSSITModels
% clear
% close all
% example_1_CreateSSITModels
% Load the models created in example_1_CreateSSITModels
% load('example_1_CreateSSITModels.mat')
% View model summaries:
Model.summarizeModel
STL1.summarizeModel
STL1_4state.summarizeModel
% Set the times at which distributions will be computed:
Model.tSpan = linspace(0,50,101);
STL1.tSpan = linspace(0,50,101);
STL1_4state.tSpan = linspace(0,50,101);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Ex(1): Solve escape times for the bursting gene example model
% from example_1_CreateSSITModels
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Model:
% Create a copy of the bursting gene model:
Model_escape = Model;
%% Specify a boundary for the escape calculation
% Calculate the time until the mRNA concentration reaches 5
Model_escape.fspOptions.escapeSinks.f = {'mRNA'};
Model_escape.fspOptions.verbose = false;
Model_escape.fspOptions.escapeSinks.b = 5;
Model_escape = Model_escape.formPropensitiesGeneral('Model_escape');
[~,~,Model_escape] = Model_escape.solve;
% Plot the CDF and PDF
Model_escape.plotFSP(plotType="escapeTimes",...
lineProps={'linewidth',3}, Title="Bursting Gene",...
Colors=[0.93,0.69,0.13], LegendLocation="southeast");
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Ex(2): Solve escape times for the time-varying STL1 yeast model
% from example_1_CreateSSITModels
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% STL1:
% Create a copy of the time-varying STL1 yeast model:
STL1_escape = STL1;
%% Specify a boundary for the escape calculation
% Calculate the time until the mRNA concentration reaches 5
STL1_escape.fspOptions.escapeSinks.f = {'mRNA'};
STL1_escape.fspOptions.verbose = false;
STL1_escape.fspOptions.escapeSinks.b = 5;
STL1_escape = STL1_escape.formPropensitiesGeneral('STL1_escape');
[~,~,STL1_escape] = STL1_escape.solve;
% Plot the CDF and PDF
STL1_escape.plotFSP(plotType="escapeTimes",...
lineProps={'linewidth',3}, Title="STL1",...
Colors=[0.93,0.69,0.13], LegendLocation="southeast");
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Ex(3): Solve escape times for the 4-state time-varying STL1 yeast model
% from example_1_CreateSSITModels
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 4-state STL1:
% Create a copy of the time-varying STL1 yeast model:
STL1_4state_escape = STL1_4state;
% This should not be required, since propensities are already
% generated.
STL1_4state_escape = ...
STL1_4state_escape.formPropensitiesGeneral('STL1_4state_escape');
% Set the initial populations:
STL1_4state_escape.initialCondition = [1;0;0;0;0];
% Set the times at which distributions will be computed:
STL1_4state_escape.tSpan = linspace(0,100,200);
% Solve for time for mRNA to reach 100:
STL1_4state_escape.fspOptions.escapeSinks.f = {'mRNA'};
STL1_4state_escape.fspOptions.escapeSinks.b = 100;
[~,~,STL1_4state_escape] = STL1_4state_escape.solve;
% Plot the CDF and PDF
STL1_4state_escape.plotFSP(plotType="escapeTimes", XLim=[0,50],...
lineProps={'linewidth',3}, LegendLocation="southeast",...
TitleFontSize=24, Title="4-state STL1 (mRNA)",...
Colors=[0.23,0.67,0.2]);