来自以下文件:
Bio.PDB.Entity.get_full_id
def get_full_id(self):
"""Return the full id.
The full id is a tuple containing all id's starting from
the top object (Structure) down to the current object. A full id for
a Residue object e.g. is something like:
("1abc", 0, "A", (" ", 10, "A"))
This corresponds to:
Structure with id "1abc"
Model with id 0
Chain with id "A"
Residue with id (" ", 10, "A")
The Residue id indicates that the residue is not a hetero-residue
(or a water) because it has a blank hetero field, that its sequence
identifier is 10 and its insertion code "A".
"""
# The function implementation below here ...
我假设你是在链的原子上迭代,而不是在残基上迭代,这就得到了完整的结果
id
Atom
不
Residue
.
如果将示例残留物保存在名为
struct.pdb
然后运行下面的代码,得到正确的
s
>>> structure = PDBParser().get_structure('test', 'struct.pdb')
>>> for residue in structure.get_residues():
... print(residue.get_full_id())
('test', 0, 'A', (' ', 22, ' '))
('test', 0, 'A', (' ', 23, ' '))
>>> resseqs = [residue.id[1] for residue in structure.get_residues()]
>>> print(resseqs)
[22, 23]