2015-09-05 137 views
1

我必须在MATLAB中进行编码。我的问题是我想提取某些原子的坐标,仅对应于PDB文件中的某些残基。例如,我想提取PDB文件中存在的所有丙氨酸的CA原子的坐标。我尝试使用find(strcmp(atoms,'CA')),但它给我所有的CA原子,而不是CA的丙氨酸。如何在MATLAB中解决这个问题?请帮助。谢谢。MATLAB读取一个pdb文件的特定字段

回答

3

我所知道的关于PDB的文件是我今天在http://www.wwpdb.org/index和这里(http://www.wwpdb.org/documentation/file-format-content/format33/v3.3.html)读到的。

我已经使用MatLab提供的示例帮助阅读PDB文件。

根据从PDB文件读取的数据结构和文件格式的描述,在我看来,您要查找的数据包含在Model.Atom字段中。

更确切地说(glf是结构由pdbread函数读取的名称):

gfl.Model.Atom(:).AtomName 
gfl.Model.Atom(:).resName 
gfl.Model.Atom(:).X 
gfl.Model.Atom(:).Y 
gfl.Model.Atom(:).Z 

如果是这样,为了识别原子“CA”的Alcaline您可以使用findstrcmp组合功能如下:

pos=find(strcmp({gfl.Model.Atom(:).AtomName},'CA') & ... 
    strcmp({gfl.Model.Atom(:).resName},'ALA')) 

输出数组pos包含你正在寻找的原子的索引。

要提取的坐标,那么你可以使用该指标如下:

X=[gfl.Model.Atom(pos).X] 
Y=[gfl.Model.Atom(pos).Y] 
Z=[gfl.Model.Atom(pos).Z] 

您可以通过定义“凌动名”和残渣名作为参数,使更多“一般”的代码。

在以下内容中,您可以根据MatLab提供的示例文件找到完整的脚本。

% Generate a PDB file (example from MatLab help) 
gfl = getpdb('1GFL','TOFILE','1gfl.pdb') 
% Read the PDB file 
gfl = pdbread('1gfl.pdb') 


% Define the Atom Name 
atom_name='CA'; 
% Define the Residue Name 
res_name='ALA'; 
% Search for the couple "Atom name - Residue Name" 
pos=find(strcmp({gfl.Model.Atom(:).AtomName},atom_name) & ... 
    strcmp({gfl.Model.Atom(:).resName},res_name)) 

% Extract the coordinates of the Atoms matching the search criteria 
X=[gfl.Model.Atom(pos).X] 
Y=[gfl.Model.Atom(pos).Y] 
Z=[gfl.Model.Atom(pos).Z] 

enter image description here

希望这有助于。

相关问题