-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmt_plot_array.m
More file actions
148 lines (137 loc) · 4.54 KB
/
mt_plot_array.m
File metadata and controls
148 lines (137 loc) · 4.54 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
%MT_PLOT_ARRAY - Plots image of array difference versus median array
%
% MT_PLOT_ARRAY(PROBES,ARRAYNR,VARARGIN)
%
% INPUT
% PROBES Probe structure
% ARRAYNR Number of array to visualize
% VARARGIN 'range' : Followed by colormap range (default: [-1 1])
% 'no_image' : Leave out image correction
% 'absolute' : Show absolute values instead of difference w.r.t. median
% 'image_effects' : Plot image effects estimated by mt_cor_image (implies 'absolute')
% 'batch_effects' : Take median over each row in the array for all arrays. Show
% the results of all arrays as columns in the image.
% With this etting, arraynr has no effect.
%
%
% DESCRIPTION
% Plots (PM) probe value (differences) on their array location to allow inspection for
% spatial array effects. If an array also contains mismatch probes (which are located
% next to their corresponding PM probes), then mismatch probe positions are filled with
% the PM value.
%
% SEE ALSO
% MT_COR_IMAGE, MT_PLOT_SEQ_EFFECTS, MT_PLOT_AMP_EFFECTS, MT_PLOT_GENE
%
% (c) Marc Hulsman, 2009
% Information & Communication Theory Group
% Faculty of Electrical Engineering, Mathematics and Computer Science
% Delft University of Technology, Mekelweg 4, 2628 CD Delft, The Netherlands
function mt_plot_array(probes,arraynr,varargin)
for i = 1:length(varargin)
if(isstr(varargin{i}))
switch(varargin{i})
case 'range',
i = i + 1;
c_range = varargin{i};
case 'no_image',
no_image = 1;
case 'absolute',
absolute = 1;
case 'image_effects',
image_effects = 1;
absolute = 1;
case 'batch_effects',
batch_effects = 1;
end;
end;
end;
if(~exist('image_effects'))
if(exist('no_image'))
data = mt_real_signal(probes,'no_image');
else
data = mt_real_signal(probes);
end;
else
data = probes.image_factors;
end;
[narrays,nprobe] = size(probes.pm);
if(~exist('absolute'))
med_data = median(data);
array_pm = data - repmat(med_data,narrays,1);
else
array_pm = data;
end;
if(isfield(probes,'array_ind'))
array_ind = probes.array_ind(i);
else
array_ind = 1;
end;
if(exist('batch_effects'))
map = [];
fprintf(1,' Determining batch effects');
for a = 1:length(arraynr)
i = arraynr(a);
if(mod(a,50) == 0)
fprintf(1,'.');
end;
if(isfield(probes,'array_ind'))
array_ind = probes.array_ind(i);
else
array_ind = 1;
end;
cmap = mt_map_to_array(probes,array_pm(i,:),array_ind);
map = [map median(cmap')'];
end;
fprintf(1,'\n');
else
if(length(arraynr) == 1)
array_pm = array_pm(arraynr,:);
if(isfield(probes,'array_ind'))
array_ind = probes.array_ind(arraynr);
else
array_ind = 1;
end;
map = mt_map_to_array(probes,array_pm,array_ind);
else
xmap = zeros(length(arraynr),probes.nrows,probes.ncols);
fprintf(1,' Averaging arrays');
for a = 1:length(arraynr)
i = arraynr(a);
if(mod(a,10) == 0)
fprintf(1,'.');
end;
if(isfield(probes,'array_ind'))
array_ind = probes.array_ind(i);
else
array_ind = 1;
end;
xmap(a,:,:) = mt_map_to_array(probes,array_pm(i,:),array_ind);
end;
map = squeeze(mean(xmap,1));
fprintf(1,'\n');
end;
end;
imagesc(map);
if(~exist('c_range'))
if(exist('image_effects') || exist('batch_effects'))
c_range = [-0.5 0.5];
else
if(exist('absolute'))
c_range = [min(map(:)) max(map(:))]
else
c_range = [-1 1];
end;
end;
end;
set(gca,'CLim',c_range);
colorbar
if(length(arraynr) == 1)
title(sprintf('Array image %d:%s',arraynr,probes.array_filenames{arraynr}))
else
if(exist('batch_effects'))
title('Arrays median row effect image')
else
title('Arrays average image')
end;
end;