-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseeVisits2.m
More file actions
196 lines (141 loc) · 5.24 KB
/
seeVisits2.m
File metadata and controls
196 lines (141 loc) · 5.24 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
%% Initialize
stepSize = 50;
n_divide = 6;
% data_duration{1} is LatA
% data_duration{2} is for N_end < 4
% data_duration{3} is for N_end > 6
data_duration = {};
f_latA_50 = {...
'C:\Users\Rafael\Documents\ITQB estágio\code\zmw1_1uMactin_LatA_nobump_thr150_Salapaka50',...
'C:\Users\Rafael\Documents\ITQB estágio\code\zmw5_1uM_LatA_cut_thr150_Salapaka50'};
f_actin_50 = {...
'C:\Users\Rafael\Documents\ITQB estágio\code\zmw1_1uMactin_nobump_thr300_Salapaka50',...
'C:\Users\Rafael\Documents\ITQB estágio\code\zmw2_BSA_nobump_thr300_Salapaka50'};
f_latA_30 = {...
'C:\Users\Rafael\Documents\ITQB estágio\code\zmw1_1uMactin_LatA_nobump_thr150_Salapaka30',...
'C:\Users\Rafael\Documents\ITQB estágio\code\zmw5_1uM_LatA_cut_thr150_Salapaka30'};
f_actin_30 = {...
'C:\Users\Rafael\Documents\ITQB estágio\code\zmw1_1uMactin_nobump_thr300_Salapaka30',...
'C:\Users\Rafael\Documents\ITQB estágio\code\zmw2_BSA_nobump_thr300_Salapaka30'};
f_TIRF_latA = {'C:\Users\Rafael\Documents\ITQB estágio\TIRF\TIRF_data_F2_g_ABCD_Lat A 10 uM_1'};
f_TIRF_actin = {'C:\Users\Rafael\Documents\ITQB estágio\TIRF\TIRF_data_F1_g_ABCD_1'};
%% LatA
files = f_latA_50;
for file = 1:length(files)
load(files{file});
sz = size(Step);
% get visits data (frequency and duration)
visits = {};
for i = 1:sz(1)
fit = getNumSteps2(Step(i,:),stepSize);
%[~,~,~,fit,~,~,~,~,~] = Int2MonNum_DoubleSteps(Step(i,:));
visits{i} = visitFrequency(fit,n_divide);
end
% for each sub_trace compute total_time for each level
for i = 1:n_divide
if file == 1
data_duration{1}{i} = zeros(1,11);
end
% for each level
for j = 1:11
sum = 0;
% for each trace
for k = 1:sz(1)
if length(visits{k}{i}{2}) >= j
sum = sum + visits{k}{i}{2}(j);
end
end
% the level j at sub_trace i has a total visitation time of sum
data_duration{1}{i}(j) = data_duration{1}{i}(j) + sum;
end
end
end
%% Actin
files = f_actin_50;
for file = 1:length(files)
load(files{file});
sz = size(Step);
end_file = zeros(1,sz(1));
% get visits data (frequency and duration)
visits = {};
for i = 1:sz(1)
fit = getNumSteps2(Step(i,:),stepSize);
%[~,~,~,fit,~,~,~,~,~] = Int2MonNum_DoubleSteps(Step(i,:));
end_file(i) = fit(end);
visits{i} = visitFrequency(fit,n_divide);
end
% for each sub_trace compute total_time for each level
for i = 1:n_divide
if file == 1
data_duration{2}{i} = zeros(1,11);
data_duration{3}{i} = zeros(1,11);
end
% for each level
for j = 1:11
sum1 = 0;
sum2 = 0;
% for each trace
for k = 1:sz(1)
if length(visits{k}{i}{2}) >= j
% separate by population
if end_file(k) < 4
sum1 = sum1 + visits{k}{i}{2}(j);
elseif end_file(k) > 6
sum2 = sum2 + visits{k}{i}{2}(j);
end
end
end
% the level j at sub_trace i has a total visitation time of sum
data_duration{2}{i}(j) = data_duration{2}{i}(j) + sum1;
data_duration{3}{i}(j) = data_duration{3}{i}(j) + sum2;
end
end
end
%% plot
f1 = figure('Name','LatA / Actin N_end < 4 / Actin N_end > 6');
ax = axes('Units', 'normalized', 'Position', [0 0 1 0.5]);
tlt = {'LatA','Actin N_{end} < 4','Actin N_{end} > 6'};
for k = 1:3
for i = 1:n_divide
s_p = subplot(n_divide,3,k + (i - 1) * 3,'Parent',f1);
b = bar(s_p,data_duration{k}{i},'XData',0:10);
xlim([-1,11]);
%yTick = get(s_p,'YTick');
%set(s_p,'YTick',[]);
sub_sz = round(sz(2)/n_divide);
w = (i - 1) * sub_sz + 1;
%if k == 1
% ylabel(s_p,['Slice ',num2str(i)]);
%set(s_p,'YTick',yTick);
%end
if i == 1
title(tlt{k});
%title(sprintf('%d to %d',round(w/5),round(min(w+sub_sz,sz(2))/5)));
end
if i~=n_divide
set(s_p,'XTick',[]);
end
end
end
%% plot 2
%f1 = figure('Name','LatA / Actin N_end < 3 / Actin N_end > 6');
%ax = axes('Units', 'normalized', 'Position', [0 0 1 0.5]);
tlt = {'LatA','Actin N_{end} < 4','Actin N_{end} > 6'};
table = zeros(11,n_divide);
for i = 1:n_divide
table(:,i) = data_duration{3}{i};
end
h = HeatMap(table,'Colormap','redgreencmap');
%% plot 3
f1 = figure('Name','LatA / Actin N_end < 4 / Actin N_end > 6');
tlt = {'LatA','Actin N_{end} < 4','Actin N_{end} > 6'};
table = zeros(11,n_divide);
for i = 1:n_divide
table(:,n_divide - i + 1) = data_duration{3}{i};
end
b = bar3(table);
title('N_{end} > 6');
xlabel('Time slices');
ylabel('Levels');
zlabel('Visitation duration');
set(gca,'YTickLabel',0:10);