-
Notifications
You must be signed in to change notification settings - Fork 3
/
check_batch_columns.m
77 lines (77 loc) · 1.74 KB
/
check_batch_columns.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
%%check_batch_columns
% check that the batch column variables are the correct formatting before
% exporting
function [err_val, b] = check_batch_columns(b, i1)
%
err_val = 0;
%
if ~iscell(b.OpalLot)
fprintf(['WARNING: batch ', num2str(i1), 'Batch file error: column OpalLot\n'])
err_val = 1;
return
end
%
if ~iscell(b.OpalDilution)
fprintf(['WARNING: batch ', num2str(i1), 'Batch file error: column OpalDilution\n'])
err_val = 2;
return
end
%
if isa(b.Opal,'double')
%
% if B.Opal is a 'double' convert to a string
%
tmpopal = num2cell(b.Opal);
tmpopal = cellfun(@(x) num2str(x), tmpopal, 'Uni', 0);
ii = strcmp(tmpopal, 'NaN');
%
if sum(ii) > 1
ii = find(ii,1);
end
%
tmpopal(ii) = {'DAPI'};
ss = size(tmpopal);
if ss(1) == 1
b.Opal = tmpopal';
else
b.Opal = tmpopal;
end
end
%
if ~isa(b.Opal, 'cell')
fprintf(['WARNING: batch ', num2str(i1), 'Batch file error: column Opal\n'])
err_val = 3;
return
end
%
if ~iscell(b.Target)
fprintf(['WARNING: batch ', num2str(i1), 'Batch file error: column Target\n'])
err_val = 4;
return
end
%
if ~iscell(b.Target)
fprintf(['WARNING: batch ', num2str(i1), 'Batch file error: column Target\n'])
err_val = 4;
return
end
%
if ~iscell(b.Compartment)
fprintf(['WARNING: batch ', num2str(i1), 'Batch file error: column Compartment\n'])
err_val = 5;
return
end
%
if ~iscell(b.AbLot)
fprintf(['WARNING: batch ', num2str(i1), 'Batch file error: column AbLot\n'])
err_val = 6;
return
end
%
if ~iscell(b.AbDilution)
fprintf(['WARNING: batch ', num2str(i1), 'Batch file error: column AbDilution\n'])
err_val = 7;
return
end
%
end