Skip to content

Latest commit

 

History

History
77 lines (46 loc) · 2.01 KB

visualize_plots.rst

File metadata and controls

77 lines (46 loc) · 2.01 KB

Visualize the Chemical Space

ChemPlot can generate two types of plots for a given chemical space: static and interactive.

For the following examples we will use the BBBP (blood-brain barrier penetration) dataset [1].

from chemplot import Plotter, load_data

data = load_data("BBBP")
cp = Plotter.from_smiles(data["smiles"], target=data["target"], target_type="C")

Static Plot

To generate a static plot first reduce the dimensions of the molecules used to initialize the :class:`Plotter` instance. Then you can use :mod:`visualize_plot()` to generate a static visualization of the chemical space.

import matplotlib.pyplot as plt

cp.tsne()
cp.visualize_plot()

images/gs_tsne.png

Interactive Plot

To generate an interactive plot first reduce the dimensions of the molecules used to initialize the :class:`Plotter` instance. Then you can use :mod:`interactive_plot()` to generate an interactive visualization of the chemical space.

cp.interactive_plot(show_plot=True)

The interactive plot is generated using the library bokeh. You can interact with it by using the toolbar displayed on the top right of the visualization. You can navigate across the plot, select group of molecules, zoom in and out the visualization and save the plot as an image. Furthermore you can hover over the molecules to see their 2D image.


References:

[1]Martins, Ines Filipa, et al. (2012). A Bayesian approach to in silico blood-brain barrier penetration modeling. Journal of chemical information and modeling 52.6, 1686-1697