-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaptIncludeExperimentalConditions.m
More file actions
60 lines (52 loc) · 1.97 KB
/
aptIncludeExperimentalConditions.m
File metadata and controls
60 lines (52 loc) · 1.97 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
function aptIncludeExperimentalConditions(validationMode)
%aptIncludeExperimentalConditions Summary of this function goes here
% Detailed explanation goes here
if ~exist('validationMode','var')
validationMode = false;
end
global apt
% This does not work (yet) when removing nans from data.
if isfield(apt.pred,'ExpCond') && apt.pred.ExpCond
conc = [];
arrayData = [];
if ~validationMode
for id = 1:length(apt.data)
if apt.config.fitReplicates
conc = [conc apt.data(id).conc*ones(1,length(unique(apt.data(id).sequence)))];
arrayData = [arrayData apt.data(id).array*ones(1,length(unique(apt.data(id).sequence)))];
else
conc = [conc apt.data(id).conc*ones(1,length(apt.data(id).sequence))];
arrayData = [arrayData apt.data(id).array*ones(1,length(apt.data(id).sequence))];
end
end
else
for id = 1:length(apt.data)
if apt.config.fitReplicates
expConc(id) = apt.data(id).conc;
arrayData = [arrayData apt.data(id).array*ones(1,length(unique(apt.data(id).sequence)))];
else
expConc(id) = apt.data(id).conc;
arrayData = [arrayData apt.data(id).array*ones(1,length(apt.data(id).sequence))];
end
end
expConc = mean(expConc);
conc = expConc*ones(1,length(apt.sequence));
arraySimu = zeros(1,length(apt.sequence));
end
if length(isnan(conc)) < length(conc)
apt.predNames{end+1} = 'Concentration';
apt.predX = [apt.predX; conc];
end
uniArray = unique(arrayData);
if length(uniArray)>1
for ia = 2:length(uniArray)
apt.predNames{end+1} = ['Array#' num2str(uniArray(ia))];
if ~validationMode
apt.predX = [apt.predX; arrayData == uniArray(ia)];
else
apt.predX = [apt.predX; arraySimu];
end
end
end
end
end