[BioPython] 3D Structure?
Andreas Klostermann
bluetigger at web.de
Thu Dec 16 05:51:40 EST 2004
Hi,
I just started browsing around what you can do with Biopython, for some
educational interest. I'd like to try and implement an Open GL Viewer
for molecules in Python. In my wild days (before studying veterinary
medicine) I acquired a solid grasp of Open Gl. 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.
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.
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. 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.
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.
It would be nice to receive some suggestions on this proposal.
best regards,
Andreas Klostermann
More information about the BioPython
mailing list