<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi Christos,</div><div><br></div><div> Now I think your problem is the line</div><div><br></div><div> script_file.close</div><div><br></div><div>You need</div><div><br></div><div> script_file.close()</div><div><br></div><div>with parentheses since close is a function. Without that the command file you wrote is not closed before running chimera, and probably the file will not be written until closed because of buffering.</div><div><br></div><div> The spaces in the --nogui option is not a Chimera bug. When you use subprocess.call() the arguments </div><div><br>On Feb 17, 2015, at 6:44 AM, Christos Deligkaris <<a href="mailto:deligkaris@gmail.com">deligkaris@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Thank you Tom. If I take out the spaces, those error messages disappear. It seems that that was a chimera issue. <div><br></div><div>However, the chimera .com script is still not being executed with the subprocess.call command. I am not sure now whether this is a chimera issue or a python issue....</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div><div><div>Christos Deligkaris, PhD<br></div>Assistant Professor of Physics, Drury University<br></div>900 N Benton Ave, Springfield MO, 65802<br></div>Office Phone: (417) 873-7234<br><a href="http://www2.drury.edu/christos/index.html" target="_blank">www2.drury.edu/christos</a> <a href="https://twitter.com/DeligkarisGroup" target="_blank">@DeligkarisGroup</a> <a href="http://google.com/+ChristosDeligkaris" target="_blank">+ChristosDeligkaris</a><br><br><br></div></div></div></div>
<br><div class="gmail_quote">On Mon, Feb 16, 2015 at 11:02 PM, Tom Goddard <span dir="ltr"><<a href="mailto:goddard@sonic.net" target="_blank">goddard@sonic.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Christos,<div><br></div><div> I think your error is because the “—nogui” option in your subprocess.call() has spaces before and after inside the quote marks. Take those spaces out and I bet it will work. The error seems to be trying to create the Chimera splash screen which would not happen in nogui mode.</div><div><br></div><div><span style="white-space:pre-wrap"> </span>Tom</div><div><br></div><div><br><div><blockquote type="cite"><div><div class="h5"><div>On Feb 16, 2015, at 8:30 PM, Christos Deligkaris wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">Dear all,<div><br></div><div>I have a python script that creates a .com command script for chimera and then attempts to run the chimera script. Here is the python script:</div><div><br></div><div>**************</div><div><br></div><div><div>#!/usr/bin/env python</div><div>import re,os,sys,math, decimal, subprocess</div><div>from copy import deepcopy</div><div>from openeye.oechem import *</div><div>from decimal import *</div><div><br></div><div>script_file=open("chimera_script_for_" + "ligand" +".com", 'w')</div><div>script_file.write("open "+ "127D" +"\n")</div><div>script_file.write("open " + "127D" +"\n")</div><div>script_file.write("open "+ "ligand.pdb" +"\n")</div><div>script_file.write("match #0:"+ "6" + " " + "#1:"+ "18" +"\n")</div><div>script_file.write("write format pdb 2 "+ "flipped_" + "ligand" + "\n")</div><div>script_file.write("stop")</div><div>script_file.close</div><div>print <a href="http://script_file.name/" target="_blank">script_file.name</a></div><div>chimera=subprocess.call(["chimera", " --nogui ", "<a href="http://chimera_script_for_ligand.com/" target="_blank">chimera_script_for_ligand.com</a>"]) </div><div>print chimera<br></div><div>#delete the script, leaving just the flipped ligand</div><div>#os.remove(<a href="http://script_file.name/" target="_blank">script_file.name</a>)</div></div><div><br></div><div>*******************</div><div><br></div><div>When I run the script, it successfully generates the .com chimera script. However, I get the following error message:</div><div><br></div><div>*******************</div><div><br></div><div><div>[christos@biophysics Desktop]$ ./script.py </div><div><a href="http://chimera_script_for_ligand.com/" target="_blank">chimera_script_for_ligand.com</a></div><div>Traceback (most recent call last):</div><div> File "/share/apps/PROGRAMS/CHIMERA/CHIMERA-1.9/share/__main__.py", line 69, in <module></div><div> value = chimeraInit.init(sys.argv)</div><div> File "/share/apps/PROGRAMS/CHIMERA/CHIMERA-1.9/share/chimeraInit.py", line 638, in init</div><div> splash.create()</div><div> File "/share/apps/PROGRAMS/CHIMERA/CHIMERA-1.9/share/chimera/splash.py", line 25, in create</div><div> sync=chimera.debug)</div><div> File "/share/apps/PROGRAMS/CHIMERA/CHIMERA-1.9/lib/python2.7/lib-tk/Tkinter.py", line 1747, in __init__</div><div> <a href="http://self.tk/" target="_blank">self.tk</a> = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)</div><div>_tkinter.TclError: no display name and no $DISPLAY environment variable</div><div>1</div></div><div><br></div><div>**********************</div><div><br></div><div>The python script successfully creates the .com script:</div><div><br></div><div>******************************</div><div><br></div><div><div>[christos@biophysics Desktop]$ more <a href="http://chimera_script_for_ligand.com/" target="_blank">chimera_script_for_ligand.com</a></div><div>open 127D</div><div>open 127D</div><div>open ligand.pdb</div><div>match #0:6 #1:18</div><div>write format pdb 2 flipped_ligand</div><div>stop</div></div><div><br></div><div>***************************</div><div><br></div><div>and if I manually execute this chimera script, everything works out well:</div><div><br></div><div>**************************</div><div><br></div><div><div>[christos@biophysics Desktop]$ chimera --nogui <a href="http://chimera_script_for_ligand.com/" target="_blank">chimera_script_for_ligand.com</a></div><div>Fetching 127D from web site <a href="http://www.rcsb.org/" target="_blank">www.rcsb.org</a></div><div>0 Kbytes received</div><div>Fetch 127D: finished</div><div>Done fetching 127D; verifying...</div><div>Opening 127D...</div><div>#0, chain A: dna (5'-D(*cp*gp*cp*gp*ap*ap*tp*tp*cp*gp*cp*G)- 3')</div><div><br></div><div>#0, chain B: dna (5'-D(*cp*gp*cp*gp*ap*ap*tp*tp*cp*gp*cp*G)- 3')</div><div><br></div><div>Opening VRML model in 127D - Nucleotides...</div><div>127D opened</div><div>Opened VRML model in 127D - Nucleotides</div><div>Opened 127D containing 1 model, 639 atoms, and 146 residues</div><div>Fetching 127D from web site <a href="http://www.rcsb.org/" target="_blank">www.rcsb.org</a></div><div>88 Kbytes received</div><div>80 Kbytes received</div><div>Fetch 127D: finished</div><div>Done fetching 127D; verifying...</div><div>Opening 127D...</div><div>#1, chain A: dna (5'-D(*cp*gp*cp*gp*ap*ap*tp*tp*cp*gp*cp*G)- 3')</div><div><br></div><div>#1, chain B: dna (5'-D(*cp*gp*cp*gp*ap*ap*tp*tp*cp*gp*cp*G)- 3')</div><div><br></div><div>Opening VRML model in 127D - Nucleotides...</div><div>127D opened</div><div>Opened VRML model in 127D - Nucleotides</div><div>Opened 127D containing 1 model, 639 atoms, and 146 residues</div><div>Opening ligand.pdb...</div><div>ligand.pdb opened</div><div>Opened ligand.pdb containing 1 model, 32 atoms, and 1 residues</div><div>Executing match ['#0:6', '#1:18'], no iteration</div><div><br></div><div>RMSD between 21 atom pairs is 0.630 angstroms</div><div>Wrote flipped_ligand into /home/christos/Desktop</div></div><div><br></div><div>*****************************</div><div><br></div><div>Why do I get the error message when I attempt to run chimera through script.py? Is this a python issue or a chimera issue? I appreciate any thoughts on solving this problem....thank you,</div><div><br></div><div><div><div><div dir="ltr"><div><div><div><div>Christos Deligkaris, PhD<br></div>Assistant Professor of Physics, Drury University<br></div>900 N Benton Ave, Springfield MO, 65802<br></div><span>Office Phone: <span title="Call with Google Voice"><a href="tel:%28417%29%20873-7234" value="+14178737234" target="_blank">(417) 873-7234</a></span></span><br><a href="http://www2.drury.edu/christos/index.html" target="_blank">www2.drury.edu/christos</a> <a href="https://twitter.com/DeligkarisGroup" target="_blank">@DeligkarisGroup</a> <a href="http://google.com/+ChristosDeligkaris" target="_blank">+ChristosDeligkaris</a><br><br><br></div></div></div></div>
</div></div>
</div><br></div></div></div>
_______________________________________________<br>Chimera-users mailing list<br><a href="mailto:Chimera-users@cgl.ucsf.edu" target="_blank">Chimera-users@cgl.ucsf.edu</a><br><a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" target="_blank">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Chimera-users mailing list</span><br><span><a href="mailto:Chimera-users@cgl.ucsf.edu">Chimera-users@cgl.ucsf.edu</a></span><br><span><a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a></span><br></div></blockquote></body></html>