Look at the following example:

import gi
from rdkit import Chem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import SimilarityMaps
import matplotlib.pyplot as plt
mol =
Chem.MolFromSmiles('COc1cccc2cc(C(=O)NCCCCN3CCN(c4cccc5nccnc54)CC3)oc21')
refmol = Chem.MolFromSmiles('CCCN(CCCCN1CCN(c2ccccc2OC)CC1)Cc1ccc2ccccc2c1')
fp = SimilarityMaps.GetAPFingerprint(mol, fpType='normal')
fig, maxweight = SimilarityMaps.GetSimilarityMapForFingerprint(refmol, mol,
SimilarityMaps.GetMorganFingerprint)
plt.show()

This displays similarity map. Unfortunately the image is not scaled to fit
available area and it's not centered. This cases problems with mpld3
library, which converts matplotlib to javascript:

from rdkit import Chem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import SimilarityMaps
import mpld3
mol =
Chem.MolFromSmiles('COc1cccc2cc(C(=O)NCCCCN3CCN(c4cccc5nccnc54)CC3)oc21')
refmol = Chem.MolFromSmiles('CCCN(CCCCN1CCN(c2ccccc2OC)CC1)Cc1ccc2ccccc2c1')
fp = SimilarityMaps.GetAPFingerprint(mol, fpType='normal')
fig, maxweight = SimilarityMaps.GetSimilarityMapForFingerprint(refmol, mol,
SimilarityMaps.GetMorganFingerprint)
mpld3.show_d3(fig)

Again, the image is much larger then drawing area and is not aligned.

I've tried several options: changing coordScale or scale parameter but
without success. Any help in displaying the image correctly usiing
plt.show() and/or mpld3.show_d3 would be appreciated.

Regards,
Michal Nowotka
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to