-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_Preston_manu.m
443 lines (402 loc) · 16.4 KB
/
plot_Preston_manu.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
function plot_Preston_manu(T, X, params, Kin_opts, MealInfo)
%% if want to remove the outlying datapoin in Meal UP experiment, use Meal_UK_scaled_nodatapoint data. Otherwise - use Meal_UK_scaled
close all
exp_start = params{1}.tchange + 60 + 6*60;
times1 = (T{1} - exp_start)/1;
times2 = (T{2} - exp_start)/1;
times3 = (T{3} - exp_start)/1;
varnames = set_params().varnames;
% color options
c1= [0.9290, 0.6940, 0.1250]; %yellow
c2 = [0.4940, 0.1840, 0.5560];%purple
c3 = [0.3010, 0.7450, 0.9330]; %blue
% which plots?
plt_PhiKin = 0;
plt_M_con = 1;% amounts and concentrations
plt_effects = 1; % effects of ALD and insulin
plt_kidney = 1; % kidney K+ handling
% fontsizes
fonts.title = 14;
fonts.xlabel = 13;
fonts.ylabel = 13;
fonts.legend = 14;
fonts.ticks = 10;
fonts.lab = 12;
markersize = 15;
% linestyles
ls1 = '-';
ls2 = ':';
ls3 = '-.';
lw = 2; % linewidth
% x axis limits
xmin = -(exp_start - params{1}.tchange)/60;
xmax = 9; %600/60;
labx = 0.25;
laby = 0.95; % percentage of range
%labels = {'K^+ deficient Meal only', '35 mmol K^+ ingested orally only', 'K^+ deficient Meal + 35 mmol K^+'};
labels = {'Meal only', 'KCl only', 'Meal + KCl'};
%% plot Phi_Kin
if plt_PhiKin
PhiKin_vals1 = zeros(size(T{1}));
for ii = 1:length(T{1})
[PhiKin_vals1(ii), ~] = get_PhiKin(T{1}(ii), 0, params{1}, Kin_opts{1}, MealInfo{1});
end % for ii
PhiKin_vals2 = zeros(size(T{2}));
for ii = 1:length(T{2})
[PhiKin_vals2(ii), ~] = get_PhiKin(T{2}(ii), 0, params{2}, Kin_opts{2}, MealInfo{2});
end %for ii
PhiKin_vals3 = zeros(size(T{3}));
for ii = 1:length(T{3})
[PhiKin_vals3(ii), ~] = get_PhiKin(T{3}(ii), 0, params{3}, Kin_opts{3}, MealInfo{3});
end %for ii
figure(99)
plot(times1/60, PhiKin_vals1, 'linewidth', 2, 'color', c1, 'linestyle', ls1)
hold on
plot(times2/60, PhiKin_vals2, 'linewidth', 2, 'color', c2, 'linestyle', ls2)
plot(times3/60, PhiKin_vals3, 'linewidth', 2, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hours)', 'fontsize', fonts.xlabel)
ylabel('\Phi_{Kin} (mEq/min)', 'fontsize', fonts.ylabel)
title('K^+ intake (\Phi_{Kin})', 'fontsize', fonts.title)
legend(labels, 'fontsize', fonts.legend, 'Location', 'northeast')
xlim([xmin, xmax])
a = get(gca, 'XTickLabel');
set(gca,'XTickLabel',a,'fontsize',fonts.ticks)
hold off
end
data = load('./Data/PrestonData.mat');
if plt_M_con
figure(100)
% Phi Kin
s = subplot(3,3,1);
PhiKin_vals1 = zeros(size(T{1}));
for ii = 1:length(T{1})
[PhiKin_vals1(ii), ~] = get_PhiKin(T{1}(ii), 0, params{1}, Kin_opts{1}, MealInfo{1});
end % for ii
PhiKin_vals2 = zeros(size(T{2}));
for ii = 1:length(T{2})
[PhiKin_vals2(ii), ~] = get_PhiKin(T{2}(ii), 0, params{2}, Kin_opts{2}, MealInfo{2});
end %for ii
PhiKin_vals3 = zeros(size(T{3}));
for ii = 1:length(T{3})
[PhiKin_vals3(ii), ~] = get_PhiKin(T{3}(ii), 0, params{3}, Kin_opts{3}, MealInfo{3});
end %for ii
plot(s, times1/60, PhiKin_vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, PhiKin_vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, PhiKin_vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlim([xmin, xmax])
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq', 'fontsize', fonts.ylabel)
title('K^+ intake (\Phi_{Kin})', 'fontsize', fonts.title)
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(a)', 'fontsize', fonts.lab)
hold off
% MKgut
s = subplot(3,3,2);
varnum = 1;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:,varnum);
vals3 = X{3}(:,varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq', 'fontsize', fonts.ylabel)
title('Gut K^+ Amount (M_{Kgut})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([-1,30])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(b)', 'fontsize', fonts.lab)
hold off
% MKplasma
s = subplot(3,3,4);
varnum = 2;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:,varnum);
vals3 = X{3}(:,varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq', 'fontsize', fonts.ylabel)
title('Plasma K^+ Amount (M_{Kplasma})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([10, 25])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(c)', 'fontsize', fonts.lab)
hold off
% MKinter
s = subplot(3,3,5);
varnum = 3;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:,varnum);
vals3 = X{3}(:,varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq', 'fontsize', fonts.ylabel)
title('Interstitial K^+ Amount (M_{Kinter})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([30,50])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(d)', 'fontsize', fonts.lab)
hold off
% MKIC
s = subplot(3,3,6);
varnum = 4;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:,varnum);
vals3 = X{3}(:,varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq', 'fontsize', fonts.ylabel)
title('Intracellular K^+ Amount (M_{KIC})', 'fontsize', fonts.title)
ylim([3000, 3150])
xlim([xmin, xmax])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(e)', 'fontsize', fonts.lab)
hold off
% Kplasma
s = subplot(3,3,7);
varnum = 5;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:,varnum);
vals3 = X{3}(:,varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
errorbar(data.time_serum/60, data.Meal_serum_scaled, data.Meal_serum_err,'.', 'markersize', markersize,'color',c1)
plot(data.time_serum/60, data.Meal_serum_scaled, '.', 'markersize', markersize, 'color', c1)
errorbar(data.time_serum/60, data.KCL_serum_scaled, data.KCL_serum_err,'.', 'markersize', markersize,'color',c2)
plot(data.time_serum/60, data.KCL_serum_scaled, '.', 'markersize', markersize, 'color', c2)
errorbar(data.time_serum/60, data.MealKCL_serum_scaled, data.MealKCL_serum_err,'.', 'markersize', markersize,'color',c3)
plot(data.time_serum/60, data.MealKCL_serum_scaled, '.', 'markersize', markersize, 'color', c3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq', 'fontsize', fonts.ylabel)
title('Plasma [K^+] (K_{plasma})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([3.0,5.0])
text(xmin + labx,gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(f)', 'fontsize', fonts.lab)
hold off
% Kinterstitial
s = subplot(3,3,8);
varnum = 6;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:,varnum);
vals3 = X{3}(:,varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq', 'fontsize', fonts.ylabel)
title('Interstitial [K^+] (K_{inter})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([3.0,5.0])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(g)', 'fontsize', fonts.lab)
hold off
% KIC
s = subplot(3,3,9);
varnum = 8;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:,varnum);
vals3 = X{3}(:,varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq', 'fontsize', fonts.ylabel)
title('Intracellular [K^+] (K_{IC})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([120,140])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(h)', 'fontsize', fonts.lab)
hold off
legend(labels, 'fontsize', fonts.legend, 'Location', 'northeast')
end
if plt_effects
figure(101)
% rho_insullin
s = subplot(2,2,1);
varnum = 11;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:, varnum);
vals3 = X{3}(:, varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('\rho_{insulin}', 'fontsize', fonts.ylabel)
title('[insulin] effect on \Phi_{ECtoIC} (\rho_{insulin})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([0.92, 1.15])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(a)', 'fontsize', fonts.lab)
hold off
% rho_al
s = subplot(2,2,2);
varnum = 12;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:, varnum);
vals3 = X{3}(:, varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('\rho_{al}', 'fontsize', fonts.ylabel)
title('[ALD] effect on \Phi_{ECtoIC} (\rho_{al})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([0.92, 1.15])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(b)', 'fontsize', fonts.lab)
hold off
% gamma_Kin
s = subplot(2,2,3);
varnum = 21;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:, varnum);
vals3 = X{3}(:, varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('\gamma_{Kin}', 'fontsize', fonts.ylabel)
title('GI Feedforward Effect (\gamma_{Kin})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([0.92, 7])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(c)', 'fontsize', fonts.lab)
hold off
% gamma_al
s = subplot(2,2,4);
varnum = 20;
vals1 = X{1}(:,varnum);
vals2 = X{2}(:, varnum);
vals3 = X{3}(:, varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('\gamma_{al}', 'fontsize', fonts.ylabel)
title('[ALD] effect on \Phi_{dt-Ksec} (\gamma_{al})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([0.92, 1.15])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(d)', 'fontsize', fonts.lab)
hold off
legend(labels, 'fontsize', 12, 'Location', 'best')
end
if plt_kidney
figure(102)
% phi_filK
s = subplot(2,2,1);
varnum = 15;
vals1 = X{1}(:, varnum);
vals2 = X{2}(:, varnum);
vals3 = X{3}(:, varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq/min', 'fontsize', fonts.ylabel)
title('Filtered K^+ load (\Phi_{filK})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([0.4, 0.6])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(a)', 'fontsize', fonts.lab)
hold off
% phi_dtKsec
s = subplot(2,2,2);
varnum = 18;
vals1 = X{1}(:, varnum);
vals2 = X{2}(:, varnum);
vals3 = X{3}(:, varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq/min', 'fontsize', fonts.ylabel)
title('DT K^+ secretion (\Phi_{dt-Ksec})', 'fontsize', fonts.title)
xlim([xmin, xmax])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(b)', 'fontsize', fonts.lab)
hold off
% CD K transport
s = subplot(2,2,3);
vals1 = X{1}(:, 23) - X{1}(:, 26);
vals2 = X{2}(:, 23) - X{2}(:, 26);
vals3 = X{3}(:, 23) - X{3}(:, 26);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq/min', 'fontsize', fonts.ylabel)
title('CD K^+ transport (\Phi_{cd-Ksec} - \Phi_{cd-Kreab})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([-0.19, -0.02])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(c)', 'fontsize', fonts.lab)
hold off
% phi_uK
s = subplot(2,2,4);
varnum = 28;
vals1 = X{1}(:, varnum);
vals2 = X{2}(:, varnum);
vals3 = X{3}(:, varnum);
plot(s, times1/60, vals1, 'linewidth', lw, 'color', c1, 'linestyle', ls1)
hold on
plot(s, times2/60, vals2, 'linewidth', lw, 'color', c2, 'linestyle', ls2)
plot(s, times3/60, vals3, 'linewidth', lw, 'color', c3, 'linestyle', ls3)
errorbar(data.time_UK/60, data.Meal_UK_scaled, data.Meal_UK_err,'.', 'markersize', markersize,'color',c1)
plot(data.time_UK/60, data.Meal_UK_scaled, '.', 'markersize', markersize, 'color', c1) % - with the datapoint
errorbar(data.time_UK/60, data.KCL_UK_scaled, data.KCL_UK_err,'.', 'markersize', markersize,'color',c2)
plot(data.time_UK/60, data.KCL_UK_scaled, '.', 'markersize', markersize, 'color', c2)
errorbar(data.time_UK/60, data.MealKCL_UK_scaled, data.MealKCL_UK_err,'.', 'markersize', markersize,'color',c3)
plot(data.time_UK/60, data.MealKCL_UK_scaled, '.', 'markersize', markersize, 'color', c3)
ax = gca;
ax.FontSize = fonts.ticks;
xlabel('time (hrs)', 'fontsize', fonts.xlabel)
ylabel('mEq/min', 'fontsize', fonts.ylabel)
title('Urinary K^+ excretion (\Phi_{uK})', 'fontsize', fonts.title)
xlim([xmin, xmax])
ylim([0,0.2])
text(xmin + labx, gca().YLim(1) + laby*(gca().YLim(2) - gca().YLim(1)), '(d)', 'fontsize', fonts.lab)
hold off
legend(labels, 'fontsize', 12, 'Location', 'best')
end
end