
Chemical Cluster Viewer
by Pat Walters
Explore Butina clusters of aligned chemical structures with an interactive cluster viewer.
About this notebook
This notebook builds a viewer for chemical clustering results. It reads a set of carbonic anhydrase inhibitors from a CSV file. These molecules are from a 2018 paper by Cortes-Ciriano and Bender. The code uses pandas for the table and rdkit for the chemistry. It adds a fingerprint column with marimo_chem_utils. It then clusters the structures with the Taylor-Butina algorithm from useful_rdkit_utils.
The viewer has two panes. The left pane is a marimo table. It shows one representative structure for each cluster. You click the checkbox next to a row to select a cluster. The right pane then shows the first members of that cluster, up to 12. A tooltip shows a larger version of each structure. You can also click the fullscreen icon to zoom the whole view.
The code aligns the structures inside each cluster before it draws them. It uses the mcs_align function from useful_rdkit_utils for this step. This function may rotate a structure that is very long in one direction. The detail pane reads the selected row from the table value. It then draws the molecules with the RDKit MolsToGridImage function.











