Home > FR3DSource > xExcludeOverlap.m

xExcludeOverlap

PURPOSE ^

xExcludeOverlap(Candidates) removes candidates which overlap with one

SYNOPSIS ^

function [Candidates,Discrepancy] = xExcludeOverlap(Candidates,Discrepancy,Limit)

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] = xExcludeOverlap(Candidates,Discrepancy,Limit)
0005 
0006 N      = length(Candidates(1,:)) - 1;  % number of nucleotides
0007 
0008 OK     = zeros(size(Candidates(:,1))); % rows of Candidates which are kept
0009 OK(1)  = 1;                            % keep the first; lowest discrepancy
0010 NumOK  = 1;                            % counter for number kept
0011 
0012 for i = 2:length(Candidates(:,1)),     %
0013   AddCand = 1;                         % default is to add this one
0014   if Discrepancy(i) >= 0,           % if discrepancy is below GuarCutoff
0015     j = 1;                               % first kept candidate
0016     while (j <= NumOK) & (AddCand == 1), % go through kept candidates
0017       if Candidates(i,N+1) == Candidates(OK(j),N+1),  % same file
0018         Both = intersect(Candidates(i,1:N), Candidates(OK(j),1:N)); %overlap
0019         if length(Both) > N/2,         % lots of overlap here
0020           AddCand = 0;                 % end the loop
0021         end
0022       end
0023       j = j + 1;                       % on to next kept candidate
0024     end
0025     if AddCand == 1,                   % no overlapping candidate found
0026       NumOK = NumOK + 1;
0027       OK(NumOK) = i;
0028     end
0029   end
0030 
0031   if NumOK >= Limit,
0032     fprintf('Top %2d distinct candidates retained\n', Limit);
0033     break
0034   end
0035 
0036 end
0037 
0038 OK = OK(1:NumOK);
0039 
0040 Candidates = Candidates(OK,:);
0041 Discrepancy = Discrepancy(OK);

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