https://github.com/jeffrichardchemistry/molbokeh
A new python package to visualize molecules in dots hover
https://github.com/jeffrichardchemistry/molbokeh
bioinformatics bokeh cheminformatics chemometrics data-visualization molecule-visualization qsar qspr rdkit
Last synced: 5 months ago
JSON representation
A new python package to visualize molecules in dots hover
- Host: GitHub
- URL: https://github.com/jeffrichardchemistry/molbokeh
- Owner: jeffrichardchemistry
- License: mit
- Created: 2024-02-06T19:38:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-15T14:47:01.000Z (over 2 years ago)
- Last Synced: 2025-09-18T03:04:48.370Z (9 months ago)
- Topics: bioinformatics, bokeh, cheminformatics, chemometrics, data-visualization, molecule-visualization, qsar, qspr, rdkit
- Language: Jupyter Notebook
- Homepage:
- Size: 979 KB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MolBokeh
[](https://pypi.python.org/pypi/molbokeh) [](https://www.pepy.tech/projects/molbokeh) [](https://python.org/downloads)
MolBokeh is a simple package for viewing the image of molecules in interactive graphics from the Bokeh package without the need to run a web application such as flask or dash in the backend, thus facilitating integration with other tools and codes.

# Installation
```
pip3 install molbokeh
```
# Simple usage
For more detailed usage examples, look the notebook at `example/how_to_use.ipynb` or open in [Google Colab (Opt1)](https://colab.research.google.com/drive/1SJPolSM_ZgjTMkra5LqQpk0mC5Jomqv8#scrollTo=dBJ3u_ivn-z-), [Colab (Opt2)](https://drive.google.com/file/d/1SJPolSM_ZgjTMkra5LqQpk0mC5Jomqv8/view?usp=sharing)
```python
import pandas as pd
from MolBokeh import MolBokeh
from bokeh.plotting import figure,show
from bokeh.models import ColumnDataSource
path = 'data.csv'
df = pd.read_csv(path)
source = ColumnDataSource(df)
fig = figure(width=600, height=500,tools="pan,box_zoom,wheel_zoom,zoom_in,zoom_out,reset,save,hover")
fig.scatter(x='MolWt', y='MolLogP', source=source, size=12,alpha=0.6)
## Adding molecules
fig = MolBokeh().add_molecule(fig=fig,
source=source,
smilesColName='Smiles_canon',
hoverAdditionalInfo=['MolWt','MolLogP','nRing','qed','TPSA'],
molSize=(100,100))
show(fig)
```
### Parameters info
| **Parameter** | **Type** | **Default** | **Description** |
| :-------------------: | :-------------------------------------: | :---------: | :----------------------------------------------------------- |
| `fig` | `bokeh.plotting._figure.figure` | required | Bokeh plot object created from `source(df)` |
| `source` | `bokeh.models.sources.ColumnDataSource` | required | Bokeh data type used to plot initial chart. |
| `smilesColName` | `str` | required | Smiles column name in dataframe used to create source object |
| `hoverAdditionalInfo` | `None or list` | `None` | List of column names (variables) to be shown within the graphs hover. |
| `molSize` | `tuple` | `(150,150)` | Size of the image of the molecule to be shown within the hover, also changes the size of the hover frame |