๐ก Introduction๏
mols2grid is an interactive molecule viewer for 2D structures, based on RDKit.
๐ Installation๏
mols2grid was developped for Python 3.7+ and requires rdkit (>=2020.03.1), pandas and jinja2 as dependencies.
The easiest way to install it is from conda:
conda install -c conda-forge mols2grid
Alternatively, you can also use pip:
pip install rdkit mols2grid
If you notice that the selections, callbacks and interactive filtering arenโt working as intended, you may have to manually activate the extension:
for Jupyter Lab:
jupyter labextension install mols2grid
for Jupyter Notebook:
jupyter nbextension install mols2grid
Compatibility
mols2grid is mainly meant to be used in notebooks (Jupyter notebooks, Jupyter Lab, and Google Colab) but it can also be used as a standalone HTML page opened with your favorite web browser, or embedded in a Streamlit app.
Since Streamlit doesnโt seem to support ipywidgets yet, some features arenโt functional: retrieving the selection from Python (you can still export it from the GUI) and using Python callbacks.
You can also use mols2grid directly in KNIME, by looking for the `Interactive Grid of Molecules` component on the Knime HUB.
Make sure you have setup Knime's Python integration for the node to work.
๐ Usage๏
You can display a grid from:
an SDFile
import mols2grid
mols2grid.display("path/to/molecules.sdf")
a
pandas.DataFrame
:
mols2grid.display(df, smiles_col="Smiles")
a list of RDKit molecules:
mols2grid.display(mols)
Please head to the notebooks and API reference sections for a complete overview of the features available.
๐ Resources๏
Simple example by iwatobipen
Creating a web app with Streamlit for filtering datasets:
Blog post by Justin Chavez
Video tutorial by Data Professor
Viewing clustered chemical structures and Exploratory data analysis by Pat Walters
Feel free to open a pull request if youโd like your snippets to be added to this list!
๐ Acknowledgments๏
@themoenen (contributor)
@fredrikw (contributor)
@JustinChavez (contributor)
@hadim (conda feedstock maintainer)
๐ Citing๏
You can refer to mols2grid in your research by using the following DOI:
โ License๏
Unless otherwise noted, all files in this directory and all subdirectories are distributed under the Apache License, Version 2.0:
Copyright 2021-2022 Cรฉdric BOUYSSET
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.