Monday, August 5, 2019

An interactive RDKit widget for Jupyter: a first pass

This blog post is more of a request for comments/assistance than the usual is.

I've been doing some experimentation with Jupyter widgets and have managed to put together an initial proof of concept widget for displaying molecules where you can select atoms and find out which atoms are selected.

This is one where the notebook by itself really isn't worth much, so I'll just link to it:
https://github.com/greglandrum/rdkit_blog/blob/master/notebooks/Jupyter_widget.ipynb

This animation shows how the widget works. It constructs a widget displaying an SVG and demonstrates atom selection/deselection in the widget propagating to Python:



And here's a demonstration that shows changing the SVG that's being displayed from Python:


This is basic, but I think it's a decent start towards something that could be really useful. Interested? Have suggestions (ideally accompanied by code!) on how to improve it? If it looks like this is actually likely to be used, I will figure out how to create a standalone nbwidget out of this and create a separate github repo for it.