Home > FR3DSource > xExcludeOverlap2.m

xExcludeOverlap2

PURPOSE ^

xExcludeOverlap(Candidates) removes candidates which overlap with one

SYNOPSIS ^

function [Candidates,Discrepancy] = xExcludeOverlap2(Candidates, Discrepancy, Perm)

DESCRIPTION ^

 xExcludeOverlap(Candidates) removes candidates which overlap with one
 another, leaving only the one that occurs first in the list

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % xExcludeOverlap(Candidates) removes candidates which overlap with one
0002 % another, leaving only the one that occurs first in the list
0003 
0004 function [Candidates,Discrepancy] = xExcludeOverlap2(Candidates, Discrepancy, Perm)
0005 
0006 N    = length(Candidates(1,:)) - 1;    % number of nucleotides
0007 
0008 Keep = ones(size(Candidates(:,1))); % rows of Candidates which are kept
0009 
0010 [C,ord] = sortrows(Candidates,[N+1 Perm]); % sort by filenumber, nucleotides
0011 
0012 %D = diff(C);                           % matrix of row differences
0013 %D(:,1:(N+1)) = abs(sign(D(:,1:(N+1))));% 1 for every difference, 0 if same
0014 
0015 a = 1;                                 % index of current lowest discrepancy
0016 for i = 2:(length(C(:,1))-1),              % go through row differences
0017   if C(a,N+1) == C(i,N+1),             % if file numbers agree
0018     if sum(C(a,1:N) == C(i,1:N)) > N/2, % if more than half agree
0019         if Discrepancy(ord(i)) > Discrepancy(ord(a)),
0020         Keep(i) = 0;                   % reject i; a has lower discrep
0021       else
0022         Keep(a) = 0;                   % reject a; i has lower discrep
0023         a = i;                         % found one with lower discrepancy
0024       end
0025     else
0026       a = i;                           % moved on to new motif
0027     end
0028   else
0029     a = i;                             % moved on to new file
0030   end
0031 end
0032 
0033 Keep(ord) = Keep;                      % undo the re-ordering
0034 OK = find(Keep);
0035 Candidates = Candidates(OK,:);         % return only non-overlapping candidates
0036 Discrepancy = Discrepancy(OK);

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