[Chimera-users] [chimera-dev] chimera help

Eric Pettersen pett at cgl.ucsf.edu
Thu Sep 28 10:49:50 PDT 2006


If you have a large number of PDBs then you might want to use Python,  
where you have access to loops and variables.  Say you had the PDBs  
listed in a file, one per line, named "mypdbs".  Then you might use a  
Python script like this:

--------------------------------------
import chimera
from chimera import runCommand
f = open("mypdbs", "r")
for line in f:
	pdbID = line.strip()
	runCommand("open " + pdbID)
	runCommand("scale 1.5; ~disp; ribbon; ribrepr smooth; rainbow")
	runCommand("copy file %s.png png supersample 5" % pdbID)
	runCommand("close all")
--------------------------------------
Note that the "runCommand" function allows you to do things that you  
know the Chimera command for without knowing what the Python  
equivalent is.  Assuming you name the script file with a ".py" ending  
so that Chimera can recognize it as Python, then you can run the  
script with any of the ways that Chimera opens files (File...Open  
dialog, "open" command, startup shell command argument).

Also, Chimera needs the graphics window to be showing and not  
obscured by other windows in order to render the images.  If you are  
doing a lot of images you may have to turn off your screen saver so  
that it doesn't hide the Chimera window.

--Eric

                         Eric Pettersen
                         UCSF Computer Graphics Lab
                         pett at cgl.ucsf.edu
                         http://www.cgl.ucsf.edu


On Sep 28, 2006, at 9:14 AM, Elaine Meng wrote:

> Hi Vishal,
> Actually you can do this with a Chimera command script, as opposed  
> to programming in Python.  A command script just contains the same  
> commands you would enter in the Command Line.  I'm not sure of what  
> type of saving you had in mind, " but the  "copy" command can be  
> used to save an image file, "save" to save a session, and "write"  
> to save a PDB file.
>
> This page links to all the command man pages, plus it discusses  
> command scripts (at the bottom):
> http://www.cgl.ucsf.edu/chimera/1.2199/docs/UsersGuide/ 
> framecommand.html
>
> Just opening the command file will execute the commands.
> Here are links to a couple of example command files:
> http://www.cgl.ucsf.edu/chimera/1.2199/docs/UsersGuide/tutorials/ 
> setup.com
> http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/recorder/ 
> 1gfl.com
>
> And here is another, between the dashed lines:
> -----------------------------------------------------------------
> open 1hxx
> open 1pho
> modelcolor coral #0
> modelcolor cornflower blue #1
> ~disp; rep bs; ribbon; ribrepr smooth
> matchmaker #0 #1
> -----------------------------------------------------------------
>
> I guess the main difficulty if you are saving images is how to get  
> a good view of the structures. Usually some rotation, scaling, etc.  
> is done interactively to make a better picture.
> I hope this helps,
> Elaine
>
>
> On Sep 27, 2006, at 7:29 PM, Vishal Pua wrote:
>
>> Hi, I was wondering if there was a way to create a script, that  
>> would open pdb files, render them to look a certain way ex. wire  
>> or ribbon, then save, automatically? this would have to work for a  
>> number of pdb files? I have little programming experience, and  
>> wonder if there was an easy way to do this, thanks
>>
>> Vishal Pua
>> _______________________________________________
>> Chimera-dev mailing list
>> Chimera-dev at cgl.ucsf.edu
>> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
>
> -----
> Elaine C. Meng, Ph.D.                          meng at cgl.ucsf.edu
> UCSF Computer Graphics Lab and Babbitt Lab
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
>                      http://www.cgl.ucsf.edu/home/meng/index.html
>
>
>
>
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev

_______________________________________________
Chimera-dev mailing list
Chimera-dev at cgl.ucsf.edu
http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20060928/d61835ec/attachment.html>


More information about the Chimera-users mailing list