[Chimera-users] save axes coordinates?
pett at cgl.ucsf.edu
Fri Nov 9 19:54:43 PST 2012
On Nov 9, 2012, at 1:11 PM, <esserlo at helix.nih.gov> wrote:
> I'd like to write out the coordinates of helix axes and I know that this can
> be done in "Structure Measurements" gui window with "Save". However, I would
> like to be able to use a script. So how can I activate this "Save" function
> from a script (.com) ?
The code for saving the axes info to a file is in <your Chimera>/share/StructMeasure/gui.py, starting on line 577. Specifically:
from Axes import axisManager
axes = axisManager.axes
axes.sort(lambda a1, a2: cmp(a1.name, a2.name))
nameSize = max( + [len(a.name) for a in axes])
from chimera import Point
for axis in axes:
ends = [axis.direction * ext + axis.center
for ext in axis.extents]
cx, cy, cz = Point(ends)
dx, dy, dz = axis.direction
print>>saveFile, "%*s: %6.3f (%7.3f, %7.3f," \
" %7.3f) (%6.3f, %6.3f, %6.3f)" % (
abs(axis.extents - axis.extents),
cx, cy, cz, dx, dy, dz)
You could just incorporate this code into your script, almost directly. You would need to open "saveFile" for writing, and your import statement would be "from StructMeasure.Axes import axisManager" instead of the one above, but other than that it's smooth sailing.
> Ah, there is one more thing, when I calculate the
> angle beween 2 helix axes the result is printed in the "Reply log" - useful
> but can I also automatically write this on out to keep a record?
Well, there's a "Save" button on the bottom of the Reply Log to save the contents to a file. If you mean for a script running in "no GUI" mode, what would have gone to the Reply Log is printed on standard output instead, so you could just redirect that to a file with normal shell redirection mechanisms.
> P.S. I am currently using chimera-1.7-alpha 11/9/12 on 64 bit Linux.
P.S. If you are using a Mac then <your Chimera>/share/... is instead <your Chimera.app>/Contents/Resources/share/...
More information about the Chimera-users