Home > FR3DSource > zClassifyPair.m

zClassifyPair

PURPOSE ^

zClassifyPair(N1,N2) calculates the rotation matrix, axis, angle, and shift

SYNOPSIS ^

function [Pair,s,coplanar] = zClassifyPair(N1,N2,CL,Exemplar,Force,Verbose)

DESCRIPTION ^

 zClassifyPair(N1,N2) calculates the rotation matrix, axis, angle, and shift
 between bases in File that are close enough to possibly be interacting, then
 classifies the interaction

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % zClassifyPair(N1,N2) calculates the rotation matrix, axis, angle, and shift
0002 % between bases in File that are close enough to possibly be interacting, then
0003 % classifies the interaction
0004 
0005 function [Pair,s,coplanar] = zClassifyPair(N1,N2,CL,Exemplar,Force,Verbose)
0006 
0007 if nargin < 5,
0008   Force = 0;
0009 end
0010 
0011 if nargin < 6,
0012   Verbose = 1;
0013 end
0014 
0015 if nargin < 3,
0016   CL = zClassLimits;                              % read ClassLimits matrix
0017 end
0018 
0019 if nargin < 4,
0020   if exist('PairExemplars.mat','file') > 0,
0021     load('PairExemplars','Exemplar');
0022   else
0023     Exemplar = [];
0024   end
0025 end
0026 
0027 % Paircode list
0028 % 1-AA  2-CA  3-GA  4-UA  5-AC  6-CC  7-GC  8-UC
0029 % 9-AG 10-CG 11-GG 12-UG 13-AU 14-CU 15-GU 16-UU
0030 
0031   paircode = 4*(N2.Code-1) + N1.Code;           % AA is 1, CA is 2, etc.
0032 
0033   if Force == 0,
0034    switch paircode
0035     case {2, 3, 4, 8, 10, 12},                  % put N2 at the origin
0036       M1 = N2;
0037       M2 = N1;
0038       s  = -1;                                  % bases in reversed order
0039     otherwise
0040       M1 = N1;
0041       M2 = N2;
0042       s  = 1;                                   % bases in original order
0043    end
0044   else
0045    M1 = N1;
0046    M2 = N2;
0047    s  = 1;
0048   end
0049 
0050   sh = (M2.Fit(1,:)-M1.Fit(1,:)) * M1.Rot;   % vector shift from 1 to 2
0051                                              % between glycosidic atoms,
0052                                              % relative to the plane of base 1
0053 
0054   coplanar = 0;                              % default value
0055 
0056   if (abs(sh(3)) < 5) || (Force > 0)
0057                                              % if small vertical shift
0058     Pair = zAnalyzePair(M1,M2,CL,Exemplar,sh,Verbose); % analyze and classify pair
0059 
0060     coplanar = Pair.Coplanar;
0061 
0062     if (abs(Pair.Class) >= 30) && (M1.Code == M2.Code) && (Force == 0),  % re-analyze AA CC ...
0063       M2 = N1;                               % reverse roles of nucleotides
0064       M1 = N2;
0065       s  = -1;
0066       sh2 = (M2.Fit(1,:)-M1.Fit(1,:)) * M1.Rot;   % vector shift from 1 to 2
0067       Pair2 = zAnalyzePair(M1,M2,CL,Exemplar,sh2,Verbose);%put other base at origin
0068       if fix(abs(Pair2.Class)) ~= 30,        % some known interaction, or near
0069         Pair = Pair2;                        % matched with M2 at origin
0070       else                                   % other interaction, like stacking
0071         Pair.Class = Pair2.Class;            % original order, use 2nd class
0072         s = 1;
0073       end
0074     end
0075 
0076     if (fix(abs(Pair.Edge)) == 30) && (Force == 0),% remove unclassified pairs
0077       Pair = [];
0078     end
0079 
0080   else
0081     Pair = [];
0082   end   % if small vertical distance or hand classified

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