2. Similarity Maps Examples#

RDKit has a feature to generate similarity maps. A deeper dive into this tool has been published in the Journal of Cheminformatics. In short, this is a tool to visualize molecular fingerprints between two molecules. Tutorials can be found on how to genereate the images, such as here and here.

The Pharmacophore-Toolset wraps the code to help simplify the generation of the similarity maps.

2.1. Import Modules and Data#

Modules are imported as standard. For this tutorial, only the Draw submodule from the Pharmacophore-Toolkit will be needed. RDKit is only needed to draw the molecule from smiles. If users choose, RDKit can be replaced with Datamol.

Similarly to the pharmacophore_tutorial, three 5-HT2A agonists will be used - serotonin, psilocin, and mescaline.

from rdkit import Chem
from pharmacophore import Draw

# render molecules as RDKit object
serotonin = Chem.MolFromSmiles("C1=CC2=C(C=C1O)C(=CN2)CCN")
psilocin =  Chem.MolFromSmiles("CN(C)CCc1c[nH]c2cccc(O)c12")
mescaline = Chem.MolFromSmiles("O(c1cc(cc(OC)c1OC)CCN)C")

2.1.1. Check#

OPTIONAL: Check output/rendering of molecule.

serotonin
../_images/6911a5b2a32d84cea12924479c87c7ab810d0bc194c99d5628e294bb7a1a25c8.png

2.2. Draw Similarity Maps#

In the pharmacophore module, the similarity_maps method is called from the Draw submodule. Only two params are required: a molecule for reference (refmol) and a molecule for comparison (querymol). Currently the similarity_maps only accepts morgan fingerprints. Default params are set as a radius=2 and nbits=2048.

In the first example, serotonin will be compared to itself. As a result, the image will show no difference in similarity (all green)/.

draw = Draw()
img = draw.similarity_maps(refmol=serotonin, querymol=serotonin)
img.save('../img/serotonin.png')
img
[15:36:20] DEPRECATION WARNING: please use MorganGenerator
../_images/02da74debbd76e7fa329907172bbf16b450c7ae7ae4e72faf6bf31b3c65b6eb9.png

In the second example, psilocin is compared to serotonin. The image here is different, with the amine moeity of psilocin highlighted in pink. This signifies larger differences between the two molecules. Removing the amine moiety of psilocin could potentially increase similarity to serotonin.

draw = Draw()
img = draw.similarity_maps(serotonin, psilocin)
img.save('../img/psilocin.png')
img
[15:36:20] DEPRECATION WARNING: please use MorganGenerator
[15:36:20] DEPRECATION WARNING: please use MorganGenerator
../_images/1bde27d5ab569382f7d316e1bf0e7d171a3f276b92bcf37c06c7748136af733d.png

Comparing mescaline to serotonin shows a similar fingerprint, with pink highlights to the methoxy moieties.

img = draw.similarity_maps(serotonin, mescaline)
img.save('../img/mescaline.png')
img
[15:36:20] DEPRECATION WARNING: please use MorganGenerator
[15:36:20] DEPRECATION WARNING: please use MorganGenerator
../_images/94518092308fac234cd26725204b81900aef0b4899267ad3077d64b1f63f9815.png