On Jan 19, 2010, at 9:20 AM, Mojie Duan wrote:
Dear Chimera Developers,
I needs to calculate the inter-helical angle for thousands of conformations. We know Chimera can calculate the inter-helical angle for one conformation. We are wondering if Chimera can calculate the inter-helical angle for all these conformations at one time? or would you please point out how to write a script to do this?
Hi Mojie,
In the current daily build there is a new command named "define" that allows you to define axes (and planes) from the command line. The "distance" and "angle" commands have been enhanced to accept "object IDs" (which is what "define" defines) to allow measurements between axes/planes/atoms. The documentation for the define command and the enhanced angle command are here (and are in the daily build as well):
So, one approach would be for you to build a script that generally goes like this:
open noprefs (conformation 1)
sel (residues in first helix) & backbone.minimal
define axis [options you want] number 1
sel (residues in second helix) & backbone.minimal
define axis [options] number 2
angle a1 a2
close all
open noprefs (conformation 2)
etc.
When the script is finished all the angles will be in the reply log. Obviously you wouldn't write this script by hand, but instead would use any programming language you are familiar with to generate it. The 'noprefs' keyword to 'open' will speed things up since then Chimera will skip all the fancy computations it does to show the initial "smart" representation with various side chains hidden, backbone ribboned, etc.
Alternatively, you could write a Chimera Python script which could do the looping directly. Assuming that you already had all the structures open in Chimera, a script something like this:
from chimera import openModels, Molecule, runCommand
for m in openModels.list(modelTypes=[Molecule]):
runCommand("sel %s:(residue range of first helix).(chain ID) & backbone.minimal" % m.oslIdent())
runCommand("define axis [options] number 1")
runCommand("sel %s:(residue range of second helix).(chain ID) & backbone.minimal" % m.oslIdent())
runCommand("define axis [options] number 2")
runCommand("angle a1 a2")
runCommand("~define axes")
As before, the angles will be in the reply log. In the above script you could call the angle function directly, which would allow you to put more info with the angle value, like this:
angle = Midas.angle(objIDs=["a1", "a2"])
print m, angle
and you would need an "import Midas" near the top of the script.
BTW, although the current daily build is fine for measuring axes, it has a few unrelated bugs that might prove annoying in extended use so I wouldn't make it your "everyday" Chimera. I hope to get those bugs fixed today so that tomorrow's build will be more useable as a workaday Chimera.
--Eric
Eric Pettersen
UCSF Computer Graphics Lab