-
Notifications
You must be signed in to change notification settings - Fork 4
/
CycIF_96wellplate_generate_table.m
75 lines (59 loc) · 1.83 KB
/
CycIF_96wellplate_generate_table.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
%% Convert plate CycIF data to table
% 2017/06/27 Jerry Lin
%
% Need to run CycIF_readplate_xx first
% Need "labels" for column names
myName = input('Please input table name:','s');
rows = {'A','B','C','D','E','F','G','H'};
cols = {'01','02','03','04','05','06','07','08','09','10','11','12'};
start_r = input('Please input starting row (1-8):');
end_r = input('Please input ending row (1-8):');
start_c = input('Please input starting column (1-12):');
end_c = input('Please input ending column (1-12):');
flag1 = input('Do you want to output the csv file?(y/n)','s');
alldata = table;
if ~exist('labels','var')
labels = channels;
for i =1:length(channels);
labels(i) = strrep(channels(i),'-','_');
end
end
%% Access nuclear data (cell array)
for r=start_r:end_r;
for c=start_c:end_c;
temp1 = wellsum_nuc{r,c};
table1 = array2table(temp1,'VariableNames',labels);
table1.well = repmat({strcat(rows{r},cols{c})},length(temp1),1);
if isempty(alldata);
alldata = table1;
else
alldata = vertcat(alldata,table1);
end
end
end
eval(strcat(myName,'_nuc','=alldata;'));
if strcmp(flag1,'y')
outputname = strcat(myName,'_nuc.csv');
writetable(alldata,outputname);
end
clear alldata;
alldata = table;
%% Access cytosol data (cell array)
for r=start_r:end_r;
for c=start_c:end_c;
temp1 = wellsum_Cyto{r,c};
table1 = array2table(temp1,'VariableNames',labels);
table1.well = repmat({strcat(rows{r},cols{c})},length(temp1),1);
if isempty(alldata);
alldata = table1;
else
alldata = vertcat(alldata,table1);
end
end
end
eval(strcat(myName,'_cyto','=alldata;'));
if strcmp(flag1,'y')
outputname = strcat(myName,'_cyto.csv');
writetable(alldata,outputname);
end
clear alldata;