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@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@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@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