Question: Error: Parsing Pdb File With Biopython
gravatar for Mkl
8.4 years ago by
Mkl100 wrote:

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
structure=parser.get_structure("test", "1fat.pdb")

File "<pyshell#48>", line 1, in <module>
residue = chain[(' ', 1, ' ')]
File "C:\Python27\lib\site-packages\Bio\PDB\", line 67, in __getitem__
return Entity.__getitem__(self, id)
File "C:\Python27\lib\site-packages\Bio\PDB\", line 38, in __getitem__
return self.child_dict[id]
KeyError: (' ', 1, ' ')
pdb biopython parsing • 5.1k views
ADD COMMENTlink written 8.4 years ago by Mkl100

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).

ADD REPLYlink written 8.4 years ago by Peter5.8k

Just checked the code myself, Works perfectly fine, I also get the discontinuous chain error

ADD REPLYlink written 8.4 years ago by Harpalss310

@peter Iam using biopython 1.57

ADD REPLYlink written 8.4 years ago by Mkl100

Can you update your Biopython, the current release is 1.58

ADD REPLYlink written 8.4 years ago by Peter5.8k
gravatar for Aurobhima
8.1 years ago by
University of Birmingham
Aurobhima100 wrote:

you need to make sure that the residue you are trying to get is actually labelled 1.. what I do when I want something from a PDB structure is:

from Bio import PDB
parser= PDBParser()
structure=parser.get_structure("test", "1fat.pdb")
chain = model['A']

residue_list = Selection.unfold_entities(chain, 'R')

Now you have the complete list of residues within the chain you specified.

you can then specify that you want the first residue in the list:

 my_residue= residue_list[0]

NOTE: It is not uncommon that during the crystallisation process the N and C terminals of the structure have been cleaved. The residue numbering will be consistent with the residue numbering you see in the PDB file.. to check which residues you have try:

to make sure it has the number you want..

ADD COMMENTlink written 8.1 years ago by Aurobhima100

I get this error "NameError: name 'Selection' is not defined"

ADD REPLYlink written 3.0 years ago by underoath0060

I'm unfamiliar with Biopython PDB, but my first guess would be to try the following:

residue_list = PDB.Selection.unfold_entities(chain, 'R')
ADD REPLYlink written 3.0 years ago by WouterDeCoster43k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2269 users visited in the last hour