Friday, 30 March 2012

Molecular eye candy for IPython

IPython is an enhanced Python shell that does magic and is wonderful. Apart from me, everyone else uses it. You can install it with "easy_install IPython" on Windows, Linux, etc. Recent versions have a graphical console (start with "ipython-qtconsole") to which we can add some molecular eye candy. Greg Landrum has already done this for RDKit. Here's how to do it for Pybel.

First of all, here's the before picture:
Now, copy and paste the following into the console:
pybel.Molecule._repr_png_ = lambda x: x.write("png")
And here's how it looks after:
Greg has gone a bit further with RDKit, and has enhanced substructure matches, but that's where I'll draw the line for now.

No comments: