Home > FR3DSource > xDiscrepancyFast.m

xDiscrepancyFast

PURPOSE ^

xDiscrepancy(Model,Cand) calculates the discrepancy between Model and

SYNOPSIS ^

function [Disc] = xDiscrepancyFast(Model,Cand)

DESCRIPTION ^

 xDiscrepancy(Model,Cand) calculates the discrepancy between Model and 
 Cand, which is an array of NT's.
 One must take the square root and divide by the number of nucleotides after.
 As soon as the discrepancy exceeds Model.RelCutoff, the calculation stops.
 The current sum is returned as a negative discrepancy, shifted to
 record when the calculation stopped.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % xDiscrepancy(Model,Cand) calculates the discrepancy between Model and
0002 % Cand, which is an array of NT's.
0003 % One must take the square root and divide by the number of nucleotides after.
0004 % As soon as the discrepancy exceeds Model.RelCutoff, the calculation stops.
0005 % The current sum is returned as a negative discrepancy, shifted to
0006 % record when the calculation stopped.
0007 
0008 function [Disc] = xDiscrepancyFast(Model,Cand)
0009 
0010 L = length(Cand);
0011 
0012 if (L == 2),
0013 
0014   C    = Cand(1).Rot' * Cand(2).Rot;
0015   r1   = Model.R * C;
0016   ang1 = zAngleOfRotation(r1);
0017   r2   = Model.R' * C';
0018   ang2 = zAngleOfRotation(r2);
0019 
0020   t1   = Model.T1 - (Cand(2).Center - Cand(1).Center)*Cand(1).Rot;
0021   t2   = Model.T2 - (Cand(1).Center - Cand(2).Center)*Cand(2).Rot;
0022 
0023   v    = Model.AngleWeight(1);
0024 
0025   Disc = (sqrt(t1*t1' + (v^2)*ang1^2) + sqrt(t2*t2' + (v^2)*ang2^2))/4;
0026 
0027   if (Disc > Model.LDiscCutoff),
0028     Disc = -1;
0029   end
0030 
0031 else
0032 
0033   MCC = Model.CenteredCenters;          % nucleotide centers in model
0034   MWC = Model.WeightedCenteredCenters;
0035 
0036   CandiCenters = cat(1,Cand.Center);
0037   CMean = Model.LocWeight * CandiCenters / Model.NumNT;
0038 
0039   CC = CandiCenters - ones(L,1) * CMean;  % subtract mean
0040   
0041   R = zBestRotation(CC, MWC);             % candidate onto model
0042   
0043   S = Model.LocWeight * sum(((MCC - CC*R').^2)')';  % distances between centers
0044   n = 1;                                    % nucleotide number for angles
0045   
0046   while (S <= Model.LDiscCutoff) & (n <= L),
0047     ang = zAngleOfRotation(R*Cand(n).Rot*(Model.NT(n).Rot)');
0048     S   = S + (ang^2)*Model.AngleWeight(n)^2;
0049     n   = n + 1;
0050   end
0051 
0052 %  if (n==1),
0053 %    Disc = -sqrt(S)/Model.NumNT - 100;       % distance knocked out candidate
0054 %  elseif S <= Model.LDiscCutoff,
0055 %    Disc = sqrt(S)/Model.NumNT;              % acceptable candidate
0056 %  else
0057 %    Disc = -sqrt(S)/Model.NumNT - n*100;     % angle n-1 knocked out candidate
0058 %  end
0059 
0060   if (n > 1) & (S <= Model.LDiscCutoff),
0061     Disc = S;
0062   else
0063     Disc = -1;
0064   end
0065 
0066   % add in contributions to the discrepancy from sugar locations
0067 
0068 end

Generated on Fri 03-Apr-2009 09:52:35 by m2html © 2003