-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall_feedback_models.m
218 lines (172 loc) · 7.75 KB
/
all_feedback_models.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
%% MB Feedback network model
% Basic model: PNs -> KCs -> MBON-| FBN -> MBIN with a lateral MBN input
% from an excitatory MBON.
% Common Parameters across KC->MBON weights
p.tmax = 1200;
p.t0 = 500;
p.t1 = 1000;
p.N = 7; % PN, KC, MBON, MBONL, FB, FB2, MBIN
p.tauinv = 1./[10 10 10 10 10 10 10]';
p.V0 = [0, 0, 0, 0, 0, 0, 0]';
q.k = 1.5;
q.yh = 5;
q.rel_strength = [10 10 10 10 10 10 10]';
Jpnkc = 1;
JkcmbonL = 1;
Jmbonfb = -0.5;
JmbonLfb = 0.5; % Key parameter in controlling shape of MBIN response.
Jfbfb2 = 0.5;
Jfbmbin = 0.4;
Jfb2fb = -0;
Jfb2mbin = -0.5;
tonic_activation = [0 0 0 0 2 2 4]';
% Run simulations across different KC->MBON weights, activating olfaction
Jkcs = 0:0.01:1; % Vector of KC->MBON weights to run.
stim = [10, 0, 0, 0, 0, 0, 0]'; % Stimulation vector. Only stimulate the PNs here.
mbon_max = zeros(size(Jkcs));
fb_max = zeros(size(Jkcs));
fb2_max = zeros(size(Jkcs));
mbin_max = zeros(size(Jkcs));
mbin_dyn = cell(length(Jkcs),2);
all_dat = cell(length(Jkcs),1);
% For every KC->MBON connection weight, run the ode in logistic_integration_general and record key information.
for jj = 1:length(Jkcs)
Jkcmbon = Jkcs(jj);
p.A = [ [0 0 0 0 0 0 0];... % PN input
[Jpnkc 0 0 0 0 0 0];... % KC input
[0 Jkcmbon 0 0 0 0 0];... % MBON input
[0 JkcmbonL 0 0 0 0 0];... % MBONL input
[0 0 Jmbonfb JmbonLfb Jfb2fb 0 0];... % FB input
[0 0 0 0 Jfbfb2 0 0];... % FB2 input
[0 0 0 0 Jfbmbin Jfb2mbin 0]]; % MBIN input
[r_out, t_out] = logistic_integration_general( stim, p, q, tonic_activation );
mbon_max(jj) = max(r_out(:,3));
fb_max(jj) = max(r_out(:,5));
fb2_max(jj) = max(r_out(:,6));
mbin_max(jj) = max(r_out(:,7));
tss = and( t_out > 850, t_out<900 ); % Look only within a time window after the dynamics have reached equilbrium.
mbon_ss(jj) = max(r_out(tss,3));
fb_ss(jj) = max(r_out(tss,5));
fb2_ss(jj) = max(r_out(tss,6));
mbin_ss(jj) = max(r_out(tss,7));
mbin_dyn{jj,1} = t_out;
mbin_dyn{jj,2} = r_out(:,7);
all_dat{jj} = r_out;
end
cmap_qual = cbrewer('qual','Dark2',4);
clr1d = 0.9*cbrewer('div','RdBu',length(Jkcs));
% Plot the steady state responses as a function of KC->MBON connection weight.
figure('Color','w'); hold on;
plot(Jkcs,mbon_ss / max(mbon_ss),'Color',cmap_qual(1,:),'LineWidth',2)
plot(Jkcs,fb_ss / max(fb_ss),'Color',cmap_qual(2,:),'LineWidth',2)
plot(Jkcs,fb2_ss / max(fb2_ss),'Color',cmap_qual(4,:),'LineWidth',2)
plot(Jkcs,mbin_ss / max(mbin_ss),'Color',cmap_qual(3,:),'LineWidth',2)
plot([0.1],mbin_ss(0.1==Jkcs) / max(mbin_ss),'Marker','o','MarkerSize',10,'LineWidth',2,'Color',clr1d( 0.1==Jkcs, :) )
plot([0.5],mbin_ss(0.5==Jkcs) / max(mbin_ss),'Marker','o','MarkerSize',10,'LineWidth',2,'Color',clr1d( 0.5==Jkcs, :) )
plot([0.9],mbin_ss(0.9==Jkcs) / max(mbin_ss),'Marker','o','MarkerSize',10,'LineWidth',2,'Color',clr1d( 0.9==Jkcs, :) )
set(gca,'XDir','Reverse','TickDir','out','YTick',[0, 0.5, 1], 'YLim',[0 1] )
axis square
export_fig('steady_state_values_fb_june5.pdf')
mbon_val = zeros(size(Jkcs));
fb_val = zeros(size(Jkcs));
fb2_val = zeros(size(Jkcs));
mbin_val = zeros(size(Jkcs));
figure('Color','w'); hold on;
for ii = 1:length(Jkcs)
if or( Jkcs(ii) == 0.1, or(Jkcs(ii) == 0.5 , Jkcs(ii) == 0.9 ) )
% plot(mbin_dyn{ii,1},mbin_dyn{ii,2} / max(max(mbin_max)),'Color',clr1d(ii,:),'LineWidth',2 )
plot(mbin_dyn{ii,1},mbin_dyn{ii,2},'Color',clr1d(ii,:),'LineWidth',2 )
end
end
axis square
set(gca,'XLim',[400 1200],'TickDir','out','YLim',[0 5.5]);
export_fig('examples_with_fb2_june5.pdf')
%% Rerun simulation assuming lower/higher baseline FBN states (given by the value of the tonic input into the FBN)
tonic_activation_low = [0 0 0 0 2 2 4]';
tonic_activation_high = [0 0 0 0 4 2 4]';
Jkcs = 0.9;
% In these conditions, we stimulate the MBON instead of the PNs, since this is like the ChR experiments.
stim_mbon = [0, 0, 10, 0, 0, 0, 0]';
p_baseline = p;
p_baseline.A = [ [0 0 0 0 0 0 0];... % PN input
[Jpnkc 0 0 0 0 0 0];... % KC input
[0 Jkcmbon 0 0 0 0 0];... % MBON input
[0 JkcmbonL 0 0 0 0 0];... % MBONL input
[0 0 Jmbonfb JmbonLfb Jfb2fb 0 0];... % FB input
[0 0 0 0 Jfbfb2 0 0];... % FB2 input
[0 0 0 0 Jfbmbin Jfb2mbin 0]]; % MBIN input
[r_out_low, t_out_low] = logistic_integration_general( stim_mbon, p_baseline, q, tonic_activation_low );
[r_out_high, t_out_high] = logistic_integration_general( stim_mbon, p_baseline, q, tonic_activation_high );
figure('Color','w'); hold on;
plot(t_out_low,r_out_low(:,7),'Color',[0.5, 0.5, 0.5], 'LineWidth',2)
plot(t_out_high,r_out_high(:,7),'Color',[0.1, 0.1, 0.1], 'LineWidth',2)
set(gca,'XLim',[400 1200],'TickDir','out','YLim',[0 4]);
legend({'Low FBN Baseline', 'High FBN Baseline'});
export_fig('baseline_comparison.pdf')
%% Re-do the whole initial set of runs at the high baseline values.
Jpnkc = 1;
JkcmbonL = 1;
Jmbonfb = -0.5;
JmbonLfb = 0.5; % Key parameter in controlling shape of MBIN response.
Jfbfb2 = 0.5;
Jfbmbin = 0.4;
Jfb2fb = -0;
Jfb2mbin = -0.5;
tonic_activation = tonic_activation_high;
% Run simulations across different KC->MBON weights, activating olfaction
Jkcs = 0:0.01:1;
stim = [10, 0, 0, 0, 0, 0, 0]';
mbon_max = zeros(size(Jkcs));
fb_max = zeros(size(Jkcs));
fb2_max = zeros(size(Jkcs));
mbin_max = zeros(size(Jkcs));
mbin_dyn = cell(length(Jkcs),2);
all_dat = cell(length(Jkcs),1);
for jj = 1:length(Jkcs)
Jkcmbon = Jkcs(jj);
p.A = [ [0 0 0 0 0 0 0];... % PN input
[Jpnkc 0 0 0 0 0 0];... % KC input
[0 Jkcmbon 0 0 0 0 0];... % MBON input
[0 JkcmbonL 0 0 0 0 0];... % MBONL input
[0 0 Jmbonfb JmbonLfb Jfb2fb 0 0];... % FB input
[0 0 0 0 Jfbfb2 0 0];... % FB2 input
[0 0 0 0 Jfbmbin Jfb2mbin 0]]; % MBIN input
[r_out, t_out] = logistic_integration_general( stim, p, q, tonic_activation );
mbon_max(jj) = max(r_out(:,3));
fb_max(jj) = max(r_out(:,5));
fb2_max(jj) = max(r_out(:,6));
mbin_max(jj) = max(r_out(:,7));
tss = and( t_out > 850, t_out<900 ); % Steady state sampling window
mbon_ss(jj) = max(r_out(tss,3));
fb_ss(jj) = max(r_out(tss,5));
fb2_ss(jj) = max(r_out(tss,6));
mbin_ss(jj) = max(r_out(tss,7));
mbin_dyn{jj,1} = t_out;
mbin_dyn{jj,2} = r_out(:,7);
all_dat{jj} = r_out;
end
cmap_qual = cbrewer('qual','Dark2',4);
clr1d = 0.9*cbrewer('div','RdBu',length(Jkcs));
% Plot the steady state results as before.
figure('Color','w'); hold on;
plot(Jkcs,mbon_ss / max(mbon_ss),'Color',cmap_qual(1,:),'LineWidth',2)
plot(Jkcs,fb_ss / max(fb_ss),'Color',cmap_qual(2,:),'LineWidth',2)
plot(Jkcs,fb2_ss / max(fb2_ss),'Color',cmap_qual(4,:),'LineWidth',2)
plot(Jkcs,mbin_ss / max(mbin_ss),'Color',cmap_qual(3,:),'LineWidth',2)
plot([0.1],mbin_ss(0.1==Jkcs) / max(mbin_ss),'Marker','o','MarkerSize',10,'LineWidth',2,'Color',clr1d( 0.1==Jkcs, :) )
plot([0.64],mbin_ss(0.64==Jkcs) / max(mbin_ss),'Marker','o','MarkerSize',10,'LineWidth',2,'Color',clr1d( 0.5==Jkcs, :) )
plot([0.9],mbin_ss(0.9==Jkcs) / max(mbin_ss),'Marker','o','MarkerSize',10,'LineWidth',2,'Color',clr1d( 0.9==Jkcs, :) )
set(gca,'XDir','Reverse','TickDir','out','YTick',[0, 0.5, 1], 'YLim',[0 1] )
axis square
export_fig('high_baseline_ss_values_june5.pdf')
%%
figure('Color','w'); hold on;
for ii = 1:length(Jkcs)
if or( round(Jkcs(ii)*100) == 10, or( round(Jkcs(ii)*100) == 64 , round( Jkcs(ii)*100 ) == 90 ) )
% plot(mbin_dyn{ii,1},mbin_dyn{ii,2} / max(max(mbin_max)),'Color',clr1d(ii,:),'LineWidth',2 )
plot(mbin_dyn{ii,1},mbin_dyn{ii,2},'Color',clr1d(ii,:),'LineWidth',2 )
end
end
axis square
set(gca,'XLim',[400 1200],'TickDir','out','YLim',[0 5.5]);
export_fig('high_baseline_examples_june5.pdf')