[BioPython] PDBParser, problem with pdb files missing b factors and occupancies

Peter (BioPython) biopython at maubp.freeserve.co.uk
Wed May 17 19:40:37 UTC 2006


Saskia Villinger wrote:
> Hi!
> 
> I'd like to use the PDBParser for pdb files missing b factors and
> occupancies. When I write:
> 
> from Bio.PDB.PDBParser import PDBParser
> p=PDBParser(PERMISSIVE=1)
> s=p.get_structure("test", "test.pdb")
> 
> ... I get the following error:
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/python2.3/site-packages/Bio/PDB/PDBParser.py", line 65, in
> get_structure
>     self._parse(file.readlines())
>   File "/usr/lib/python2.3/site-packages/Bio/PDB/PDBParser.py", line 86, in
> _parse
>     self.trailer=self._parse_coordinates(coords_trailer)
>   File "/usr/lib/python2.3/site-packages/Bio/PDB/PDBParser.py", line 149, in
> _parse_coordinates
>     occupancy=float(line[54:60])
> ValueError: empty string for float()
> 
> 
> ... which is due to the missing occupancies and b factors. I'd like to know,
> if there is any option for the PDBParser, so that it gets possible to use
> these files? I could probably add random occupancies and b factors to the
> file, but I thought maybe there is a simpler solution?

It sounds like you are writing your own PDB files - in which case 
putting some default values in these fields is probably the best 
solution (e.g. one, or maybe zero, for the occupancy).

The python PDB parser author (Thomas Hamelryck) might have some feedback 
for you...

Peter




More information about the Biopython mailing list