Dear Francesco,

I think you can highlight each molecules using highlightAtomLists option.
I wrote an example.
Following code was written in IPython notebook.

'''
from rdkit import Chem
from rdkit.Chem import rdBase
from rdkit.Chem import Draw
from rdkit.Chem.Draw import IPythonConsole
from rdkit import RDConfig
import os
sdf = Chem.SDMolSupplier(  os.path.join( RDConfig.RDDocsDir,
'Book/data/cdk2.sdf' ) )
mols = [  m for m in sdf ]
core = Chem.MolFromSmiles( 'c1ncc2nc[nH]c2n1' )
# highlightAtomLists is list of atom list that you want to highlight.
Draw.MolsToGridImage( mols, molsPerRow=3, highlightAtomLists=[
mol.GetSubstructMatch(core) for mol in mols] )
#The code will draw molecules with highlighted core structure.
'''

Kind regards,
Takayuki


2016年6月17日(金) 21:32 Francesco Del Carratore <francescod...@gmail.com>:

> Dear All,
> I just started using RDKit, and I am having some troubles using
> Draw.MolsToGridImage.
> I have a number of SMILES. My Aim is to plot them in the same file while
> highlighting a particular substructure (I have the SMILES for it as well).
> I managed to create the image with all the compounds with the following:
>
> for i in range(0,len(SMILES)-1):
>     ms[i] = Chem.MolFromSmiles(SMILES[i], sanitize=False)
>     ms[i].SetProp("_Name", compNAMES[i])
>
> from rdkit.Chem import Draw
> import image
> img=Draw.MolsToGridImage(ms,molsPerRow=4,subImgSize=(800,800),
> legends=[x.GetProp("_Name") for x in ms] )
> img.save('/home/image.png')
>
> I know for sure that the substructure (called MCS) is found in all the
> compounds.
> in fact ms[i].HasSubstructMatch(MCS) gives me True for any i
> How could I highlight the substructure in the image in each compound?
> is it possible?
> Thanks in advance for your help
> Best Wishes,
> Francesco
>
>
> --
> Francesco Del Carratore
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning
> reports. http://sdm.link/zohomanageengine
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://sdm.link/zohomanageengine
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to