Skip to content

Commit 54878ad

Browse files
committed
Create script just for SSA
1 parent 65626fc commit 54878ad

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

WorkSpace/Dmitri/NFDP_SSA.m

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
%% Initial Setup
2+
3+
close all
4+
clear all
5+
addpath(genpath('../../src'));
6+
7+
M = [1 2 3 6]; % Number of intermediate states
8+
9+
kOn = 0.1;
10+
kOff = kOn * 1000 / 2;
11+
12+
tau = 50;
13+
delayPeriods = 10;
14+
tSpan = linspace(0, tau * delayPeriods, 1 + delayPeriods);
15+
16+
Model = SSIT;
17+
Model.species = {'Dempty'; 'Dfull'; 'X'};
18+
19+
initialConditionX = randi([15, 50]);
20+
Model.initialCondition = [1; 0; initialConditionX];
21+
22+
parameters = ({...
23+
'kPlus', 100; ... % (Delayed) rate of protein production
24+
'kMinus', 1; ... % Rate of protein degradation
25+
'kOn', kOn; ... % Rate of operator site emptying / activation
26+
'kOff', kOff; ... % Rate of operator site filling / deactivation
27+
'tau', tau ... % Delay in protein production
28+
});
29+
Model.parameters = parameters;
30+
31+
Model.propensityFunctions = {
32+
'kOn*Dfull', ... % Operator site emptying
33+
'kOff*Dempty*X', ... % Operator site filling
34+
'kPlus*Dempty', ... % (Delayed) protein production
35+
'kMinus*X' ... % Protein degradation
36+
};
37+
38+
Model.stoichiometry = [...
39+
1, -1, 0, 0; ... % Dempty
40+
-1, 1, 0, 0; ... % Dfull
41+
0, 0, 1, -1 ... % X
42+
];
43+
44+
% The only delayed reaction in the system is the third, with a delay equal
45+
% to tau. It has a single reactant, one Dempty, so we must include it in
46+
% the delayed-reaction scheduling stochiometries:
47+
48+
Model.delayedReactions = [3, Model.parameters{5,2}];
49+
50+
Model.delayedReactionSchedulingS = [...
51+
0, 0, -1, 0; ... % Dempty
52+
0, 0, 0, 0; ... % Dfull
53+
0, 0, 0, 0 ... % X
54+
];
55+
56+
%% Configure and run SSA
57+
58+
Model.tSpan = tSpan;
59+
Model = Model.formPropensitiesGeneral('NFDP');
60+
61+
Model.solutionScheme = 'SSA';
62+
63+
% Number of independent data sets to generate.
64+
Model.ssaOptions.Nexp = 2;
65+
66+
% Number of cells to include at each time point for each data set.
67+
Model.ssaOptions.nSimsPerExpt = 3e4;
68+
69+
tic;
70+
SSAsoln = Model.solve([], 'ssa_out.csv');
71+
SSAtime = toc;
72+
73+
save SSAtime.mat SSAtime
74+
save SSAsoln.mat SSAsoln

0 commit comments

Comments
 (0)