Home > FR3DSource > xFindCandidates.m

xFindCandidates

PURPOSE ^

xFindCandidates finds and ranks candidate fits to Model

SYNOPSIS ^

function Found = xFindCandidates(File,Model,Verbose)

DESCRIPTION ^

 xFindCandidates finds and ranks candidate fits to Model

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % xFindCandidates finds and ranks candidate fits to Model
0002 
0003 function Found = xFindCandidates(File,Model,Verbose)
0004 
0005 Found = uint16([]);                         % store indices as integers
0006 
0007 starttime = cputime;                        % to track time usage
0008 
0009 for f=1:length(File),
0010  if File(f).NumNT > 0,                      % if the file is non-empty
0011   filestarttime = cputime;                  % for this file only
0012   Codes = cat(1,File(f).NT(:).Code);        % codes to use in nucleotide mask
0013   if isfield(Model,'OKPairs') | isfield(Model,'ExPairs'),%  screen by paircode
0014     N = length(Codes);
0015     PC = Codes * ones(1,N) + 4*(ones(N,1)*(Codes'-1));
0016   else
0017     PC = [];
0018   end
0019 
0020   for i=2:min(9,Model.NumNT)                % loop through model nucleotides
0021     for j=1:(i-1)
0022       PS{i,j} = xPairwiseScreen(File(f),Codes,Model,i,j,PC);
0023       PS{j,i} = PS{i,j}';
0024       NNZ(i,j) = nnz(PS{i,j});              % number of non-zero entries
0025       NNZ(j,i) = NNZ(i,j);
0026     end
0027   end
0028 
0029   Perm = sFindPermutation(NNZ);               % find best nucleotide order
0030   PS   = PS(Perm,Perm);                       % re-order nucleotides
0031 
0032   [List,SS] = xFindPolyhedra(Model,min(9,Model.NumNT),PS);
0033 
0034   if ~isempty(List),
0035     List(:,Perm) = List(:,1:min(9,Model.NumNT));     % re-order nucleotides
0036   end
0037 
0038   %-----------------------------------------------------------------------
0039   for r = 10:Model.NumNT,              % additional nucleotides, if needed
0040     if length(List(:,1)) > 0,
0041       for q = 1:(r-1),
0042         S{r,q} = xPairwiseScreen(File(f),Codes,Model,r,q);
0043       end                              % end for q
0044         [List,SS] = xAddNucleotide(Model,List,S,SS,r);
0045     end                                % end if length(List(:,1)) > 0,
0046 %   fprintf('Adding nucleotide %2d took     %14.3f seconds\n',r,toc);
0047   end                                  % end for r
0048 
0049   %-------------------------------------------------------------------------
0050 
0051   [s,t] = size(List);
0052   if s > 0,
0053     Found = [Found; [List uint16(f*ones(s,1))]];
0054     if Verbose > 0,
0055       fprintf('Found %7d possibilities from %10s in %8.3f seconds\n', s, File(f).Filename, cputime-filestarttime);
0056     end
0057   end
0058 
0059   drawnow
0060 
0061  end % if File(f).NumNT > 0
0062 end  % end of for loop length(File)
0063 
0064 [s,t] = size(Found);
0065 if (length(File) > 1) && (Verbose > 0),
0066   fprintf('Found %7d possible candidates in %8.3f seconds\n', s, (cputime-starttime));
0067 end
0068 
0069 drawnow
0070

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