[Chimera-users] a simple question (starting Chimera from R)

Eric Pettersen pett at cgl.ucsf.edu
Tue Jun 1 17:21:37 PDT 2010


Hi Amitoj,
	I think the problem is that you write the PDB file but never tell  
Chimera about it -- i.e. you need to add it to the command that starts  
Chimera.  So change your cmd<-paste to:

cmd <- paste (exepath, "chimera.exe", " ", tovmd, sep="")

which will result in the command string: "C:/Senior_Design/Chimera/bin/ 
chimera.exe random_temp_file_name.pdb".

--Eric

                         Eric Pettersen
                         UCSF Computer Graphics Lab
                         http://www.cgl.ucsf.edu

On May 28, 2010, at 3:05 PM, Amitoj Chopra wrote:

> Eric,
>
> We got it to work with chimera. Here is our code.
>
> chimera <- function(pdb, exepath = "C:/Senior_Design/Chimera/bin/")
>  {
>  tovmd <- tempfile()
>  write.pdb(pdb, file = tovmd)
>
>  cmd <- paste(exepath, "chimera.exe", sep="")
>  cat(cmd)
>
>  system(cmd)
>
>  unlink(tovmd)
> }
>
>
> The only problem is that it opens up chimera but doesnt show the PDB  
> we are trying to view, for this case, 1ly2. Do you know somewhere we  
> went wrong. pdb should be 1ly2. Thanks.
>
> On Thu, May 27, 2010 at 3:42 PM, Eric Pettersen <pett at cgl.ucsf.edu>  
> wrote:
> I am in no way an R expert (or even an R newbie), but given what R  
> documentation I've looked at I see two problems with the below.  One  
> is that you are on Windows, and the code for Windows is commented  
> out (the "system" call after "if (os1 == "windows")")  The other  
> problem is that you left "vmd -pdb" in the paste() call, so the  
> command it will try to execute is "/Program Files(x86)/Chimera/bin/ 
> chimera.exevmd -pdb <pdb-file-name-here>" which obviously won't  
> work.  Changing "vmd -pdb " to just " " will fix that I think.
>
> --Eric
>
> On May 27, 2010, at 3:03 PM, Amitoj Chopra wrote:
>
>> Thank you Eric. Would something like this work.
>>
>> C:\Program Files\Chimera\bin\chimera.exe
>>
>> view.chimera<- function(pdb, exepath = "/Program Files(x86)/Chimera/ 
>> bin/chimera.exe", ...) {
>>  ## Change exepath to the location of your vmd
>>  tovmd <- tempfile()
>>  write.pdb(pdb, file = tovmd, ...)
>>
>>  cmd <- paste(exepath, "vmd -pdb ", tovmd, sep="")
>>  cat(cmd)
>>
>>  os1 <- .Platform$OS.type
>>  if (os1 == "windows") {
>>    ## Insert cmd for calling vmd on windows
>>    ## system(shQuote(cmd))
>>  }
>>  else {
>>    system(cmd)
>>  }
>>  unlink(tovmd)
>> }
>>
>> pdb <- read.pdb("4q21")
>> view.chimera(pdb)
>>
>> It doesnt seem to be able to run. I am thinking of what to put in  
>> the "window" because that is what goes to the cmd line. Thanks.
>>
>> Amitoj
>>
>> On Thu, May 27, 2010 at 2:53 PM, Eric Pettersen <pett at cgl.ucsf.edu>  
>> wrote:
>> On May 27, 2010, at 12:27 AM, Amitoj Chopra wrote:
>>
>>> Is there any way to use the R script and bio3d package to open a  
>>> pdb with Chimera using R? Thank you.
>>
>> Hi Amitoj,
>> 	If R can run external system commands then this is possible.  Use  
>> bio3d to write a PDB file and then use R to start Chimera from the  
>> command line with the PDB file name as an argument, as documented  
>> here:
>>
>> http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/startup.html
>>
>> 	If you don't know how to run external commands from R, you would  
>> probably have to ask about that on the R mailing list.
>>
>> --Eric
>>
>>                         Eric Pettersen
>>                         UCSF Computer Graphics Lab
>>                         http://www.cgl.ucsf.edu
>>
>>
>>
>>
>
>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20100601/5c21372d/attachment.html>


More information about the Chimera-users mailing list