This repository was archived by the owner on Mar 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualize_sharma_experimental_data.asv
More file actions
109 lines (101 loc) · 3.71 KB
/
visualize_sharma_experimental_data.asv
File metadata and controls
109 lines (101 loc) · 3.71 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
% addpath('kmedoids');
data = SBmeasurement('Sharma data for sbtoolbox.xls')
data_mutant = data{1}; % Mutant
data_WT = data{2}; % WT
data_titles = {'Mutant','WT'};
for j = 1:length(data)
[time,componentNames,values,minvalues,maxvalues] = SBmeasurementdata(data{j});
times = [];
for i = 1:length(componentNames)
times(:,i) = time;
end
[m,n] = size(values);
% Normalize
orig_values = values;
values = (values - repmat(values(1,:),m,1))./repmat(std(values),m,1);
maxvalues = (maxvalues - repmat(orig_values(1,:),m,1))./repmat(std(orig_values),m,1);
minvalues = (minvalues - repmat(orig_values(1,:),m,1))./repmat(std(orig_values),m,1);
%values = (values - repmat(mean(values),m,1))./repmat(std(values),m,1);
d = pdist(values(1:4,:)');
Z = linkage(d);
figure(2*(j-1)+1);
dendrogram(Z,'labels',componentNames)
title(data_titles{j});
k = 6;
idx = kmeans(values',k);
%idx = cluster(Z,'cutoff',1);
%k = max(idx);
figure(2*(j-1)+2);
axs = [];
for i = 1:k
subplot(ceil(k/2),2,i);
ixs = find(idx == i);
%hs = plot(times(:,ixs),values(:,ixs));
labels = times(:,1);
Y = values(:,ixs);
E = maxvalues(:,ixs) - values(:,ixs);
if length(ixs) == 1
hs = errorbar(times(:,ixs),Y,E);
else
handles = barweb(Y,E,0.9,labels,[],[],[],[], [],componentNames(:,ixs),'plot');
end
if length(ixs) > 1
h_mean = line(times(:,1),mean(values(:,ixs),2),'linewidth',3,'color','k');
end
if length(ixs) == 1
set(hs,'marker','*');
legend(componentNames(:,ixs),'Location','Northwest','interpreter','none');
end
axs(end+1) = gca;
title(data_titles{j});
end
% linkaxes(axs);
end
% Now compute the difference between the two
[time_mutant,componentNames_mutant,values_mutant,minvalues_mutant,maxvalues_mutant] = SBmeasurementdata(data_mutant);
times_mutant = [];
for i = 1:length(componentNames_mutant)
times_mutant(:,i) = time_mutant;
end
[m,n] = size(values_mutant);
% Don't Normalize
% values_mutant = (values_mutant - repmat(mean(values_mutant),m,1))./repmat(std(values_mutant),m,1);
orig_values_mutant = values_mutant;
[time_WT,componentNames_WT,values_WT,minvalues_WT,maxvalues_WT] = SBmeasurementdata(data_WT);
times_WT = [];
for i = 1:length(componentNames_WT)
times_WT(:,i) = time_WT;
end
[m,n] = size(values_WT);
% Don't Normalize
% values_WT = (values_WT - repmat(mean(values_WT),m,1))./repmat(std(values_WT),m,1);
orig_values_WT = values_WT;
saved_j = [];
diff = [];
for i = 1:length(componentNames_WT)
j = find(strcmp(componentNames_mutant,componentNames_WT{i}));
saved_j(i) = j;
diff(i) = sum(abs(values_WT(:,i) - values_mutant(:,j)));
end
[vs,inxs] = sort(diff,'descend');
set(0,'DefaultFigureWindowStyle','docked');
new_hs = [];
for k = 1:length(inxs)
i = inxs(k);
j = saved_j(i);
new_hs(end+1) = figure;
Y = [values_WT(:,i) values_mutant(:,i)];
E = [maxvalues_WT(:,i)-values_WT(:,i) maxvalues_mutant(:,i)-values_mutant];
hs = barweb(Y,E,0.9,times_WT(:,i),[],[],[],[], [],componentNames(:,ixs),'plot');
hs = plot(times_WT(:,i),values_WT(:,i),times_mutant(:,j),values_mutant(:,j));
set(hs,'marker','*');
legend('WT','Mutant');
title(componentNames_WT{i},'interpreter','none');
set(new_hs(end),'name',componentNames_WT{i});
end
set(0,'DefaultFigureWindowStyle','normal');
% figure(3)
% exp_inxs = [];
% exp_inxs(end+1) = find(strcmp(sharma_componentNames,'IFNG'));
% exp_hs = plot(repmat(time,1,length(exp_inxs)),orig_values(:,exp_inxs));
% legend('IFNG');