Question: Secondary Structure Analysis With Dssp In R
gravatar for Pooja
6.2 years ago by
Pooja0 wrote:

Hi all,

I would like to run DSSP in R using Bio3D package. I tried the following code.But I got error. I am using windows os.

pdb <- read.pdb("1CRN")
x <- dssp(pdb, exepath="C:/dssp/dssp.exe")

Error in file(con, "r") : cannot open the connection
R secondary • 3.7k views
ADD COMMENTlink modified 3.8 years ago by Biostar ♦♦ 20 • written 6.2 years ago by Pooja0

what is the error that you got? a good idea is to google for the error messages, in the context of the library you're trying to use. most of the time you'll get an answer.

ADD REPLYlink written 6.2 years ago by dimkal730
gravatar for Neilfws
6.2 years ago by
Sydney, Australia
Neilfws48k wrote:

This error message means that R cannot open a file. The question is, which file?

In my case, running bio3d on Ubuntu, I saw the same error message plus something extra:

In addition: Warning message:
In file(con, "r") :
  cannot open file '/tmp/RtmphuZYHy/file1e5e7dbf452f': No such file or directory

Looking in /tmp/RtmphuZYHy there was indeed no such file, but there were other files with similar names which seemed to be derived from PDB files.

The mystery was solved by examining the code for the dssp() function, which you can do simply by typing "dssp". The first few lines:

function (pdb, exepath = "", resno = TRUE) 
    infile <- tempfile()
    outfile <- tempfile()
    write.pdb(pdb, file = infile)
    system(paste(exepath, "dssp -c ", infile, " ", outfile, sep = ""), 
        ignore.stderr = TRUE)

The version of DSSP on my machine does not have the "-c" switch (which used to mean "create output in pre-1995 format"). Trying to run it outside of R with that switch gives an error. I will bet that your version of DSSP has the same issue.

So in summary: the dssp() function calls DSSP incorrectly (with an obsolete switch), therefore no output file is written, hence the error message.

To fix this, you will have to edit the code for that function. I'd also suggest filing a bug report with the authors of bio3d, if there is not one already.

ADD COMMENTlink written 6.2 years ago by Neilfws48k
gravatar for Robert Ernst
6.2 years ago by
Robert Ernst60
Rotterdam, The Netherlands.
Robert Ernst60 wrote:

I don't know the package/software. But when i google on "bio3d dssp" I find this information:

  1. I think you have to set the path to the .exe, not the location of the .exe it self. So:

    x <- dssp(pdb, exepath="C:/dssp/")

  2. And secondly: "Call the dssp function with this directory as the exepath argument. The value of the exepath argument must end in / (on Linux/Unix/MacOS) or (on Microsoft Windows). Also note that every in an R string constant needs to be doubled, e.g. on Microsoft Windows you will probably need to write something like exepath="C:\path\to\file\" Source:

Good luck!

ADD COMMENTlink written 6.2 years ago by Robert Ernst60

You do not need to double-backslash when quoting file paths in R.

ADD REPLYlink written 6.2 years ago by Neilfws48k
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: 918 users visited in the last hour