This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error: Dssp With Biopython

Hello,

I am trying to run DSSP with Biopython. I have installed biopython 1.59 with python 2.7.2 in windows OS.

>>> from Bio.PDB.PDBParser import PDBParser
>>> pdbfn ='C://pdb//1B68.pdb'
>>> parser = PDBParser(PERMISSIVE=1)
>>> structure = parser.get_structure("1B68", pdbfn)
>>> model=structure[0]
>>>from Bio.PDB.DSSP import DSSP
>>>dssp = DSSP(model, "1B68.pdb")

Traceback (most recent call last):
 File "<pyshell#10>", line 1, in <module>
dssp = DSSP(model, "1B68.pdb")
File "C:\Python27\lib\site-packages\Bio\PDB\DSSP.py", line 200, in __init_
dssp_dict, dssp_keys = dssp_dict_from_pdb_file(pdb_file, dssp)
File "C:\Python27\lib\site-packages\Bio\PDB\DSSP.py", line 101, in dssp_dict_from_pdb_file
out_dict, keys = make_dssp_dictout_file.name)
File "C:\Python27\lib\site-packages\Bio\PDB\DSSP.py", line 115, in make_dssp_dict
handle = open(filename, "r")
IOError: [Errno 13] Permission denied: 'c:\\users\\veena\\appdata\\local\\temp\\tmparkljc.dssp'
biopython

It seems like you do not have permissions for file. May be execute permissions. See here

It seems like you do not have permissions for file. May be execute permissions. Have a look heremail-archive.com/gmx-users@gromacs.org/…

It seems like you do not have permissions for file. May be execute permissions. See heremail-archive.com/gmx-users@gromacs.org/…

It seems like you do not have permissions for file. May be execute permissions. See here

It seems like you do not have permissions for file. May be execute permissions. See here

2 answers

Your error comes from the os.system call in the function dssp_dict_from_pdb_file in DSSP.py:

def dssp_dict_from_pdb_file(in_file, DSSP="dssp"):
    """
    Create a DSSP dictionary from a PDB file.

    Example:
        >>> dssp_dict=dssp_dict_from_pdb_file("1fat.pdb")
        >>> aa, ss, acc=dssp_dict[('A', 1)]

    @param in_file: pdb file
    @type in_file: string

    @param DSSP: DSSP executable (argument to os.system)
    @type DSSP: string

    @return: a dictionary that maps (chainid, resid) to 
        amino acid type, secondary structure code and 
        accessibility.
    @rtype: {}
    """
    out_file = tempfile.NamedTemporaryFile(suffix='.dssp')
    out_file.flush()    # needed?
    os.system("%s %s > %s" % (DSSP, in_file, out_file.name))
    out_dict, keys = make_dssp_dictout_file.name)
    out_file.close()
    return out_dict, keys

So the code calls the DSSP executable to create a DSSP dictionary from a PDB file. You either don't have a working version of DSSP (and a license, free for academic use) on your system. Or your DSSP executable hasn't sufficient permissions.

Get DSSP from http://www.cmbi.kun.nl/gv/dssp/

Thank you very much for your answer. I have installed DSSP with this link. ftp://ftp.cmbi.ru.nl/pub/software/dssp/ . I am getting output when I use windows command prompt. I used the following command to run DSSP . dssp file.pdb dssp file.dssp

So did that confirm the problem is with your DSSP installation?

I downloaded an .exe. I'm confused as to how to install it. Could you please explain how to install dssp?

Doing dssp_dict_from_pdb_file(in_file) is equivalent to dssp_dict_from_pdb_file(in_file, DSSP="dssp") and assumes dssp (or deep.exe under Windows) is on the system $PATH, meaning at the command line you can just type dssp to run it.

One option is to ensure that the folder containing dssp.exe in on your $PATH environment variable (and then restart your shell and Python).

Or, tell Biopython where the binary is, e.g.

dssp_exe = r'C:\MyStuff\tools\dssp.exe'
dssp_dict_from_pdb_file(in_file, DSSP=dssp_exe)

I'm using r'...' for a raw string where things like \t do not get turned into tabs. You could instead us \\t there.

If you have spaces in the folder name you might need to quote this, using r-singlequote-doublequote-path-doublequote-singlequote

dssp_exe = r'"C:\My Stuff\tools for bioinf\dssp.exe"'
dssp_dict_from_pdb_file(in_file, DSSP=dssp_exe)

(I don't have easy access to a Windows machine to test this right now)

Log in to answer this question.