-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomputeRatiometric.m
35 lines (29 loc) · 1.06 KB
/
computeRatiometric.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
function rplate = computeRatiometric(plate, ch, chref);
%--------------------------------------------------------------------------
% rplate = computeRatiometric(plate, ch, chref)
%
% computeRatiometric: compute ratiometric expression rate for channel ch
% (<ch>_ratio), simply takes the ratio:
%
% <ch>_ratio = plate(i).<ch>_alpha / plate(i).<chref>_alpha
%
% plate = cell array returned by importPlate2 or subsequent processing.
% ch = name of channel to compute ratio for (string).
% chref = reference channel name.
%
% (c) Tim Rudge, 2014
% (Provided under GPL v3 license, http://www.gnu.org/copyleft/gpl.html)
%--------------------------------------------------------------------------
n = length(plate(:));
for i=1:n;
if ~isempty(plate(i).(ch)) && ~isempty(plate(i).(chref));
% Input field names
chalpha = [ch '_alpha'];
refalpha = [chref '_alpha'];
% Output field name
rname = [ch '_ratio'];
% Compute the ratio
plate(i).(rname) = plate(i).(chalpha)./plate(i).(refalpha);
end;
end;
rplate = plate;