【问题标题】:MATLAB reading specific fields of a pdb fileMATLAB 读取 pdb 文件的特定字段
【发布时间】:2016-05-24 04:18:28
【问题描述】:

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

【问题讨论】:

    标签: matlab coordinates


    【解决方案1】:

    我对@9​​87654325@ 文件的了解是我今天在http://www.wwpdb.org/index 和这里(http://www.wwpdb.org/documentation/file-format-content/format33/v3.3.html) 所读到的。

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

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

    更准确地说(glfpdbread 函数读取的结构的名称):

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

    如果是这样,为了识别Alcaline 的原子“CA”,您可以使用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]
    

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2011-01-03
      • 2016-02-24
      • 2020-03-11
      • 2021-02-04
      • 2012-04-16
      • 1970-01-01
      • 2019-08-17
      • 2018-02-05
      相关资源
      最近更新 更多