-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjbFigure2.m
More file actions
244 lines (151 loc) · 4.75 KB
/
jbFigure2.m
File metadata and controls
244 lines (151 loc) · 4.75 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
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
function figure2(num_sub_bins)
% Must input the number of sub bins for the tres etc. calculations.
% set constants
% num_sub_bins = 10;
load jonscellsdata
all_fanos_msc=[];
all_tres_msc=[];
all_fanos=[];
all_tres=[];
all_tres_std=[];
all_entropy=[];
msc_cells=[];
msc_ff_cells=[];
msc_tres_cells=[];
tres_cells=[];
all_fanos_msc_1=[];
all_msc=[];
for f = 1:length(jonscells)
msc_ind = find(jonscells(f).meanspikecount>=1);
sub_bins = [10 6 3 2];
sub_ind = find(sub_bins == num_sub_bins);
tres_ind = find(jonscells(f).tresscores{sub_ind}>99);
if ~isempty(tres_ind)
tres_cells = [tres_cells f];
end
tres_std = jonscells(f).tres_std{sub_ind};
entropy = jonscells(f).entropy{sub_ind};
if ~isempty(msc_ind)
msc_cells = [msc_cells f];
fano = jonscells(f).fanofactor(msc_ind);
fano_ind = find(fano<1);
fano = fano(fano_ind);
entropy = entropy(msc_ind);
entropy = entropy(fano_ind);
tres = jonscells(f).tresscores{sub_ind};
tres = find(tres(msc_ind)>99);
tres_std = tres_std(msc_ind);
if ~isempty(fano)
msc_ff_cells = [msc_ff_cells f];
elseif ~isempty(tres)
msc_tres_cells = [msc_tres_cells f];
end
all_tres_std = [all_tres_std tres_std];
all_entropy = [all_entropy entropy];
all_fanos_msc_1 = [all_fanos_msc_1 fano];
end
all_fanos_msc = [all_fanos_msc jonscells(f).fanofactor(msc_ind)];
all_msc = [all_msc jonscells(f).meanspikecount(msc_ind)];
tres = jonscells(f).tresscores{sub_ind};
all_tres_msc = [all_tres_msc tres(msc_ind)];
all_fanos = [all_fanos jonscells(f).fanofactor];
all_tres = [all_tres jonscells(f).tresscores{sub_ind}];
end
fano_ind = find(all_fanos == 100);
all_fanos(fano_ind) = NaN;
fano_ind = find(all_fanos_msc < 1);
Number_Cells = length(jonscells)
Number_Cells_Frame_MSC1 = length(msc_cells)
Number_Cells_Frame_MSC1_FF1 = length(msc_ff_cells)
Number_Cells_Frame_TRES100 = length(tres_cells)
Number_Cells_Frame_MSC1_TRES100 = length(msc_tres_cells)
Number_Frames = length(all_fanos)
Number_Frames_MSC1 = length(all_fanos_msc)
Number_Frames_MSC1_FF1 = length(find(all_fanos_msc < 1))
Number_Frames_MSC1_TRES100 = length(find(all_tres_msc > 99))
Number_Frames_MSC1_FF1_TRES100 = length(find(all_tres_msc(fano_ind) > 99))
Number_Frames_FF1 = length(find(all_fanos < 1))
%%%%%%%%%%%%%%%%%% PANEL A %%%%%%%%%%%%%%%%%%%%%%%%
figure
for f = 1:length(jonscells)
hold on
plot(jonscells(f).meanspikecount,jonscells(f).fanofactor,'k.')
ylim([0 10])
xlim([0 5])
xlabel('Mean Count [spikes]')
ylabel('FF')
end
hold on
line([1 1],[0 10],'Color','r','LineWidth',2)
line([0 5],[1 1],'Color','r','LineWidth',2)
%%%%%%%%%%%%%%%%%% PANEL B %%%%%%%%%%%%%%%%%%%%%%%%
figure
for f = 1:length(jonscells)
hold on
plot(jonscells(f).meanspikecount,jonscells(f).fanofactor,'k.')
ylim([0 1])
xlim([0 5])
xlabel('Mean Count [spikes]')
ylabel('FF')
end
hold on
line([1 1],[0 1],'Color','r','LineWidth',2)
%%%%%%%%%%%%%%%%%% PANEL C %%%%%%%%%%%%%%%%%%%%%%%%
for s = 1:4
bin_count = [];
for c = 1:length(jonscells)
msc_ind = find(jonscells(c).meanspikecount>=1);
tres = jonscells(c).tresscores{s};
bin_count = [bin_count length(find(tres(msc_ind)>99))];
end
frame_count_tres_sig(s) = sum(bin_count);
end
figure
bar((frame_count_tres_sig/Number_Frames_MSC1)*100,1,'b')
ylabel('% occurences')
set(gca,'XTickLabel',[16 11 7 3])
%%%%%%%%%%%%%%%%%% PANEL D %%%%%%%%%%%%%%%%%%%%%%%%
figure
[N,X] = histc(all_fanos_msc,0:.5:6);
bar(0:.5:6,N,1,'r')
hold on
[N,X] = histc(all_fanos_msc(find(all_tres_msc>99)),0:.5:6);
bar(0:.5:6,N,1,'b')
xlim([0 6])
xlabel('FF')
ylabel('# occurences')
%%%%%%%%%%%%%%%%%% PANEL E %%%%%%%%%%%%%%%%%%%%%%%%
figure
plot(all_tres_std,all_fanos_msc,'k.')
hold on
line([0 10],[1 1],'Color','r')
line([1 1],[0 10],'Color','r')
xlim([0 10])
ylim([0 5])
xlabel('TREStd(10)')
ylabel('FF')
%%%%%%%%%%%%%%%%%% PANEL F %%%%%%%%%%%%%%%%%%%%%%%%
figure
plot(all_entropy,all_fanos_msc_1,'k.')
xlabel('ENT(10)')
ylabel('FF')
%%%%%%%%%%%%%%%%%% PANEL C %%%%%%%%%%%%%%%%%%%%%%%%
tres_ind = find(all_tres == 0);
all_tres(tres_ind) = NaN;
bin = 0:2:100;
figure
[N] = histc(all_tres,bin);
bar(bin,N,1,'r')
hold on
[N] = histc(all_tres_msc,bin);
bar(bin,N,1,'b')
xlabel('TRES Scores')
axis tight
figure
plot(all_msc,all_fanos_msc,'k.')
ylim([0 10])
xlim([0 5])
xlabel('Mean Count [spikes]')
ylabel('FF')
line([1 1],[0 10],'Color','r','LineWidth',2)
line([0 5],[1 1],'Color','r','LineWidth',2)