[chimera-dev] headless chimera issues
Eric Pettersen
pett at cgl.ucsf.edu
Wed Aug 20 10:41:39 PDT 2008
Hi James,
Yes, undoubtedly in nogui mode there is no Reply Log dialog for you
to access. If you are using Python, there are far more direct ways to
get an atom's coordinates than using getcrd and trying to parse the
reply log anyway. Such as:
from chimera.selection import OSLSelection
sel = OSLSelection("#0:%s.%s at CA" % (snpPos, chain))
a = sel.atoms()[0]
crd = a.coord() # or a.xformCoord() for transformed coordinates
I've attached a PDF of a handout from a Chimera development class we
just taught here at UCSF. It covers a bunch of handy resources and
tips. The first resource it lists, the Programmer's Examples, is
something you should look over. They cover how Chimera's molecular
data is laid out, how to deal with selections, and so forth.
--Eric
On Aug 20, 2008, at 9:37 AM, James A. Cleland wrote:
> Ok, I ran this in chimera (gui) and I see how it is working now, the
> reply contains space-separated coordinates at the end of the string
> and get_coords picks these off from the end (-1, -2, -3). Perhaps
> this is another “headless” issue as there is no dialog? If so, maybe
> there’s somewhere else I can pick off the reply information for
> getcrd?
>
> Thanks!
>
> From: James A. Cleland [mailto:jcleland at jamescleland.com]
> Sent: Wednesday, August 20, 2008 12:32 PM
> To: 'Eric Pettersen'
> Subject: RE: headless chimera issues
>
> This worked like a charm, thank you! I have run into another issue
> that I thought you may be able to help with.
>
> We are attempting to draw a pointer indicating the alpha carbon for
> a particular residue. This has been done in the past, but no longer
> works. This may have been something that you helped with.
>
> The function that is currently failing is called “get_coords()”.
> Here’s what I have:
>
> def _get_coords():
> from chimera import dialogs, Vector
> coords = Vector(0,0,0)
> r = dialogs.find('reply')
> text = r.text.get('1.0', 'end')
> coordString = text.splitlines()[-2]
> coordString = coordString.split(' ')
> print coordString
> coords[2] = float(coordString[-1])
> coords[1] = float(coordString[-2])
> coords[0] = float(coordString[-3])
> return cords
>
> Prior to calling get_coords(), there is a command executed that
> seems to provide the dialog information, if I’m understanding
> correctly:
>
> runCommand("getcrd #0:%s.%s at CA" % (snpPos, chain))
>
> The line that appears to be failing in get_coords() is the fourth in
> the function, r.text.get(). It looks like dialogs.find() returned
> None.
>
> Do you have any suggestions as to how I might get these coordinates
> or what we might be doing wrong?
>
> Thanks!
> James
> From: Eric Pettersen [mailto:pett at cgl.ucsf.edu]
> Sent: Tuesday, August 19, 2008 7:41 PM
> To: James A. Cleland
> Cc: Tom Goddard
> Subject: Re: headless chimera issues
>
> That's right -- the patch just prevents the error. It doesn't do
> the coloring. Hopefully Tom Goddard will be able to help you with
> that.
>
> --Eric
>
> On Aug 19, 2008, at 4:21 PM, James A. Cleland wrote:
>
> Thank you for the quick reply! I applied this patch manually by just
> adding the import and the condition. I had commented the conditional
> statements prior to writing you and this worked fine, but the
> surface model didn’t appear to be colored according to the Delphi
> output. Is it correct for me to assume that, after this patch is
> applied, I’m still not seeing the electrostatic potential in the
> surface coloring?
>
> Thanks again,
> James
>
> From: Eric Pettersen [mailto:pett at cgl.ucsf.edu]
> Sent: Tuesday, August 19, 2008 6:56 PM
> To: James A. Cleland
> Cc: Tom Goddard
> Subject: Re: headless chimera issues
>
> Hi James,
> That exception would be a bug -- SurfaceColor should not
> be trying to bring up a dialog if Chimera is running in nogui mode.
> I've committed a fix for this and it will be in tomorrow's daily
> build. Here's the diff if you want to correct your version:
>
> *** ChimeraExtension.py 6 May 2008 04:20:05 -0000 1.12
> --- ChimeraExtension.py 19 Aug 2008 22:51:36 -0000
> ***************
> *** 50,56 ****
> from VolumeViewer import open_volume_file
> vlist = open_volume_file(path, ftype, open_models = False,
> show_data = False,
> show_dialog = False)
> ! if len(vlist) > 0:
> from SurfaceColor.gui import show_surface_color_dialog
> d = show_surface_color_dialog()
> d.use_electrostatics_colormap()
> --- 50,57 ----
> from VolumeViewer import open_volume_file
> vlist = open_volume_file(path, ftype, open_models = False,
> show_data = False,
> show_dialog = False)
> ! import chimera
> ! if len(vlist) > 0 and not chimera.nogui:
> from SurfaceColor.gui import show_surface_color_dialog
> d = show_surface_color_dialog()
> d.use_electrostatics_colormap()
>
> I've cc'ed Tom Goddard on this mail since he is the
> expert on Chimera's volumetric API and can hopefully provide advice
> on coloring your map programmatically.
>
> --Eric
>
> Eric Pettersen
> UCSF Computer Graphics Lab
> http://www.cgl.ucsf.edu
>
>
> On Aug 19, 2008, at 1:32 PM, James A. Cleland wrote:
>
>
> Hi Eric,
>
> My name is James Cleland and I am currently working with Dr. Rachel
> Karchin at JHU. I had corresponded with Greg Couch over running
> Chimera without an X server and he had directed me toward a build
> designed to run headless. I have been using this for a couple of
> weeks without problems, but I encountered an issue the other day.
>
> I am trying to import a surface for electrostatic potential that was
> generated using Delphi. The trouble is, this is causing an error
> (see below).
>
> Executing test.py...Opening pdb1a01.ent...
> 1 model opened
>
> Traceback (most recent call last):
> File "/home/pipeline/chimera/share/__main__.py", line 65, in
> <module>
> value = chimeraInit.init(sys.argv)
> File "CHIMERA/share/chimeraInit.py", line 384, in init
> chimera.openModels.open(a, prefixableType=1)
> File "CHIMERA/share/chimera/__init__.py", line 1345, in open
> File "CHIMERA/share/chimera/__init__.py", line 787, in _openPython
> File "test.py", line 15, in <module>
> runCommand("open 1a01.phi")
> File "CHIMERA/share/chimera/__init__.py", line 2026, in runCommand
> File "CHIMERA/share/Midas/midas_text.py", line 62, in makeCommand
> File "CHIMERA/share/Midas/midas_text.py", line 918, in doOpen
> File "<string>", line 1, in <module>
> File "CHIMERA/share/Midas/__init__.py", line 1352, in open
> File "CHIMERA/share/chimera/__init__.py", line 1345, in open
> File "CHIMERA/share/SurfaceColor/ChimeraExtension.py", line 55, in
> open_cb
> File "CHIMERA/share/SurfaceColor/gui.py", line 613, in
> show_surface_color_dialog
> File "CHIMERA/share/chimera/dialogs.py", line 77, in display
> File "CHIMERA/share/chimera/dialogs.py", line 62, in find
> File "CHIMERA/share/chimera/baseDialog.py", line 435, in __init__
> File "CHIMERA/share/chimera/baseDialog.py", line 121, in __init__
> File "CHIMERA/share/chimera/tkgui.py", line 63, in <module>
> ImportError: No module named Togl
> Error while processing test.py:
> ImportError: No module named Togl
> (see reply log for Python traceback info)
>
> From what I can gather, the call to open is trying to present a
> dialog for choosing surface colors and limits. I’ve seen this when
> running Chimera with an X server. The trouble is, I need to skip
> this dialog and, possibly, specify volume in some other fashion.
>
> We used to use the following python code in our Chimera script:
>
> from chimera import openModels, MSMSModel
> runCommand("set bg_color black")
> surf = openModels.list(modelTypes=[MSMSModel])[0]
> from VolumeViewer.volume import Volume
> vol = openModels.list(modelTypes=[Volume])[0]
> from SurfaceColor import color_by_volume
> color_by_volume(surf, vol, (-30, 0, 30), ((1,0,0,1.0), (1,1,1,1.0),
> (0,0,1,1.0)))
>
> This was run using an older version of Chimera and used an X server.
> We ran into problems using this version with –nogui, which is what
> led me to the headless version.
>
> I have been playing around with SurfaceColor/ChimeraExtensions.py,
> specifically line 55-56, trying to figure out how to at least get
> color on the surface using the default volume. It appears that, by
> commenting the aforementioned lines, I get no surface coloring at all.
>
> Can you provide some direction for me on this? Any help is
> appreciated!
>
> Thanks,
>
> James A. Cleland
> (w) 1(703)392-1357
> (c) 1(703)402-5447
> jcleland at jamescleland.com
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20080820/b4f5d0f9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resources.pdf
Type: application/pdf
Size: 52526 bytes
Desc: not available
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20080820/b4f5d0f9/attachment.pdf>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20080820/b4f5d0f9/attachment-0001.html>
More information about the Chimera-dev
mailing list