[Chimera-users] Chimera scripting with --nogui can't write pdb files

rswett at chem.wayne.edu rswett at chem.wayne.edu
Tue Jun 24 13:31:29 PDT 2014


Hey guys, i've been trying to put together a command line only set of  
scripts that will do some selection processing and save a pdb without  
going through the gui.

If I use the command
chimera --nogui  --script close.py pdb1.pdb pdb2.pdb

where close.py contains

select #0 za<3 & #1:HOH
write selected 1 output.pdb

I should get the residues that match that selection criteria saved as  
the pdb output.pdb, correct?

I get SyntaxError: invalid syntax for line 2 even though this works  
OUTSIDE a script. as in, if I just run chimera command line and enter  
those commands sequentially, it works. I also noticed that within the  
gui I need  "#1" and outside it only works with '1" as the model number.

I've also tried doing this with a python script:

chimera --nogui --nostatus --script "close.py pdb1.pdb pdb2.pdb output.pdb"

this should pass whatever I enter as $1 $2 $3 as arguments to my  
script, correct?

So close.py for this version contains

open (sys.argv[1])
open (sys.argv[2])
select #0 za<3 & #1:CVX
write selected 1 (sys.argv[3])

which also pukes on the pdb write. I couldn't find any other way to  
write a pdb using python syntax, I assume the way i'm doing it is  
wrong, but I couldn't find a write.pdb function during my digging.

Does anyone have suggestions for writing a pdb based on a selection  
without going through the gui? I plan on batching this up for a huge  
number of files and directories and going through the gui would be far  
too time consuming.

Rebecca





More information about the Chimera-users mailing list