0001
0002
0003
0004 function [Header] = zExtractAtomsPDB(Filename,Outputname,Verbose)
0005
0006 if nargin < 3,
0007 Verbose = 1;
0008 end
0009
0010 fid = fopen(Filename,'r');
0011
0012 Header.ModelStart = 1;
0013
0014 if fid > 0
0015
0016 out = fopen(Outputname,'w');
0017
0018 L = 1;
0019
0020 c = 1;
0021
0022 while L > -1
0023 L = fgets(fid);
0024 if L > -1
0025 if ~isempty(strfind(L,'RESOLUTION')),
0026 Header.Resolution = L;
0027 end
0028 if ~isempty(strfind(L,'EXPDTA')),
0029 Header.Expdata = L;
0030 end
0031 if strcmp(L(1:min(4,length(L))),'ATOM'),
0032 fprintf(out,'%s',L);
0033 c = c + 1;
0034 L = -1;
0035 end
0036 end
0037 end
0038
0039 L = 1;
0040
0041 while L > -1
0042 L = fgets(fid);
0043 if L > -1
0044 if strcmp(L(1:min(4,length(L))),'ATOM'),
0045 fprintf(out,'%s',L);
0046 c = c + 1;
0047 end
0048 if strcmp(L(1:min(5,length(L))),'MODEL'),
0049 Header.ModelStart = [Header.ModelStart c];
0050 end
0051 end
0052 end
0053
0054 fclose(fid);
0055 fclose(out);
0056
0057 if Verbose > 0,
0058 fprintf('Read %s\n', Filename)
0059 end
0060 else
0061
0062 fprintf('Could not open file %s\n', Filename);
0063
0064 end
0065
0066 if ~isfield(Header,'ExpData'),
0067 Header.ExpData = '';
0068 end
0069
0070 if ~isfield(Header,'Resolution'),
0071 Header.Resolution = [];
0072 end