【问题标题】:Replace residue numbers in pdb with given residue numbers list用给定的残基数列表替换 pdb 中的残基数
【发布时间】:2017-06-16 16:22:48
【问题描述】:

我已将残留编号列表重新编号为 new_residues=[18,19,20,21,22,34,35,36,37.... 130,131,132] 并且我想使用此列表更改我的 pdb 残留编号。你有重新编号的想法吗?

...

w=PDBIO()
            structure=p.get_structure(" ", pdbfile)
            for model in structure:
                    for chain in model:
                            chain_ID=model[chainID]
                            for residue in chain_ID:
                            #for i in range(len(residue.id)):
                                            #resID=new_resnums[i]
                                    residue.id=(" ",new_resnums[residue.id[1]], " ")
            w.set_structure(structure)
            w.save(pdbfile + "-new.pdb")

【问题讨论】:

    标签: python biopython pdb pdb-files


    【解决方案1】:

    在您的示例中,您将覆盖有关残基的所有信息,以及有关特定位置氨基酸的信息。

    让我们将文件中的所有 id 增加 200,循环遍历 models 和 structures,然后将 get_residues()enumerate 结合使用以获取所有残基和索引。

    residual.id 存储在list 中,仅更改了 id。然后这个 list 被转换回 tuple 并代替原来的 id 写入。

    from Bio import PDB
    
    pdb_io = PDB.PDBIO()
    pdb_parser = PDB.PDBParser()
    pdbfile = '1ubq.pdb'
    structure = pdb_parser.get_structure(" ", pdbfile)
    
    new_resnums = [i + 200 for i in range(135)]
    
    for model in structure:
        for chain in model:
            for i, residue in enumerate(chain.get_residues()):
                res_id = list(residue.id)
                res_id[1] = new_resnums[i]
                residue.id = tuple(res_id)
    
    pdb_io.set_structure(structure)
    pdb_io.save(pdbfile + "-new.pdb")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-08
      • 2018-11-14
      相关资源
      最近更新 更多