[BioPython] 3D Structure?

Andrew Dalke dalke at dalkescientific.com
Thu Dec 16 23:43:55 EST 2004


Harry suggested PyMol.  Kael pointed out Chimera.  There's also
VMD from UIUC and Michel Sanner's PMV and ViPEr.  Probably a
few more as I haven't looked for a while.

Andreas Klostermann:
>  In case you wonder, if
> Python is fast enough for this task. It is. Or better: it's not, but
> Open Gl does all the work with hardware acceleration, circumventing the
> speed draw-back of python.

VMD and PyMol are mostly written in C++ for performance reasons.
I don't know about Chimera but I suspect is has a good chunk of
C++ in it.  Michel's code is mostly if not all Python.

VMD is in C++ because it was started about 12 years ago and not
only had we not heard of Python but we needed the better
performance and memory.  I recall loading the polio virus capsid
on our big machine with 128 MB and having the machine hit
swap space.

> First task would be to obtain the structure of the molecule by linking
> 3D coordinates together. I browsed in the biopython documentation, but 
> I
> did not really get a clue. I suspected the neccessary functionality in
> the PDB module, but could not find a way on how to get to 3D 
> coordinates
> out of a pdb file or whatever data object is neccessary for that.

Last I checked, the Biopython code didn't support structure perception.
It only supports getting the coordinates and not information about the
bonding patterns.


>> The widget would then be used something like this, in fictional code
>> without caring for module importing / referencing.
>>
>> >>> model = model_from_data(something)
>> >>> window = gl_window(model)
>> >>> window.show()
>>
>> A window would popup now, with a slowly rotating molecule in it.

Except that people wouldn't use that API.  To be useful, the
OpenGL window needs to be embedable in a GUI, so that the rotating
molecule is in a Qt or wx or other such window.  It also needs
support for mouse interactions, so that clicks and mouseovers work.

More advanced widgets would need support for displaying multiple
molecules, or multiple conformations of a part of the structure
as with docked poses.   It should also allow people to insert
arbitrary graphics objects in the scene, which is useful for making
diagrams or new types of representations.  And ideally do so
with proper support for transparency and the ability to dump the
structure out to Raster3D, POV-Ray or other rendering software.

> One
> tricky part will be to open a window on different platforms, but that's
> pretty simple. At first, pygame will be enough, since it runs on Linux,
> Windows and Mac, but that's a bad dependency (in my opinion). The 
> module
> could check for availability of pyGTK, win32 or wxPython bindings and
> use them. The core of the open gl representation would not care a bit
> about the underlying windowing API.

PyGame didn't work well for me when I tried to embed it in wx.
The only support (as I recall) was for doing that under MS Windows
and I use a Mac.

I've been looking at OpenGlContext pyopengl.sourceforge.net/context/
and OpenSceneGraph.  The first I got working on Mac/wx/Python but
the Python bindings for the binding are out of date and I couldn't
get it working.  OSG does seem quite powerful though.

> Of course that's all future for now. Even more futuristic would be to
> use the same core as a displaying widget in python-driven gui programs.

I disagree that that's futuristic.  To get what you want, what's
wrong with dumping a structure to a file then running an external
viewing program?  That's what Konrad Hinsen's MMTK structure viewer
code did 10 years ago.

					Andrew
					dalke at dalkescientific.com




More information about the BioPython mailing list