Several reaction steps handling in RDKit

I want to make molecule using several reaction steps.
My situation was focused in substituted phenyl ring.
Greg who is Developer of RDKit posted great blog post before.
So, I read the post and try to make sample code.

My strategy is run reaction and get products as smiles because products of RunReactants need to sanitize( this is key step. Thanks for RDKit discuss for advice. 🙂 ) when products take to next step.

Sample snippet I wrote was following….

import sys
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem.Draw import IPythonConsole

#start sys.argv[1]

def aromaticsubstitution( smi ):
    smarts = "[cH&$(c(c)c):2]>>[c:2]{}".format( smi )
    rxn = AllChem.ReactionFromSmarts( smarts )
    return rxn

def runreaction( list_smiles, rxn ):
    mols = [ Chem.MolFromSmiles( smi ) for smi in list_smiles ]
    products = set()
    for mol in mols:
        ps = rxn.RunReactants( (mol,) )
        for x in ps:
            products.add( Chem.MolToSmiles( x[0], isomericSmiles=True ) )
    return products
# Define any substitution pattern user want to use.
rxnF = aromaticsubstitution( "(F)" )
rxnCl = aromaticsubstitution( "(Cl)" )
rxnOMe = aromaticsubstitution( "(OC)" )

Next run the reaction.

#1st round
monoCl = runreaction( ["N#Cc1ccccc1"], rxnCl )
#2nd round
diCl = runreaction( monoCl, rxnCl )
#3rd round
triCl = runreaction( diCl, rxnCl )
[/sourcecode ]

Check the results.

mols = []
for i in [ monoCl, diCl, triCl ]:
    for j in i:
        mols.append( Chem.MolFromSmiles(j) )
# All code run on IPython, so Molecules can visualise Grid image. 
from rdkit.Chem import Draw
Draw.MolsToGridImage( mols, molsPerRow=6 )


Works fine.
Using same protocol, I will make substituted phenyl rings MECE.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s