Home > FR3DSource > mGetPDBFilenames.m

mGetPDBFilenames

PURPOSE ^

mGetPDBfilenames %By Ali Mokdad - April 14 2006

SYNOPSIS ^

function [s,snolist] = mGetPDBFilenames(void)

DESCRIPTION ^

mGetPDBfilenames %By Ali Mokdad - April 14 2006
This looks in the folder <PDBFiles> for files with extensions .pdb-1repetitions

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %mGetPDBfilenames %By Ali Mokdad - April 14 2006
0002 %This looks in the folder <PDBFiles> for files with extensions .pdb-1repetitions
0003 
0004 % Extended to search Matlab's path for PDB files and to use the native
0005 % file separator rather than \  - CLZ 2006-07-18
0006 
0007 function [s,snolist] = mGetPDBFilenames(void)
0008 
0009 a = dir(['PDBFiles' filesep '*.pdb']);
0010 a = [a; dir(['PDBFiles' filesep '*.PDB'])];         % for the Mac
0011 a = [a; dir(['PrecomputedData' filesep '*.mat'])];
0012 a = [a; dir(['PrecomputedData' filesep '*.MAT'])];  % for the Mac
0013 
0014 p = path;                                           % search Matlab's path
0015 c = [0 strfind(p,pathsep) length(p)+1];
0016 for i=1:length(c)-1,
0017   a = [a; dir([p(c(i)+1:c(i+1)-1) filesep '*.pdb'])];
0018 end
0019 
0020 if ~isempty(a)
0021     for i=1:length(a)
0022       temp{i} = regexprep(a(i).name,'.mat|.MAT|.PDB1|.pdb1|.PDB2|.pdb2|.PDB3|.pdb3|.PDB4|.pdb4|.PDB5|.pdb5|.PDB6|.pdb6|.PDB7|.pdb7|.PDB8|.pdb8','');   % strip extensions and spaces
0023       temp{i} = regexprep(temp{i},'.pdb|.PDB ','');   % strip extensions and spaces
0024       temp{i} = regexprep(temp{i},'_small','');     % don't list small's too
0025       if ~isempty(strfind(temp{i},'_list')),
0026         temp{i} = [' ' temp{i}];                    % lists appear first
0027       end
0028     end
0029 
0030     temp = [' AllFiles_list' temp];
0031     
0032     [t,i] = sort(upper(temp));                       % sort list of PDB names
0033     temp = temp(i);
0034 
0035     for i=1:length(temp),
0036       temp{i} =regexprep(temp{i},' ','');           % strip spaces from lists
0037     end
0038 
0039     s{1,1}=temp{1};
0040     count=2;
0041     for i=2:length(temp)
0042       if ~strcmpi(temp{i},s{count-1,1})              % remove duplicates
0043         s{count,1}=temp{i};
0044         count=count+1;
0045       end
0046     end
0047 
0048     count = 1;
0049 
0050     for i = 1:length(s(:,1)),
0051       if isempty(strfind(s{i,1},'_list')),
0052         snolist{count,1} = s{i,1};
0053         count = count + 1;
0054       end
0055     end
0056 
0057 else
0058   s = [];
0059   snolist = []; 
0060 end
0061

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