pdbread function doesn't read individual models

5 次查看(过去 30 天)
The matlab pdbread function (and a similar function from a toolbox with the same codebase) appears to never correctly execute the 'ModelNum' name-value argument. I've tried many multi-model .pdb files from RCSB and some i've made myself, and it will always throw a warning "Warning: PDB file does not contain Model 1. Reading the entire file.". This is despite pymol, chimera, and chimerax recognizing the separate models immediately. I'm at a loss as to how a PDB could ever lack a model 1 in the first place, because the same thing happens for single-model pdbs. Most amusingly, the output struct actually has the correct number of separate model records!
Anyone ever encountered this behavior? Is pdbread old enough to be buggy with changes to the pdb format?

采纳的回答

Carson Purnell
Carson Purnell 2022-6-17
Well I ended up needed to make my own pdb reader function for my purpose (generating density maps). Here's the function if anyone else wants specifically atom coordinates or the volume(s) itself many times faster than pdbread and no other pdb record information.

更多回答(1 个)

dmitry luchinskii
编辑:dmitry luchinskii 2022-7-8
Most likely you need to modify the following lines (108-109 in version R2022b):
% modelMatch = ['^MODEL \s*' num2str(modelNum) '\s'];
% h = find(~cellfun(@isempty,regexp(theLines(modelStarts),modelMatch,'once')));
modelMatch = ['MODEL \s* ' num2str(modelNum)];
h = find(~cellfun(@isempty,regexp(theLines(modelStarts),modelMatch)));
I had the same error because "h" was empty. In turn, it was empty because "modelMatch" expression was wrong (specifically there was no "\s" (space) in the end of the 'MODEL' lines in my PDB files.
Writing your own file is fine but it will not be general.
Also to speed up calculations one can use extractfeild, e.g.
X=extractfield(PDBStruct.Model.Atom,'X');
And the original pdbread file can be very useful this way.

类别

Help CenterFile Exchange 中查找有关 Partial Differential Equation Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by