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

Tom Goddard goddard at sonic.net
Mon Feb 16 21:02:01 PST 2015


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 <http://script_file.name/>
> chimera=subprocess.call(["chimera", " --nogui ", "chimera_script_for_ligand.com <http://chimera_script_for_ligand.com/>"])       
> print chimera
> #delete the script, leaving just the flipped ligand
> #os.remove(script_file.name <http://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 <http://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 <http://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 <http://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 <http://chimera_script_for_ligand.com/>
> Fetching 127D from web site www.rcsb.org <http://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 <http://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 <tel:%28417%29%20873-7234>
> www2.drury.edu/christos <http://www2.drury.edu/christos/index.html> @DeligkarisGroup <https://twitter.com/DeligkarisGroup> +ChristosDeligkaris <http://google.com/+ChristosDeligkaris>
> 
> 
> 
> _______________________________________________
> 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/20150216/b4a8d175/attachment-0001.html>


More information about the Chimera-users mailing list