
First of all, sorry for posting all those extension questions on the user list. I just discovered the dev list. Could I get the headers needed for 1.2199 for linux and possibly OS10.4? I am wanting to make use of the BILD format and I have a few questions. If I generate a lot of polygons how efficient will it be, or is there some way to specify poly-strips/triangle-fans. Pertaining to PDB's as well, is there a way to open a file from a stream/string? I despise temp files. It would be nice to use a StringIO object to write my contents to, or do something like "chimera.openModels.openBuffer(myBuffer, type='PDB')", where myBuffer is anything with a read() method or maybe just a string. Thanks, - Charlie

Hi Charlie, I've put the Linux Chimera 1.2199 headers on the source download page. I'll put the Mac headers up and email you when I figure out where they are. The BILD graphics works by creating a VRML model. It creates a VRML string and then uses Chimera's VRML rendering. Creating the string and parsing it could take some time for a large set of triangles. That is done in Python -- see the chimera/share/Bld2VRML directory in your Chimera distribution for exactly what translations are done. My impression is that our VRML rendering speed is also very slow and memory inefficient, but this may be based on VRML scenes with spheres and cylinders where you cannot control the subdivision level. For fast triangulated surface rendering I would suggest using the Chimera _surface.Surface_Model class. This is the model type that is used for volume contour surfaces and multiscale model surfaces. It just renders sets of triangles. It is fairly well optimized for rendering speed and memory use but does not support triangle strips or fans. There is some documentation in the Chimera Programmer's Reference Guide: http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Reference/surface.html I include an example making such a model below. It can also be useful to look at the C++ header from the Chimera source code chimera/contrib/_surface/surfmodel.h to see all the attributes of Surface_Model objects. The PDB file reader is implemented in C++ and I believe there is no Python interface to read from a string. The C++ code can read from a C++ stream (which could be a string stream), but there does not appear to be a Python interface. I'd suggest requesting this feature in an email to chimera-bugs@cgl.ucsf.edu (also used for new feature requests). Tom ------ Example Python program to create a surface model in Chimera. # ----------------------------------------------------------------------------- # vertices is a list of (x,y,z) vertex positions. # triangles is a list of (i0,i1,i2) vertex index triples defining triangles. # The order of the vertex indices in the triangles array is used to # determining lighting normals. # def show_geometry(vertices, triangles, rgba): # _surface requires float32 and int32 arrays import Numeric varray = Numeric.array(vertices, Numeric.Float32) tarray = Numeric.array(triangles, Numeric.Int32) import _surface sm = _surface.Surface_Model() g = sm.add_group(varray, tarray, rgba) g.set_display_style(g.Mesh) # Mesh or Solid (default) g.set_normal_orientation(g.Righthanded) # Outward normal Righthanded (default) or Lefthanded # See contrib/_surface/surfmodel.h for more attributes import chimera chimera.openModels.add([sm]) return sm # ----------------------------------------------------------------------------- # Tetrahedron exampl;e. # vertices = ((0,0,0), (1,0,0), (0,1,0), (0,0,1)) triangles = ((0,2,1), (0,1,3), (0,3,2), (1,2,3)) rgba = (.7,.7,.7,1) show_geometry(vertices, triangles, rgba)

On Feb 28, 2006, at 9:28 AM, Thomas Goddard wrote:
The PDB file reader is implemented in C++ and I believe there is no Python interface to read from a string. The C++ code can read from a C++ stream (which could be a string stream), but there does not appear to be a Python interface. I'd suggest requesting this feature in an email to chimera-bugs@cgl.ucsf.edu (also used for new feature requests).
I second Tom's idea of requesting the feature via chimera-bugs. It would seem that you have the molecular data of interest internal to your extension rather than in an external file. What you can do is construct a Molecule directly rather than via a PDB file. Here's example code that constructs a model of a single water molecule: --- import chimera H = chimera.Element("H") O = chimera.Element("O") m = chimera.Molecule() m.name = "my water" # used by the Model Panel r = m.newResidue("HOH", "water", 1, "") # name, chain, position, insertion code o = m.newAtom("O", O) # name, element h1 = m.newAtom("H1", H) h2 = m.newAtom("H2", H) for a in [o, h1, h2]: r.addAtom(a) o.setCoord(chimera.Point(35.713, 15.029, 104.298)) h1.setCoord(chimera.Point(36.2803, 15.2855, 105.025)) h2.setCoord(chimera.Point(34.848, 15.4221, 104.414)) m.newBond(o, h1) m.newBond(o, h2) chimera.openModels.add([m]) --- If you didn't want to have to explicitly specify connectivity, you could call "chimera.connectMolecule(m)" in place of the newBond() calls, which would have Chimera add bonds based on distance. --Eric

Hi Charlie, The Chimera 1.2199 C++ header files for Mac 10.4 are now on the source code page: http://www.cgl.ucsf.edu/chimera/sourcecode.html The 1.2199 Chimera Mac build was made on Mac OS 10.4 targetting Mac OS 10.3.9. I think this simply involves adding option "-isysroot /Developer/SDKs/MacOSX10.3.9.sdk" to your gcc or g++ compiles. Here are examples linking an object file and a shared library: g++ -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -O4 -Wall -Wno-long-double -I../_volumearray -I. -I/usr/local/src/staff/goddard/builds/mac-10.4/chimera-2203/build/include -I/usr/X11R6/include -I/usr/local/src/staff/goddard/builds/mac-10.4/chimera-2203/build/include/python2.4 -I/usr/X11R6/include -DOTF_NO_FLOAT_MATH_FUNCS -DOTF_NO_SYMBOL -c -o surfmodel.o surfmodel.cpp g++ -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -Wl,-executable_path,/usr/local/src/staff/goddard/builds/mac-10.4/chimera-2203/build/lib -bundle -bundle_loader /usr/local/src/staff/goddard/builds/mac-10.4/chimera-2203/build/bin/python2.4 -o _surface.so -O4 -Wall -Wno-long-double glstate.o smooth.o subdivide.o surfmodel.o surfrenderer.o write_x3d.o _surface.o Surface_Group_Object.o Surface_Model_Object.o -L/usr/local/src/staff/goddard/builds/mac-10.4/chimera-2203/build/lib -L../_volumearray -lrcarray _chimera.dylib -lwrappy2 -lotf -L/usr/X11R6/lib -lGLU -lGL -lX11 -lm -lm The /Developer/SDKs/MacOSX10.3.9.sdk directory comes from installing XCode 2.2 from Apple's web site. http://developer.apple.com/tools/xcode/index.html The Chimera Mac build now also contains universal binaries that work on PowerPC and Intel Mac machines. That was done by building Chimera on a PowerPC machine and separately on an Intel Mac and combining them somehow. I do not know how the combining step is done. Tom

On Feb 28, 2006, at 11:32 AM, Thomas Goddard wrote:
The Chimera Mac build now also contains universal binaries that work on PowerPC and Intel Mac machines. That was done by building Chimera on a PowerPC machine and separately on an Intel Mac and combining them somehow. I do not know how the combining step is done.
It's done by a Python script that takes multiple disk images containing Chimera.app and combining object files using "lipo". Non- object files are left alone (but checked to be identical). The code is attached. Feel free to modify it for your use. Conrad
participants (4)
-
Charlie Moad
-
Conrad Huang
-
Eric Pettersen
-
Thomas Goddard