/
at_checkOutlier.m
executable file
·175 lines (131 loc) · 3.87 KB
/
at_checkOutlier.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
function [out str]=at_checkOutlier(stats,a,mother,outlier)
% check is cell cycle event is an outlier
global timeLapse
out=0;
if numel(mother)==0
mother=stats(a,5);
end
%chi2=stats(a,533);
if nargin==4
tdiv=outlier.tdiv;
tg1=outlier.tg1;
ts=outlier.ts;
tg2=outlier.tg2;
tana=outlier.tana;
chi=outlier.chi;
else
tdiv=timeLapse.autotrack.timing.tdiv;
tg1=timeLapse.autotrack.timing.tg1;
ts=timeLapse.autotrack.timing.ts;
tg2=timeLapse.autotrack.timing.tg2;
tana=timeLapse.autotrack.timing.tana;
chi=timeLapse.autotrack.timing.chi;
end
% conversion in minutes
coef2=3;
tdiv=coef2*tdiv;
tg1=coef2*tg1;
ts=coef2*ts;
tg2=coef2*tg2;
tana=coef2*tana;
cc=15;
y=stats(a,cc:cc+100-1); pix2=y>0; y=y(pix2);
yfit=stats(a,cc+100:cc+200-1); yfit=yfit(pix2);
chi2=sum( (yfit-y).^2 ) / length(y);
%max(y),chi2
chi2=chi2/max(y).^2;
if mother==0
coef=1.5;
else
coef=1;
end
% parameters in the set param timings functions
str=[];
if stats(a,10)< tdiv(1) || stats(a,10) > tdiv(2) out=1; %'ok1',b=stats(a,10)
str=[str '-tdiv=' num2str(stats(a,10))];
end
if stats(a,11)< coef*tg1(1) || stats(a,11) > coef*tg1(2) out=1; %'ok2',b=stats(a,11)
str=[str '-tg1=' num2str(stats(a,11))];
end
if stats(a,12)< ts(1) || stats(a,12) > ts(2) out=1; %'ok3',b=stats(a,12)
str=[str '-ts=' num2str(stats(a,12))];
end
if stats(a,13)< tg2(1) || stats(a,13) > tg2(2) out=1; %'ok4',b=stats(a,13)
str=[str '-tg2=' num2str(stats(a,13))];
end
if stats(a,11)*stats(a,216)<20*5*coef2 & mother==0 out=1; %'ok2',b=stats(a,11)
str=[str '-vdiv x tg1'];
end %CHECK
if stats(a,11)< 3*coef2 && stats(a,13)< 3*coef2 out=1; %'ok2',b=stats(a,11)
str=[str '-tg1&tg2'];
end %CHECK
% if stats(a,11)< 0.5* stats(a,12) out=1; %'ok2',b=stats(a,11)
% str=[str '-tg1&ts'];
% end CHECK
%
% if stats(a,13)< 0.1*stats(a,12) out=1; %'ok2',b=stats(a,11)
% str=[str '-tg2&ts'];
% end %. CHECK
if stats(a,14)< tana(1) || stats(a,14) > tana(2) out=1; %'ok5',b=stats(a,14)
str=[str '-tana=' num2str(stats(a,14))];
end
if chi2> chi out=1; %chi2
str=[str '-chi2=' num2str(chi2)];
end
% other constraints
%if stats(a,215)<= 0 out=1; %'ok1',b=stats(a,10)
% str=[str '-tbud=' num2str(stats(a,215))];
%end
if stats(a,216)<= 0 out=1; %'ok1',b=stats(a,10)
str=[str '-VCellDiv=' num2str(stats(a,216))];
end
% if stats(a,223)<= 9 | stats(a,223)>= 11 out=1; %'ok1',b=stats(a,10)
% str=[str '-VBudS=' num2str(stats(a,223))];
% end
if stats(a,217)<= 0 out=1; %'ok1',b=stats(a,10)
str=[str '-VCellG1=' num2str(stats(a,217))];
end
if stats(a,218)<= 0 out=1; %'ok1',b=stats(a,10)
str=[str '-VCellS=' num2str(stats(a,218))];
end
if stats(a,219)<= 0 out=1; %'ok1',b=stats(a,10)
str=[str '-VCellG2=' num2str(stats(a,219))];
end
if stats(a,220)<= 0 out=1; %'ok1',b=stats(a,10)
str=[str '-VCellA=' num2str(stats(a,220))];
end
%if stats(a,211)<= 0 out=1; %'ok1',b=stats(a,10)
% str=[str '-V_Bud_Div=' num2str(stats(a,221))];
%end
%if stats(a,222)<= 0 out=1; %'ok1',b=stats(a,10)
% str=[str '-V_Bud_G1=' num2str(stats(a,222))];
%end
%%%
%if stats(a,223)<= 0 out=1; %'ok1',b=stats(a,10)
% str=[str '-VBudS=' num2str(stats(a,223))];
%end
%%%
if stats(a,224)<= 0 out=1; %'ok1',b=stats(a,10)
str=[str '-VBudG2=' num2str(stats(a,224))];
end
if stats(a,225)<= 0 out=1; %'ok1',b=stats(a,10)
str=[str '-VBudA=' num2str(stats(a,225))];
end
if abs(stats(a,531))> 120 out=1; %'ok1',b=stats(a,10)
str=[str '-muunbud=' num2str(stats(a,531))];
end
if stats(a,531)<0 && stats(a,5)==0 out=1; %'ok1',b=stats(a,10)
str=[str '-muunbud=' num2str(stats(a,531))];
end
if isnan(stats(a,531)) out=1;
str=[str '-muunbud=NaN'];
end
if stats(a,532)<= 0 out=1; %'ok1',b=stats(a,10)
str=[str '-mubud=' num2str(stats(a,532))];
end
if isnan(stats(a,532)) out=1;
str=[str '-mubud=NaN'];
end
if stats(a,533)> 2 out=1; %'ok1',b=stats(a,10)
str=[str '-asy=' num2str(stats(a,533))];
end