Thanks, Tom. Very useful indeed.

I will go through these.

Kind regards,

Paul

On 17/02/2016 18:50, Tom Goddard wrote:
Hi Paul,

Hi Paul,

  I suggested adding the path to sys.path in your Chimera start-up so that you wouldn’t have to modify the system Python.

  Here is a Python example of computing a triangulation for the part of a plane inside a closed surface, using as an example an icosahedron for the closed surface.  You can just use File / Open… in Chimera to run it and it will report in the Reply Log (menu Favorites)

Clipped icosahedron, clip plane has 10 triangles

More Python code examples are on the Chimera Python scripts web page:

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

  The Chimera programming documentation is scant.  To figure out how to write the attached example code I looked at my Chimera distribution at file

Chimera.app/Contents/Resources/share/SurfaceCap/surfcaps.py

at the calculate_cap() routine.  All of the Chimera Python modules are in the above “share” directory — it is useful to poke around in there to figure out how things work, although it can be hard to find what you want.

Tom





On Feb 17, 2016, at 1:28 AM, Paul Kibet Korir <pkorir@ebi.ac.uk> wrote:

Thank you very much, Tom.

I found the folder and added a file 'chimera.pth' to system Python site-packages with the path to Chimera's site-packages, which also did the same thing.

The whole point for me doing this was to try and take advantage of Chimera's functionality. I would like to slice closed 3D volumes. I've looked through the online documentation but have not had success. Could you please point me in the right direction on how to achieve this?

My input will be vertices and polygons together with a slicing plane and my expected output is the contents of the plane as an 'image' or set or polygons.

Many thanks.

Paul




On 16/02/2016 23:52, Tom Goddard wrote:
Hi Paul,

  The error means that you have two different colorbrewer Python modules and Chimera is getting the one that didn’t come with Chimera.  I see the Chimera colorbrewer.py file in

/Applications/Chimera.app/Contents/Resources/lib/python2.7/site-packages/colorbrewer.py

But I’m guessing you have the following colorbrewer module which is completely different from the Chimera one installed with your system Python


In order for Chimera modules to work from the system Python it will be necessary that Chimera finds its own Python modules.  So you should put the above Chimera site-packages directory in front of Python system locations in the Python search path sys.path.  I would put this in your script that starts Chimera using the system Python, something like

import sys
sys.path.insert(0, '/Applications/Chimera.app/Contents/Resources/lib/python2.7/site-packages’)


  Tom

On Feb 16, 2016, at 4:08 AM, Paul Kibet Korir  wrote:

Hi,

I want to use the chimera API and I've managed to configure a successful import of chimera except that I get that colorbrewer is not installed.

>>> import chimera
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Applications/Chimera.app/Contents/Resources/share/chimera/__init__.py", line 73, in <module>
    import palettes
  File "/Applications/Chimera.app/Contents/Resources/share/chimera/palettes.py", line 103, in <module>
    _initPresets()
  File "/Applications/Chimera.app/Contents/Resources/share/chimera/palettes.py", line 95, in _initPresets
    from colorbrewer import ColorBrewer
ImportError: cannot import name ColorBrewer

What is the right way to go about this? (I could create a symbolic link to my system colorbrewer, but that doesn't seem clean).

--
With kind regards,

Paul K Korir, PhD
Scientific Programmer
EMBL-EBI
Main Building, A2-35,
WTGC, Hinxton, Cambridge CB10 1SD
P: +44 1223 49 44 22
F: +44 1223 49 44 68
_______________________________________________
Chimera-users mailing list: Chimera-users@cgl.ucsf.edu
Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users


--
With kind regards,

Paul K Korir, PhD
Scientific Programmer
EMBL-EBI
Main Building, A2-35,
WTGC, Hinxton, Cambridge CB10 1SD
P: +44 1223 49 44 22
F: +44 1223 49 44 68


--
With kind regards,

Paul K Korir, PhD
Scientific Programmer
EMBL-EBI
Main Building, A2-35,
WTGC, Hinxton, Cambridge CB10 1SD
P: +44 1223 49 44 22
F: +44 1223 49 44 68