2015-09-05 31 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

希望這有助於。

相關問題