I am trying to parse a PDB file and also trying to extract some Model, Chain, Residue and Atom objects with Biopython. I tried the following code
from Bio.PDB.PDBParser import PDBParser
parser=PDBParser()
structure=parser.get_structure("test", "1fat.pdb")
model=structure[0]
chain=model["A"]
residue=chain[1]
File "<pyshell#48>", line 1, in <module>
residue = chain[(' ', 1, ' ')]
File "C:\Python27\lib\site-packages\Bio\PDB\Chain.py", line 67, in __getitem__
return Entity.__getitem__(self, id)
File "C:\Python27\lib\site-packages\Bio\PDB\Entity.py", line 38, in __getitem__
return self.child_dict[id]
KeyError: (' ', 1, ' ')
Is that the complete code? Which version of Biopython are you using? It works for me although I do see eight warnings about discontinuous chains (a problem in the data itself).
Just checked the code myself, Works perfectly fine, I also get the discontinuous chain error
@peter Iam using biopython 1.57
Can you update your Biopython, the current release is 1.58