Commit a74ca570 authored by Alois SCHLOEGL's avatar Alois SCHLOEGL
Browse files

improve support for matlab

parent 88305d41
......@@ -116,7 +116,8 @@ function result = aminolookup (varargin)
%% this is an extension of the matlab options
searchtype = 'integer';
elseif ischar (varargin{1})
if ((mod (numel (varargin{1}), 3) == 0) && (find (isupper (varargin{1})) == 1:3:numel (varargin{1})))
nel = numel (varargin{1});
if ((mod (nel, 3) == 0) && all(find(isstrprop(varargin{1},'upper')) == [1:3:nel]))
%% if the number of characters is divisible by 3 and exactly
%% every third character is upper case
searchtype = 'abbreviation';
......
......@@ -52,13 +52,21 @@ while (k <= length(varargin))
end
if isempty(ToFileValue)
if exist('OCTAVE_VERSION','builtin')
ToFileValue=[PDBid,'.pdb.gz'];
else
ToFileValue=[PDBid,'.pdb'];
end
end
%%% Download file
url=sprintf('https://files.rcsb.org/download/%s.pdb.gz',PDBid);
if ~exist(ToFileValue,'file')
urlwrite(url,ToFileValue)
if exist('OCTAVE_VERSION','builtin')
urlwrite(url,ToFileValue);
else
gunzip(url);
end
end
R = pdbread(ToFileValue);
......
......@@ -45,7 +45,11 @@ while (k <= length(varargin))
end
end
fid = fopen(ToFileValue,'rz');
if exist('OCTAVE_VERSION','builtin')
fid = fopen(ToFileValue,'rz');
else
fid = fopen(ToFileValue,'r');
end
R.Title = char([]);
R.Authors = char([]);
......@@ -203,7 +207,7 @@ while ~feof(fid)
Atom.AtomNameStruct.chemSymbol = strtrim(line(13:14));
Atom.AtomNameStruct.remoteInd = line(15);
Atom.AtomNameStruct.branch = strtrim(line(16));
R.Model(ModelSerialNo).Atom(end+1) = Atom;
R.Model(ModelSerialNo).Atom{end+1} = Atom;
case 'CISPEP'
case 'CONECT'
......@@ -246,7 +250,7 @@ while ~feof(fid)
HetAtom.AtomNameStruct.chemSymbol = strtrim(line(13:14));
HetAtom.AtomNameStruct.remoteInd = line(15);
HetAtom.AtomNameStruct.branch = strtrim(line(16));
R.Model(ModelSerialNo).HeterogenAtom(end+1) = HetAtom;
R.Model(ModelSerialNo).HeterogenAtom{end+1} = HetAtom;
case 'LINK '
case 'MODRES'
......@@ -280,7 +284,7 @@ while ~feof(fid)
R.HeterogenName(ix).hetID = hetID;
R.HeterogenName(ix).ChemName = tok;
else
R.HeterogenName(ix).ChemName = [R.HeterogenName(ix).ChemName; tok];
R.HeterogenName(ix).ChemName = strvcat(R.HeterogenName(ix).ChemName, tok);
end
end
case 'HETSYN'
......@@ -331,7 +335,7 @@ while ~feof(fid)
Terminal.chainID = line(22);
Terminal.resSeq = str2double(line(23:26));
Terminal.iCode = strtrim(line(27));
R.Model(ModelSerialNo).Terminal(end+1) = Terminal;
R.Model(ModelSerialNo).Terminal{end+1} = Terminal;
% other
case 'JRNL '
......@@ -339,7 +343,7 @@ while ~feof(fid)
otherwise
[tok2, tok3] = strtok(tok);
if all(isdigit(tok2))
if all(isstrprop(tok2,'digit'))
value = [value;tok3];
else
value = tok;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment