
Hi Konrad, You can use the Chimera BILD format without creating a temporary file by creating a string containing the commands, then use StringIO to make a file object from that string and open it. For example, from StringIO import StringIO bild = StringIO(".cylinder %g %g %g %g %g %g %g\n" % (end1[0], end1[1], end1[2], end2[0], end2[1], end2[2], radius)) from chimera import openModels model = openModels.open(bild, type="Bild", identifyAs='My annotations', sameAs = mol) The identifyAs argument assigns the name to the new model that will be shown in the Model Panel dialog. The sameAs argument says that the new model should be aligned with the specified model (same positioning transform). I stole this example from the Chimera Axes/Centroids/Planes code, found in the Chimera distribution in chimera/share/StructMeasure/Axes.py The BILD format produces a VRML model in Chimera and VRML models are horribly inflexible. For instance you cannot change the color of an object in a VRML model without destroying the model and building a new one. Basically the VRML is immutable after it is created. To avoid that limitation I have sometimes resorted to using (some say abusing) the Chimera Molecule object for showing annotations. The Chimera Volume Tracer tool lets you place spherical markers and connect them by cylindrical links, and you can move, delete, recolor, resize, add text labels ... the markers. This is implemented as a Molecule in Chimera, the relevant code is chimera/share/VolumePath/markerset.py A third approach to showing annotations that are geometric shapes is to use the Chimera "shape" command. http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/shape.html This can make spheres, cylinders, tubular paths, and a few other shapes -- not many though. The shapes can be created with the Chimera command or via Python calls to the Shape module chimera/share/Shape None of the annotation display techniques combine flexibility with ease of use. I suggest using BILD if possible. Tom
Hi everyone,
I would like to add non-molecular graphics objects to my molecules for illustration. The obvious way to do so is to load a BILD or VRML file, but since I create these objects in Python scripts, I'd prefer to a direct Python interface rather than write a temporary file and load it. Is there a reasonably stable interface for doing this?
Thanks in advance, Konrad. -- --------------------------------------------------------------------- Konrad Hinsen Centre de Biophysique Moléculaire, CNRS Orléans Synchrotron Soleil - Division Expériences Saint Aubin - BP 48 91192 Gif sur Yvette Cedex, France Tel. +33-1 69 35 97 15 E-Mail: research AT khinsen DOT fastmail DOT net ---------------------------------------------------------------------