用给定的残基编号列表替换 pdb 中的残基编号

戈克图尔克

我已将残基编号列表重新编号为 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")
马克西米利安·彼得斯

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

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

残留物listid存储在 a 中,只有 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")

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章