[Chimera-users] Fwd: Problem running chimera through a command script

Tom Goddard goddard at sonic.net
Tue Feb 17 08:32:35 PST 2015


Finishing the previous email..

the subprocess.call() arguments need to have leading and trailing whitespace removed or it is unlikely to work when calling any shell command.  Only if the shell command argument is a general text string that permits leading whitespace would work.

  Tom


> On Feb 17, 2015, at 6:44 AM, Christos Deligkaris <deligkaris at gmail.com> wrote:
> 
> Thank you Tom. If I take out the spaces, those error messages disappear. It seems that that was a chimera issue. 
> 
> 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....
> 
> Christos Deligkaris, PhD
> Assistant Professor of Physics, Drury University
> 900 N Benton Ave, Springfield MO, 65802
> Office Phone: (417) 873-7234
> www2.drury.edu/christos @DeligkarisGroup +ChristosDeligkaris
> 
> 
> 
>> On Mon, Feb 16, 2015 at 11:02 PM, Tom Goddard <goddard at sonic.net> wrote:
>> Hi Christos,
>> 
>>   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.
>> 
>> 	Tom
>> 
>> 
>>> On Feb 16, 2015, at 8:30 PM, Christos Deligkaris wrote:
>>> 
>>> Dear all,
>>> 
>>> 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:
>>> 
>>> **************
>>> 
>>> #!/usr/bin/env python
>>> import re,os,sys,math, decimal, subprocess
>>> from copy import deepcopy
>>> from openeye.oechem import *
>>> from decimal import *
>>> 
>>> script_file=open("chimera_script_for_" + "ligand" +".com", 'w')
>>> script_file.write("open "+ "127D" +"\n")
>>> script_file.write("open " + "127D" +"\n")
>>> script_file.write("open "+ "ligand.pdb" +"\n")
>>> script_file.write("match #0:"+ "6" + " " + "#1:"+ "18" +"\n")
>>> script_file.write("write format pdb 2 "+ "flipped_" + "ligand" + "\n")
>>> script_file.write("stop")
>>> script_file.close
>>> print script_file.name
>>> chimera=subprocess.call(["chimera", " --nogui ", "chimera_script_for_ligand.com"])       
>>> print chimera
>>> #delete the script, leaving just the flipped ligand
>>> #os.remove(script_file.name)
>>> 
>>> *******************
>>> 
>>> When I run the script, it successfully generates the .com chimera script. However, I get the following error message:
>>> 
>>> *******************
>>> 
>>> [christos at biophysics Desktop]$ ./script.py 
>>> chimera_script_for_ligand.com
>>> Traceback (most recent call last):
>>>   File "/share/apps/PROGRAMS/CHIMERA/CHIMERA-1.9/share/__main__.py", line 69, in <module>
>>>     value = chimeraInit.init(sys.argv)
>>>   File "/share/apps/PROGRAMS/CHIMERA/CHIMERA-1.9/share/chimeraInit.py", line 638, in init
>>>     splash.create()
>>>   File "/share/apps/PROGRAMS/CHIMERA/CHIMERA-1.9/share/chimera/splash.py", line 25, in create
>>>     sync=chimera.debug)
>>>   File "/share/apps/PROGRAMS/CHIMERA/CHIMERA-1.9/lib/python2.7/lib-tk/Tkinter.py", line 1747, in __init__
>>>     self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
>>> _tkinter.TclError: no display name and no $DISPLAY environment variable
>>> 1
>>> 
>>> **********************
>>> 
>>> The python script successfully creates the .com script:
>>> 
>>> ******************************
>>> 
>>> [christos at biophysics Desktop]$ more chimera_script_for_ligand.com
>>> open 127D
>>> open 127D
>>> open ligand.pdb
>>> match #0:6 #1:18
>>> write format pdb 2 flipped_ligand
>>> stop
>>> 
>>> ***************************
>>> 
>>> and if I manually execute this chimera script, everything works out well:
>>> 
>>> **************************
>>> 
>>> [christos at biophysics Desktop]$ chimera --nogui chimera_script_for_ligand.com
>>> Fetching 127D from web site www.rcsb.org
>>> 0 Kbytes received
>>> Fetch 127D: finished
>>> Done fetching 127D; verifying...
>>> Opening 127D...
>>> #0, chain A: dna (5'-D(*cp*gp*cp*gp*ap*ap*tp*tp*cp*gp*cp*G)- 3')
>>> 
>>> #0, chain B: dna (5'-D(*cp*gp*cp*gp*ap*ap*tp*tp*cp*gp*cp*G)- 3')
>>> 
>>> Opening VRML model in 127D - Nucleotides...
>>> 127D opened
>>> Opened VRML model in 127D - Nucleotides
>>> Opened 127D containing 1 model, 639 atoms, and 146 residues
>>> Fetching 127D from web site www.rcsb.org
>>> 88 Kbytes received
>>> 80 Kbytes received
>>> Fetch 127D: finished
>>> Done fetching 127D; verifying...
>>> Opening 127D...
>>> #1, chain A: dna (5'-D(*cp*gp*cp*gp*ap*ap*tp*tp*cp*gp*cp*G)- 3')
>>> 
>>> #1, chain B: dna (5'-D(*cp*gp*cp*gp*ap*ap*tp*tp*cp*gp*cp*G)- 3')
>>> 
>>> Opening VRML model in 127D - Nucleotides...
>>> 127D opened
>>> Opened VRML model in 127D - Nucleotides
>>> Opened 127D containing 1 model, 639 atoms, and 146 residues
>>> Opening ligand.pdb...
>>> ligand.pdb opened
>>> Opened ligand.pdb containing 1 model, 32 atoms, and 1 residues
>>> Executing match ['#0:6', '#1:18'], no iteration
>>> 
>>> RMSD between 21 atom pairs is 0.630 angstroms
>>> Wrote flipped_ligand into /home/christos/Desktop
>>> 
>>> *****************************
>>> 
>>> 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,
>>> 
>>> Christos Deligkaris, PhD
>>> Assistant Professor of Physics, Drury University
>>> 900 N Benton Ave, Springfield MO, 65802
>>> Office Phone: (417) 873-7234
>>> www2.drury.edu/christos @DeligkarisGroup +ChristosDeligkaris
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Chimera-users mailing list
>>> Chimera-users at cgl.ucsf.edu
>>> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
>> 
> 
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20150217/de0f97b0/attachment.html>


More information about the Chimera-users mailing list