Dear Abhinav, Please direct RDKit questions to the rdkit-discuss list instead of me personally.
On Tue, Jul 28, 2009 at 8:56 PM, Abhinav Chawade<[email protected]> wrote: > > I am using rdkit to generate SMILES database using SMIRKS. Is it possible to > use reactant side of SMIRKS as SMARTS for substructure matching? I tried to > create a vector of SMILES, and apply SMIRKS (as reaction SMARTS) to them. > Whenever there is a mismatch, rdkit throws an exception and stops > processing. Is there a way to skip the mismatch and apply reaction to only > the matching SMILES? I have a huge database of SMILES and SMIRKS. But if > there is one mismatch, it stops processing. Is there a way to automate > substructure matching and reaction processing? Like ChemDB's reaction > processor. The reaction matcher should not be generating an exception if it can't apply a reaction, it just returns an empty set of products: [3]>>> rxn = AllChem.ReactionFromSmarts('[C:1](=[O:2])[O:3]>>[C:1](=[O:2])[N:3]') [4]>>> ps = rxn.RunReactants((Chem.MolFromSmiles('CC(=O)OCCC'),)) [5]>>> ps Out[5] ((<rdkit.Chem.rdchem.Mol object at 0xa4d617c>,),) [6]>>> Chem.MolToSmiles(ps[0][0]) Out[6] 'CCCNC(=O)C' [7]>>> ps = rxn.RunReactants((Chem.MolFromSmiles('CC(=O)NCCC'),)) [8]>>> ps Out[8] () So you just need to test the return value from RunReactants to make sure it's not empty. does this answer the question? -greg

