-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstat_cell_param_md.m
More file actions
160 lines (106 loc) · 10.1 KB
/
stat_cell_param_md.m
File metadata and controls
160 lines (106 loc) · 10.1 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
clear all; clc;
close all;
warning off;
%% load data
dir_name = '../../analysis/picked/';;
fnames = dir( [ dir_name '/*.mat' ]);
px_to_mu = 0.065;
t_int = 3.0;
%% extract and calculate all cell data
mother_cell_counter = 1;
for i=1:numel(fnames)
struct_tmp = load([dir_name fnames(i).name]);
fnames_channel = fieldnames(struct_tmp.cell_list);
L_channles = length(fnames_channel(:,1));
for j=1:L_channles
cell_g2_id = fnames_channel{j,1};
cell_g2_temp = struct_tmp.cell_list.(cell_g2_id);
length_g2_temp = double(px_to_mu*cell_g2_temp.lengths_w_div);
% if cell_g2_temp.birth_label ==1 && isfield(cell_g2_temp,'initiation_time') == 1 && cell_g2_temp.lengths_w_div(end) < 20 && ismember(cell_g2_temp.daughters(1,:),fnames_channel) %&& cell_g2_temp.peak > 0 && cell_g2_temp.peak < 2000 %filter out filamentous cells
if cell_g2_temp.birth_label ==1 && isfield(cell_g2_temp,'initiation_time') == 1 && isfield(cell_g2_temp,'initiation_time_n') == 1 && cell_g2_temp.lengths_w_div(end) < 20 && ismember(cell_g2_temp.daughters(1,:),fnames_channel) %&& cell_g2_temp.peak > 0 && cell_g2_temp.peak < 2000 %filter out filamentous cells
% if cell_g2_temp.birth_label ==1 && isfield(cell_g2_temp,'initiation_time') == 1 && isfield(cell_g2_temp,'initiation_time_n') == 1 && isfield(cell_g2_temp,'initiation_time_n2') == 0 && cell_g2_temp.n_oc_n == 2 && cell_g2_temp.lengths_w_div(end) < 20 && ismember(cell_g2_temp.daughters(1,:),fnames_channel) %&& cell_g2_temp.peak > 0 && cell_g2_temp.peak < 2000 %filter out filamentous cells
cell_g3_id = cell_g2_temp.daughters(1,:);
cell_g3_temp = struct_tmp.cell_list.(cell_g3_id);
length_g3_temp = double(px_to_mu*cell_g3_temp.lengths_w_div);
% if cell_g2_temp.lengths_w_div(end) < 20 && isfield(cell_g3_temp,'initiation_time') == 1 && cell_g3_temp.lengths_w_div(end) < 20 %filter out filamentous cells
if cell_g2_temp.lengths_w_div(end) < 20 && isfield(cell_g3_temp,'initiation_time') == 1 && isfield(cell_g3_temp,'initiation_time_n') == 1 && cell_g3_temp.lengths_w_div(end) < 20 %filter out filamentous cells
% if cell_g2_temp.lengths_w_div(end) < 20 && isfield(cell_g3_temp,'initiation_time') == 1 && isfield(cell_g3_temp,'initiation_time_n') == 1 && isfield(cell_g3_temp,'initiation_time_n2') == 0 && cell_g3_temp.n_oc_n == 2 && cell_g3_temp.lengths_w_div(end) < 20 %filter out filamentous cells
%----------parameters for mother generation--------
generation_time_g2( mother_cell_counter ) = double( cell_g2_temp.tau ) ;
newborn_length_g2( mother_cell_counter ) = cell_g2_temp.sb;
newborn_width_g2( mother_cell_counter ) = cell_g2_temp.widths_w_div(1);
division_length_g2( mother_cell_counter ) = cell_g2_temp.sd;
division_width_g2( mother_cell_counter ) = cell_g2_temp.widths_w_div(end);
newborn_volume_g2( mother_cell_counter ) = (newborn_length_g2( mother_cell_counter )-newborn_width_g2( mother_cell_counter ))*pi*(newborn_width_g2( mother_cell_counter )/2)^2+(4/3)*pi*(newborn_width_g2( mother_cell_counter )/2)^3;
division_volume_g2( mother_cell_counter ) = (division_length_g2( mother_cell_counter )-division_width_g2( mother_cell_counter ))*pi*(division_width_g2( mother_cell_counter )/2)^2+(4/3)*pi*(division_width_g2( mother_cell_counter )/2)^3;
added_length_g2( mother_cell_counter ) = division_length_g2( mother_cell_counter ) - newborn_length_g2( mother_cell_counter );
added_volume_g2( mother_cell_counter ) = division_volume_g2( mother_cell_counter ) - newborn_volume_g2( mother_cell_counter );
cell_width_g2( mother_cell_counter ) = mean(cell_g2_temp.widths_w_div(1:end));
septum_position_g2( mother_cell_counter ) = cell_g2_temp.septum_position;
birth_time_g2( mother_cell_counter) = t_int*double(cell_g2_temp.birth_time);
division_time_g2( mother_cell_counter) = t_int*double(cell_g2_temp.division_time);
growth_rate_g2( mother_cell_counter ) = 60*log(division_volume_g2( mother_cell_counter )/newborn_volume_g2( mother_cell_counter ))/generation_time_g2( mother_cell_counter );
elongation_rate_g2( mother_cell_counter ) = 60*log(division_length_g2( mother_cell_counter )/newborn_length_g2( mother_cell_counter ))/generation_time_g2( mother_cell_counter );
if length(length_g2_temp)>2
ft1 = fittype('a*x+b');
Growth_time = t_int*double( cell_g2_temp.times_w_div - cell_g2_temp.times_w_div(1) );
Growth_length = px_to_mu*cell_g2_temp.lengths_w_div;
fit_temp = fit(Growth_time',log(Growth_length)',ft1);
elongation_rate_fit_g2( mother_cell_counter ) = 60*fit_temp.a;
elseif length(length_g2_temp)==2
elongation_rate_fit_g2( mother_cell_counter ) = 60*elongation_rate_g2( mother_cell_counter );
end
initiation_time_g2_m( mother_cell_counter ) = t_int*double(cell_g2_temp.initiation_time); %note the change in definitions
initiation_time_g2( mother_cell_counter ) = t_int*double(cell_g2_temp.initiation_time_n);
termination_time_g2( mother_cell_counter ) = t_int*double(cell_g2_temp.termination_time);
initiation_mass_g2_m( mother_cell_counter ) = cell_g2_temp.initiation_mass; %note the change in definitions
initiation_mass_g2( mother_cell_counter ) = cell_g2_temp.initiation_mass_n;
termination_mass_g2( mother_cell_counter ) = cell_g2_temp.termination_mass;
B_period_g2( mother_cell_counter ) = t_int*double(cell_g2_temp.initiation_time - cell_g2_temp.birth_time_m);
C_period_g2( mother_cell_counter ) = t_int*double(cell_g2_temp.termination_time - cell_g2_temp.initiation_time);
D_period_g2( mother_cell_counter ) = t_int*double(cell_g2_temp.division_time - cell_g2_temp.termination_time);
tau_cyc_g2( mother_cell_counter ) = t_int*double(cell_g2_temp.division_time - cell_g2_temp.initiation_time);
%----------parameters for daughter generation--------
generation_time_g3( mother_cell_counter ) = double( cell_g3_temp.tau ) ;
newborn_length_g3( mother_cell_counter ) = cell_g3_temp.sb;
newborn_width_g3( mother_cell_counter ) = cell_g3_temp.widths_w_div(1);
division_length_g3( mother_cell_counter ) = cell_g3_temp.sd;
division_width_g3( mother_cell_counter ) = cell_g3_temp.widths_w_div(end);
newborn_volume_g3( mother_cell_counter ) = (newborn_length_g3( mother_cell_counter )-newborn_width_g3( mother_cell_counter ))*pi*(newborn_width_g3( mother_cell_counter )/2)^2+(4/3)*pi*(newborn_width_g3( mother_cell_counter )/2)^3;
division_volume_g3( mother_cell_counter ) = (division_length_g3( mother_cell_counter )-division_width_g3( mother_cell_counter ))*pi*(division_width_g3( mother_cell_counter )/2)^2+(4/3)*pi*(division_width_g3( mother_cell_counter )/2)^3;
added_length_g3( mother_cell_counter ) = division_length_g3( mother_cell_counter ) - newborn_length_g3( mother_cell_counter );
added_volume_g3( mother_cell_counter ) = division_volume_g3( mother_cell_counter ) - newborn_volume_g3( mother_cell_counter );
cell_width_g3( mother_cell_counter ) = mean(cell_g3_temp.widths_w_div(1:end));
septum_position_g3( mother_cell_counter ) = cell_g3_temp.septum_position;
birth_time_g3( mother_cell_counter) = t_int*double(cell_g3_temp.birth_time);
division_time_g3( mother_cell_counter) = t_int*double(cell_g3_temp.division_time);
growth_rate_g3( mother_cell_counter ) = 60*log(division_volume_g3( mother_cell_counter )/newborn_volume_g3( mother_cell_counter ))/generation_time_g3( mother_cell_counter );
elongation_rate_g3( mother_cell_counter ) = 60*log(division_length_g3( mother_cell_counter )/newborn_length_g3( mother_cell_counter ))/generation_time_g3( mother_cell_counter );
if length(length_g3_temp)>2
ft1 = fittype('a*x+b');
Growth_time = t_int*double( cell_g3_temp.times_w_div - cell_g3_temp.times_w_div(1) );
Growth_length = px_to_mu*cell_g3_temp.lengths_w_div;
fit_temp = fit(Growth_time',log(Growth_length)',ft1);
elongation_rate_fit_g3( mother_cell_counter ) = 60*fit_temp.a;
elseif length(length_g3_temp)==2
elongation_rate_fit_g3( mother_cell_counter ) = 60*elongation_rate_g3( mother_cell_counter );
end
initiation_time_g3_m( mother_cell_counter ) = t_int*double(cell_g3_temp.initiation_time); %note the change in definitions
initiation_time_g3( mother_cell_counter ) = t_int*double(cell_g3_temp.initiation_time_n);
termination_time_g3( mother_cell_counter ) = t_int*double(cell_g3_temp.termination_time);
initiation_mass_g3_m( mother_cell_counter ) = cell_g3_temp.initiation_mass; %note the change in definitions
initiation_mass_g3( mother_cell_counter ) = cell_g3_temp.initiation_mass_n;
termination_mass_g3( mother_cell_counter ) = cell_g3_temp.termination_mass;
B_period_g3( mother_cell_counter ) = t_int*double(cell_g3_temp.initiation_time - cell_g3_temp.birth_time_m);
C_period_g3( mother_cell_counter ) = t_int*double(cell_g3_temp.termination_time - cell_g3_temp.initiation_time);
D_period_g3( mother_cell_counter ) = t_int*double(cell_g3_temp.division_time - cell_g3_temp.termination_time);
tau_cyc_g3( mother_cell_counter ) = t_int*double(cell_g3_temp.division_time - cell_g3_temp.initiation_time);
mother_cell_counter = mother_cell_counter + 1;
end
end
end
if mod(i,10)==0
i
end
end
% save('../../analysis/cell_cycle_stat_md_GUI_noc2.mat');