[BioPython] parsing pdb files

Peter biopython at maubp.freeserve.co.uk
Mon Feb 9 16:34:22 UTC 2009


On Mon, Feb 9, 2009 at 3:48 PM, Bala subramanian
<bala.biophysics at gmail.com> wrote:
> Dear Friends,
>
> I have a pdb file generated by a simulation program. it dosent have the
> B-factor information. When use PDBParser, i get the following error. I got
> to know by googling that this is due to the absence of b-factor information
> in the pdb file. Kindly write me how to parser such pdb files.
>
>  File "arrow.py", line 7, in <module>
>    structure=par.get_structure('test','1.pdb')
>  File "/usr/lib/python2.5/site-packages/Bio/PDB/PDBParser.py", line 65, in
> get_structure
>    self._parse(file.readlines())
>  File "/usr/lib/python2.5/site-packages/Bio/PDB/PDBParser.py", line 85, in
> _parse
>    self.trailer=self._parse_coordinates(coords_trailer)
>  File "/usr/lib/python2.5/site-packages/Bio/PDB/PDBParser.py", line 158, in
> _parse_coordinates
>    occupancy=float(line[54:60])
> ValueError: empty string for float()
>
> Thanks in advance,
> Bala

I'm note sure off hand if the occupancy is intended to be mandatory or
not.  If it should be present, it would be nice if Bio.PDB could parse
this in permissive mode, and reject the file in strict mode.

Note this issue sounds very similar to missing tempFactor fields,
Biopython Bug 2751:
http://bugzilla.open-bio.org/show_bug.cgi?id=2751

Alternatively, can you ask the simulation program authors to record an
occupancy of one?

Peter




More information about the Biopython mailing list