[Chimera-users] help with simple python script

Eric Pettersen pett at cgl.ucsf.edu
Tue Apr 27 15:47:01 PDT 2010

On Apr 27, 2010, at 3:14 PM, Scott Classen wrote:

> Hi all,
> I have a number of PDB files that I would like to open, run a  
> buriedArea calculation, save the results to a file, and exit
> I can put a bunch of commands in a file and launch it from a  
> terminal shell
> chimera --nogui --nostatus --script calculate_buriedArea.com >  
> results.txt
> the calculate_buriedArea.com file looks like this:
> open my.pdb
> measure buriedArea #0:.A #0:B
> This works, but is a bit cumbersome. I would like to make a python  
> script so I can call my calculation with the name of the PDB file on  
> the command line like this:
> chimera --nogui --nostatus --script calculate_buriedArea.py -- my.pdb
> .... so can someone please get me started here?
> import chimera
> myfile = chemera.somefunctiontoopenaPDBfile($1)

Hi Scott,
	For the relatively simple scripting you're describing I don't think  
you really need the --script argument.  You can basically run Chimera  
like this:

chimera --nogui --nostatus my.pdb calculate_buriedArea.py

Chimera will open the PDB file normally and then run your script.  You  
only really need to use --script when you need to pass arguments to  
the script that Chimera shouldn't process.  So, with above command  
line the PDB file will be open when your script runs.  In fact, it  
doesn't seem like you actually need a Python script.  You could just  
use your .com script (minus the "open" command):

chimera --nogui --nostatus my.pdb calculate_buriedArea.com > results.txt

or some such.


                         Eric Pettersen
                         UCSF Computer Graphics Lab

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20100427/c1688adb/attachment.html>

More information about the Chimera-users mailing list