0

In this tutorial, there is a command pymol.dccm(cij, pdb, type="launch"). But I was told

> pymol.dccm(cij, pdb, type="launch")
Error in pymol.dccm(cij, pdb, type = "launch") : 
  Launching external program failed
  make sure 'C:/python27/PyMOL/pymol.exe' is in your search path
In addition: Warning message:
running command 'C:/python27/PyMOL/pymol.exe -cq' had status 127

I already have pymol installed on my PC. Can I ask how to add another search path to R?

Now I think pymol is a sub-package in bio3d. But I already installed bio3d and other commands can work (e.g. pdb <- read.pdb()). But why the pymol command could not work?


I tried

> .libPaths("path/to/pymol2/")

> .libPaths("path/to/pymol2/PyMOL")

> .libPaths("path/to/pymol2/PyMOL/PyMOLWin.exe")

> pymol.dccm(cij, pdb, type="launch")
Error in pymol.dccm(cij, pdb, type = "launch") : 
  Launching external program failed
  make sure 'C:/python27/PyMOL/pymol.exe' is in your search path
In addition: Warning message:
running command 'C:/python27/PyMOL/pymol.exe -cq' had status 127 

> PyMOLWin.dccm(cij, pdb, type="launch")
Error: could not find function "PyMOLWin.dccm"

So the .libPaths did not return error. But pymol.dccm and PyMOLWin.dccm did not work.


I also tried to install pymol package in R

> install.packages("pymol")
Warning in install.packages :
  package ‘pymol’ is not available (for R version 3.2.2)
lanselibai
  • 1,203
  • 2
  • 19
  • 35
  • 2
    `.libPaths` only influences where R looks for packages, not where it looks for executables. You'll want to set the PATH system variable. See this question for how to do that: https://stackoverflow.com/questions/24622725/how-to-set-path-on-windows-through-r-shell-command – MrFlick Mar 15 '18 at 16:52
  • I have `PyMOLWin.exe` executable, but where is the `pymol` package? – lanselibai Mar 15 '18 at 17:05

3 Answers3

0

There's a mistake in the tutorial command itself. The correct syntax for dccm is

pymol(cij, pdb, type="launch",exefile="C:/Program Files/pymol")

where exefile = file path to the ‘PYMOL’ program on your system (i.e. how is ‘PYMOL’ invoked). If NULL, use OS-dependent default path to the program.

David Buck
  • 3,752
  • 35
  • 31
  • 35
0

Try the following code, it worked perfectly for me:

pymol(cm, pdb.open, type="launch", exefile="%userprofile%/PyMOL/PyMOLWin.exe")
Omkar T
  • 755
  • 8
  • 19
-1

.libPaths("path/to/package/library") probably does what you need.

.libPaths gets/sets the library trees within which packages are looked for.

Set the path to the parent directory of the directory with the package name rather than the package directory itself.

Jordi
  • 1,313
  • 8
  • 13
  • I tried, but is there a specific `pymol` that `R` can recognise? Please see the updated question. – lanselibai Mar 15 '18 at 16:44
  • Did you try setting the path to the parent directory of that package folder you are trying to refer to? – Jordi Mar 15 '18 at 16:46
  • The essential part is just about how to set the path in R. That is why I only use link to refer. – lanselibai Mar 15 '18 at 16:55
  • Jordi, could you please tell me what is the exact path, "path/to/pymol2/", or "path/to/pymol2/PyMOL"? As @MrFlick mentioned, is there a difference between package and executable? – lanselibai Mar 15 '18 at 17:02
  • @lanselibai, if it is like any R package, you should find a DESCRIPTION file somewhere. This is the package directory. Set the path to the parent of that package directory. – Jordi Mar 15 '18 at 17:10