1 %> Biomarkers comparer
class
4 %> Trevisan et al 2012. Submitted to AC.
9 %> =20.
"half-height" distance between biomarkers. This is the distance in x-values (wavenumbers) where the degree of agreement
10 %> will be considered to be 50%
12 %> =1. Whether to use the weights that are passed to go()
17 %> @param A First set of wavenumbers
18 %> @param B Second set of wavenumbers
19 %> @param WA (Optional) Weights of first set of wavenumbers. If not supplied or supplied
as "[]", all weights will be considered the same. The weight scale is irrelevant.
20 %> @param WB (Optional) Weights of second set of wavenumbers. If not supplied or supplied as "[]", all weights will be considered the same. The weight scale is irrelevant.
21 %> @return [matches, finalindex] the "matches" structure has the following fields:
22 %> @arg @c .indexes 2-element vector containing the indexes of the originals
23 %> @arg @c .wns 2-element vector containing the x-positions (wavenumbers/"wns") of the corresponding indexes
24 %> @arg @c .agreement Result of the agreement calculation using the sigmoit function
25 %> @arg @c .weight Average between the (normalized) weights of the matched positions
26 %> @arg @c .strength Just the result of <code>agreement*weight</code>
27 %> The "agreement" will be calculated by a logistic sigmoid function (that of shape 1/(1+exp(x)))
28 function [matches, finalindex] = go(o, A, B, WA, WB)
30 % Parameters check and adjustments
31 if nargin < 4 || isempty(WA) || ~o.flag_use_weights
32 WA = ones(1, numel(A));
34 if nargin < 5 || isempty(WB) || ~o.flag_use_weights
35 WB = ones(1, numel(B));
40 [m1, fi1] = o.internal_compare_biomarkers(A, B, WA, WB, hh);
41 [m2, fi2] = o.internal_compare_biomarkers(B, A, WB, WA, hh);
43 % Reverts the indexes and wns of second matches
45 m2(i).indexes = m2(i).indexes([2, 1]);
46 m2(i).wns = m2(i).wns([2, 1]);
51 finalindex = mean([fi1, fi2]);
55 methods(Access=protected, Static)
56 function [matches, finalindex] = internal_compare_biomarkers(A, B, WA, WB, hh)
58 % Determines some sizes
64 % sigfun0 =
sigfun(0); % Small correction factor, because sigfun(0) = .9975 instead of 1
67 % Finds element of B the closest to i-th element in A
68 [val, idx0] = min(abs(A(i)-B));
70 b.indexes = [i, idx0];
71 b.wns = [A(i), B(idx0)];
72 b.agreement = sigfun(val, hh); %/sigfun0;
73 b.weight = mean([WA(i), WB(idx0)]);
74 % b.weight = sqrt(WA(i)*WB(idx0)); % Now geometric mean
75 b.strength = b.agreement*b.weight;
77 matches(i) = b; %
#ok<AGROW>
80 % Note that
if n < nmax, some biomarkers will remain unmatched and the maximum
final index will be n/nmax
82 finalindex = sum([matches.strength])/sum([matches.weight]); % Normalizes to 1
83 % finalindex = finalindex; *nA/nmax;
89 o.classtitle = 'Biomarkers comparer';
Analysis Session (AS) base class.
function sigfun(in x, in hh, in flag_demo)