-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMH07 sensitivity analysis.m
209 lines (156 loc) · 5.08 KB
/
MH07 sensitivity analysis.m
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
%% models parameters
r =1; % signifies original model
m = []; % matrix that stores model parameters from simulation
q = fit(0,0,r);
m = [m; q];
r =0; % signifies model variant
% ref value = 1.0
pN = 'ktranslation GFP_mRNA';
pV = 10;
q = fit(pN,pV,r);
m = [m; q];
pV = 0.1;
q = fit(pN,pV,r);
m = [m; q];
% ref value = 0.208
pN = 'ktranscription Ptra_basal';
pV = 2.08;
q = fit(pN,pV,r);
m = [m; q];
pV = 0.0208;
q = fit(pN,pV,r);
m = [m; q];
% ref value = 10000
pN = 'kon Ptra/TraR:AHL';
pV = 100000;
q = fit(pN,pV,r);
m = [m; q];
pV = 1000;
q = fit(pN,pV,r);
m = [m; q];
% ref value = 5.51
pN = 'ktranscription Ptra_activated';
pV = 11.02;
q = fit(pN,pV,r);
m = [m; q];
pV = 2.255;
q = fit(pN,pV,r);
m = [m; q];
% ref value = 1.0
pN = 'ktranscription TraR';
pV = 5;
q = fit(pN,pV,r);
m = [m; q];
pV = 0.2;
q = fit(pN,pV,r);
m = [m; q];
r=2;
%ref value = 1.66E-8
pN = 'Ptra';
pV = 1.66E-7;
q = fit(pN,pV,r);
m = [m; q];
pV = 1.66E-9;
q = fit(pN,pV,r);
m = [m; q];
pN = 'decoy';
pV = 1.66E-7;
q = fit(pN,pV,r);
m = [m; q];
pV = 1.66E-9;
q = fit(pN,pV,r);
m = [m; q];
%% metrics analysis
fold_mat = [];
fold_ch_m = m(1,1)/m(1,2);
scal_mat = [];
scal_m = (m(1,2)/2)*(1+(m(1,1)/m(1,2)));
resp_mat = [];
resp_m = ((m(1,4)*(m(1,1)-m(1,2)))/(m(1,3)*((1+1))^2));
for i = 2:length(m)
fold_ch = m(i,1)/m(i,2);
per_fold_cha = ((fold_ch - fold_ch_m)/fold_ch_m)*100;
fold_mat = [fold_mat per_fold_cha];
scal = (m(i,2)/2)*(1+(m(i,1)/m(i,2)));
per_scal = ((scal - scal_m)/scal_m)*100;
scal_mat = [scal_mat per_scal];
resp =((m(i,4)*(m(i,1)-m(i,2)))/(m(i,3)*((1+1))^2));
per_resp = ((resp-resp_m)/resp_m)*100;
resp_mat = [resp_mat per_resp];
end
colour = rgb('RosyBrown');
fig = figure;
xnames = categorical({'ktranslation GFP mRNA (x10)','ktranslation GFP mRNA (:10)','ktranscription Ptra basal (x10)', 'ktranscription Ptra basal (:10)', 'kon Pta/TraR:AHL(x10)', 'kon Ptra/TraR:AHL(:10)', 'ktranscription Ptra activated (x2)', 'ktranscription Ptra activated (:2)', 'ktranscription TraR (x5)', 'ktranscription TraR (:5)', 'Ptra copies (x10)', 'Ptra copies (:10)', 'decoy copies (x10)', 'decoy copies (:10)'});
subplot(2,2,1);
barh(xnames, fold_mat, 'FaceColor',colour);
line([5 5], ylim, 'Color', 'black', 'LineStyle', '--');
line([-5 -5], ylim, 'Color', 'black', 'LineStyle', '--');
title('Fold change');
xlabel('Percentage change (%)');
hold on
subplot(2,2,2);
barh(xnames, scal_mat, 'FaceColor',colour);
line([5 5], ylim, 'Color', 'black', 'LineStyle', '--');
line([-5 -5], ylim, 'Color', 'black', 'LineStyle', '--');
title('Scaling');
xlabel('Percentage change (%)');
hold on
subplot(2,2,3);
barh(xnames, resp_mat, 'FaceColor',colour);
line([5 5], ylim, 'Color', 'black', 'LineStyle', '--');
line([-5 -5], ylim, 'Color', 'black', 'LineStyle', '--');
title('Responsiveness');
xlabel('Percentage change (%)');
hold off
%% simulation and fitting
function q=fit(pN,pV,r)
% Load the name.sbproj project, which includes the variable m1, a model object
sbioloadproject 'Quorum Sensing Tra Systemdecoy'
if r ==0
variantObj = addvariant(m1, 'v2');
addcontent(variantObj, {'parameter', pN, 'Value', pV});
variantObj.Active = true;
elseif r==2
variantObj = addvariant(m1, 'v3');
addcontent(variantObj, {'species', pN, 'InitialAmount', pV});
variantObj.Active = true;
end
%create a vector of 24 evenly spaced values for [AHL]
ahl_values = logspace(-15,-4, 35);
c = transpose(ahl_values);
% Create a SimFunction object, where AHL is the input parameter to scan, and
% X is the observed species. Pass in an empty array [] as the last input argument to denote there are no dosed species.
if r == 1
simfunc = createSimFunction(m1,{'AHL'},{'GFP','Ptra','Ptra_activated','TraR','TraR:AHL'},[]);
elseif r ==0 || r==2
simfunc = createSimFunction(m1,{'AHL'},{'GFP','Ptra','Ptra_activated','TraR','TraR:AHL'},[], variantObj);
end
% Simulate the model multiple times with different AHL values. Set the stop time to 1000.
sd = simfunc(c,1000);
% selects time data and outputs
[t, x] = select(sd, {'Type','species'});
%code selects the endpoint values for protein expresion data
N = length(x) ;
vector = zeros(N,1) ;
for i = 1:N
vector(i) = x{i}(end,1) ; % x{i} = simulation number i.e AHL conc.; (end,1) = species (GFP = 1)
end
%% plot curve
%semilogx(c, vector, 'kx');
%ylabel('[GFP] (M)');
%xlabel('[AHL] (10^x M)');
%title('Dose Response of Tra Quorum Sensing System');
%xlim([10^-16 10^-3])
%hold on
%% curve fitting
hill=@(q,c)q(2)+((q(1)-q(2))./(1+10.^((log10(q(3))-log10(c)).*q(4))));
b0 = [vector(end) vector(1), 1E-8, 1];
h = nlinfit(c,vector,hill, b0);
q = h;
%qdata=logspace(-15, -4, 10000);
%for i = 1:length(qdata)
% y(i) = q(2)+((q(1)-q(2))./(1+10.^((log10(q(3))-log10(qdata(i)))*q(4))));
%end
%semilogx(qdata,y);
%hold off
end