[Biopython-dev] Bug: Bio.PDB.DSSP fails on PDB files with no header

Peter Cock p.j.a.cock at googlemail.com
Tue Apr 23 08:14:23 UTC 2013


On Tue, Apr 23, 2013 at 9:09 AM, Jan Kosinski <jan.kosinski at gmail.com> wrote:
> The following script:
>
> import sys
> import Bio
> from Bio.PDB.DSSP import DSSP
> from Bio.PDB.PDBParser import PDBParser
>
> pdb_filename = sys.argv[1]
> p = PDBParser()
> structure = p.get_structure('chupacabra', pdb_filename)
> model = structure[0]
>
> biodssp = DSSP(model, pdb_filename, dssp="dssp")
>
> will fail on files without HEADER with traceback:
> Traceback (most recent call last):
>   File "testdssp_fail.py", line 13, in <module>
>     biodssp = DSSP(model, pdb_filename, dssp="dssp")
>   File
> "/home/modorama_dev/modorama/ENV_INI/lib/python2.7/site-packages/Bio/PDB/DSSP.py",
> line 200, in __init__
>     dssp_dict, dssp_keys = dssp_dict_from_pdb_file(pdb_file, dssp)
>   File
> "/home/modorama_dev/modorama/ENV_INI/lib/python2.7/site-packages/Bio/PDB/DSSP.py",
> line 101, in dssp_dict_from_pdb_file
>     out_dict, keys = make_dssp_dict(out_file.name)
>   File
> "/home/modorama_dev/modorama/ENV_INI/lib/python2.7/site-packages/Bio/PDB/DSSP.py",
> line 121, in make_dssp_dict
>     if sl[1] == "RESIDUE":
> IndexError: list index out of range
>
> This is because in newer dssp versions the header of DSSP output will have
> empty lines if the PDB file had no HEADER and this part of make_dssp_dict
> function will fail
>         for l in handle.readlines():
>             sl = l.split()
>             if sl[1] == "RESIDUE:
>
> Changing it to sth like:
> if len(sl) > 1 and sl[1] == "RESIDUE":
> fixes the problem.
>
> Cheers,
> Jan

Hi Jan,

Do you have any (small) sample output we could use for a test case
to include with Biopython?

Do you know which versions of DSSP are affected?

Thanks,

Peter



More information about the Biopython-dev mailing list