0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 function [File,Index] = zAddNTData(Filenames,ReadCode,File,Verbose,PDBStart)
0016
0017 if nargin < 2,
0018 ReadCode = 0;
0019 end
0020
0021 if nargin < 4,
0022 Verbose = 0;
0023 end
0024
0025 LoadedFiles = {};
0026 F = 0;
0027
0028 if nargin >= 3,
0029 F = length(File);
0030 for j = 1:length(File),
0031 LoadedFiles{j} = lower(File(j).Filename);
0032 if isempty(LoadedFiles{j}),
0033 LoadedFiles{j} = '';
0034 end
0035 end
0036 end
0037
0038 if strcmp(class(Filenames),'char'),
0039 Filenames = {Filenames};
0040 end
0041
0042
0043
0044 FullList = [];
0045
0046 for j=1:length(Filenames),
0047 FullList = [FullList; zReadPDBList(Filenames{j},1)];
0048 end
0049
0050
0051
0052 if nargin == 5,
0053 if strcmp(PDBStart,'back') == 1,
0054 FullList = FullList(end:-1:1);
0055 else
0056 keep = [];
0057 for j=1:length(FullList),
0058 if issorted([lower(PDBStart(1:4)); lower(FullList{j}(1:4))],'rows'),
0059 keep = [keep j];
0060 end
0061 end
0062 FullList = FullList(keep);
0063 end
0064 end
0065
0066
0067
0068 if length(FullList) > 0,
0069
0070 for f = 1:length(FullList),
0071 if ~isempty(FullList{f}),
0072 i = strmatch(lower(FullList{f}), LoadedFiles, 'exact');
0073 if isempty(i),
0074 NewF = zGetNTData(FullList{f},ReadCode,Verbose);
0075 if ReadCode ~= 3,
0076 if F == 0,
0077 clear File
0078 File(1) = NewF;
0079 else
0080 File(F+1) = NewF;
0081 end
0082 end
0083 clear NewF;
0084 F = length(File);
0085 k = length(LoadedFiles);
0086 LoadedFiles{k+1} = FullList{f};
0087 Index(f) = F;
0088 else
0089 Index(f) = i(1);
0090 if length(File(i(1)).NT) == 0,
0091 NewF = zGetNTData(File(Index(f)).Filename,ReadCode,Verbose);
0092 if ReadCode ~= 3,
0093 File(Index(f)) = NewF;
0094 clear NewF;
0095 end
0096 end
0097 end
0098 end
0099 end
0100
0101
0102 F = length(File);
0103
0104 for i = 1:length(Index),
0105 if Index(i) == 0,
0106 File(F+1).Filename = 'Fictitious';
0107 File(F+1).NumNT = 0;
0108 Index(i) = F+1;
0109 end
0110 end
0111
0112 else
0113
0114 fprintf('No files specified to read in %s\n', Filenames{1});
0115
0116 end