[chimera-dev] Chimera Python programming

Tom Goddard goddard at sonic.net
Fri Nov 14 18:23:00 PST 2014

Hi Nicolas,

  Yes, I am the right person to ask about Python programming with Chimera.  Tom Ferrin, the head of our lab doesn’t do much programming these days.

  The good news is that all of the Chimera capabilities are accessible from Python, and all the those Python modules have the code included in the Chimera distribution.  The bad news is we don’t have good programming documentation.  You can look at our Programmer’s Guide under the Documentation link on the Chimera page

	http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html <http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html>

but there is not much there.  The Examples link which gives some programming examples might be the most useful part, but it doesn’t cover working with density maps.  The Python scripts page on the Chimera developer site is a good source of example Python code that manipulates density maps

	http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts <http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts>

  You ask how to use Chimera from your system Python.  That is difficult.  The Chimera distribution includes its own Python (version 2.7) and it include about 40 third party Python modules many compiled C code built for this specific Python.  If your system Python is different in any way it will fail to work with those modules (e.g. I think our Python has a special option for unicode handling compiled in).  Unfortunately the reality is Python is not very portable once you are using binary compiled C modules.  But the normal solution is to just run the Chimera Python.  This is troublesome though when you want to combine Chimera with other Python third-party packages that are not part of Chimera.  The usual solution is to just install those extra packages into the Chimera Python.  To run a Python script in Chimera just open it in Chimera (e.g. File / Open, or the Chimera open command, or start it from a shell “chimera myscript.py” or “chimera —nogui myscript.py” if you don’t need the graphical user interface).

  Let me know if there are more specific questions I can help with, or you can ask at chimera-dev at cgl.ucsf.edu <mailto:chimera-dev at cgl.ucsf.edu> and that way any of the Chimera programmers could answer your questions.


> On Nov 14, 2014, at 5:12 AM, Nicolas LEMERCIER wrote:
> Hello Thomas,
> I have been using Chimera for several years now. I writing a workflow to automatically treat my datas in cryoelectron tomography. The code is in Python 2.7.6 and I would like to launch chimera command directly from python without using the embedded version to intregrate in my workflow. I did not find the way to do this. Iguess it should be possible.
> I send an e-mail to Thomas Ferrin a few days ago but I think you could help me more efficiently as you developped the volume viewer in chimera
> Could you explain me how to control chimera from system python?
> Thanks a lot
> Best regards
> Nicolas
> Nicolas LEMERCIER,  PhD
> Integrative Structural Biology Center 
> Institut de Génétique et de Biologie Moléculaire et Cellulaire (IGBMC)
> 1 rue Laurent Fries 
> 67404 Illkirch FRANCE

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20141114/81befc9a/attachment.html>

More information about the Chimera-dev mailing list