<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Amitoj,<div><span class="Apple-tab-span" style="white-space:pre"> </span>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:</div><div><br></div><div>cmd <- paste (exepath, "chimera.exe", " ", tovmd, sep="")</div><div><br></div><div>which will result in the command string: "C:/Senior_Design/Chimera/bin/chimera.exe random_temp_file_name.pdb".</div><div><br></div><div>--Eric<br><br><div><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font: normal normal normal 16px/normal Helvetica; "> Eric Pettersen</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font: normal normal normal 16px/normal Helvetica; "> UCSF Computer Graphics Lab</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font: normal normal normal 16px/normal Helvetica; "> <a href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a></font></div><div><br></div></div></span></div><div><div>On May 28, 2010, at 3:05 PM, Amitoj Chopra wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Eric,<br><br>We got it to work with chimera. Here is our code.<br><br>chimera <- function(pdb, exepath = "C:/Senior_Design/Chimera/bin/")<br> {<br> tovmd <- tempfile()<br> write.pdb(pdb, file = tovmd)<br><br> cmd <- paste(exepath, "chimera.exe", sep="")<br> cat(cmd)<br><br> system(cmd)<br><br> unlink(tovmd)<br>}<br><br><br>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.<br> <br><div class="gmail_quote">On Thu, May 27, 2010 at 3:42 PM, Eric Pettersen <span dir="ltr"><<a href="mailto:pett@cgl.ucsf.edu">pett@cgl.ucsf.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex; position: static; z-index: auto; "> <div style="word-wrap: break-word;">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.<div> <br></div><font color="#888888"><div>--Eric</div></font><div><div></div><div class="h5"><div><br><div><div>On May 27, 2010, at 3:03 PM, Amitoj Chopra wrote:</div><br><blockquote type="cite"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div> Thank you Eric. Would something like this work.<br><br>C:\Program Files\Chimera\bin\chimera.exe<br><br>view.chimera<- function(pdb, exepath = "/Program Files(x86)/Chimera/bin/chimera.exe", ...) {<br> ## Change exepath to the location of your vmd<br> tovmd <- tempfile()<br> write.pdb(pdb, file = tovmd, ...)<br><br> cmd <- paste(exepath, "vmd -pdb ", tovmd, sep="")<br> cat(cmd)<br><br> os1 <- .Platform$OS.type<br> if (os1 == "windows") {<br> ## Insert cmd for calling vmd on windows<br> ## system(shQuote(cmd))<br> }<br> else {<br> system(cmd)<br> }<br> unlink(tovmd)<br>}<br><br>pdb <- read.pdb("4q21")<br>view.chimera(pdb)<br><br>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.<br> <br>Amitoj<br><br><div class="gmail_quote">On Thu, May 27, 2010 at 2:53 PM, Eric Pettersen<span> </span><span dir="ltr"><<a href="mailto:pett@cgl.ucsf.edu" target="_blank">pett@cgl.ucsf.edu</a>></span><span> </span>wrote:<br> <blockquote class="gmail_quote" style="margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex; position: static; z-index: auto; "><div style="word-wrap: break-word;"><div><div><div>On May 27, 2010, at 12:27 AM, Amitoj Chopra wrote:</div> <br><blockquote type="cite">Is there any way to use the R script and bio3d package to open a pdb with Chimera using R? Thank you.</blockquote><br></div></div><div>Hi Amitoj,</div><div><span style="white-space: pre;"> </span>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:</div> <div><br></div><div><a href="http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/startup.html" target="_blank">http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/startup.html</a></div><div><br></div><div><span style="white-space: pre;"> </span>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.</div> <div><br></div><div>--Eric</div><br><div><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;"> <div style="margin: 0px;"><font face="Helvetica" size="5"><span> <span> </span></span>Eric Pettersen</font></div><div style="margin: 0px;"><font face="Helvetica" size="5"><span> <span> </span></span>UCSF Computer Graphics Lab</font></div> <div style="margin: 0px;"><font face="Helvetica" size="5"><span> </span><a href="http://www.cgl.ucsf.edu" target="_blank">http://www.cgl.ucsf.edu</a></font></div><br></div></span></div><br></div></blockquote> </div><br><div style="padding: 0px; margin-left: 0px; margin-top: 0px; width: 240px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 13px; display: inline;"></div></div> </span><br></blockquote></div><br></div></div></div></div></blockquote></div><br></blockquote></div><br></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="font-size: medium;"><br class="Apple-interchange-newline"></span></div></span> </div><br></body></html>