Hi Greg, I see what I was doing wrong, I had put the ring closures inside the brackets when I was mapping the atoms. (Which explains why I didn't see any output there). That was simple error on my side, thanks so much Greg!! Matt
On Mon, Sep 21, 2015 at 11:32 PM, Greg Landrum <greg.land...@gmail.com> wrote: > Hi Matt, > > The problem is that you haven't included any atom mapping information that > allows the RDKit to know what to do with the reactants you provide. > > Here's a short demo of what you're doing: > > In [11]: rxn = AllChem.ReactionFromSmarts('C=C1CC=CC=C1>>Cc1ccccc1') > > In [12]: ps = rxn.RunReactants((Chem.MolFromSmiles('C=C1CC=CC=C1'),)) > [02:28:59] reactant 0 has no mapped atoms. > [02:28:59] product 0 has no mapped atoms. > > In [13]: Chem.MolToSmiles(ps[0][0]) > Out[13]: 'Cc1ccccc1' > > In [14]: ps = rxn.RunReactants((Chem.MolFromSmiles('CC=C1C(F)C=CC=C1'),)) > > In [15]: Chem.MolToSmiles(ps[0][0]) > Out[15]: 'Cc1ccccc1' > > > (notice the warning after line [12]) > > And here's how to fix it: > > In [16]: rxn = > AllChem.ReactionFromSmarts('[C:1]=[C:2]1[C:3][C:4]=[C:5][C:6]=[C:7]1>>[C:1][c:2]1[c:3][c:4][c:5][c:6][c:7]1') > > In [17]: ps = rxn.RunReactants((Chem.MolFromSmiles('C=C1CC=CC=C1'),)) > > In [18]: Chem.MolToSmiles(ps[0][0]) > Out[18]: 'Cc1ccccc1' > > In [19]: ps = rxn.RunReactants((Chem.MolFromSmiles('CC=C1C(F)C=CC=C1'),)) > > In [20]: Chem.MolToSmiles(ps[0][0]) > Out[20]: 'CCc1ccccc1F' > > > I hope that helps, > -greg > > > > On Mon, Sep 21, 2015 at 4:41 PM, Matthew Lardy <mla...@gmail.com> wrote: > >> I've repeated the previously seen behavior in Python in case anyone would >> like to take a look there. I am trying to clean a dirty library from a >> vendor and I just want to re-aromatize these molecules. Sorry that the >> code looks so ugly, but the output is exactly the same. >> >> Thanks! >> Matt >> >> Output (not to file): >> Cc1ccccc1 >> Cc1ccccc1 >> .... >> Cc1ccccc1 >> Cc1ccccc1 >> >> The code that generated it: >> #!/usr/bin/python >> >> from rdkit import Chem >> from rdkit.Chem import AllChem,Draw >> from rdkit.Chem import ChemicalFeatures >> from rdkit import RDConfig >> import os >> import sys >> import gzip >> >> suppl = Chem.SDMolSupplier('w.sdf') >> rxn = AllChem.ReactionFromSmarts('C=C1CC=CC=C1>>Cc1ccccc1') >> >> gz = gzip.open('output.sdf.gz', 'w+') >> writer = Chem.SDWriter(gz) >> >> for m in suppl: >> if not m: continue >> ps = rxn.RunReactants((m,)) >> if (len(ps) > 0): >> # uniq = set([Chem.MolToSmiles(x[0],isomericSmiles=True) for x in >> ps]) >> print Chem.MolToSmiles(ps[0][0]) >> #for p in uniq: >> # print Chem.MolToSmiles(p) >> #for prod in uniq: >> # writer.write(prod) >> else: >> writer.write(m) >> writer.close() >> gz.close() >> >> >> On Mon, Sep 21, 2015 at 12:39 PM, Matthew Lardy <mla...@gmail.com> wrote: >> >>> Hi all, >>> >>> I am attempting to transform a functional group in a series of >>> molecules. The reaction is pretty simple (a re-aromatization): >>> >>> C=C1CC=CC=C1>>Cc1ccccc1 >>> >>> The code which generates this runs without error (and it was written in >>> Java). What I don't understand is that the products of the reaction are >>> just Cc1ccccc1. The rest of the molecule is completely missing. Trying to >>> map these atoms didn't reproduce the error, it did not run. Is there a >>> trick to simply run something like this on every occurrence in a molecule? >>> >>> Thanks in advance, and my code fragment is below, >>> Matt >>> >>> Here is my code: >>> >>> SDMolSupplier suppl1 = new >>> SDMolSupplier(cParser.getValue("-in")); >>> ROMol rdmol; >>> //String line = ""; >>> >>> while (!suppl1.atEnd()) >>> { >>> try { >>> rdmol = suppl1.next(); >>> molId++; >>> >>> ROMol_Vect reacts = new ROMol_Vect(); >>> reacts.add(rdmol); >>> >>> String ID = rdmol.getProp("_Name"); >>> System.err.println("MOL_ID: " + ID); >>> ROMol_Vect_Vect prods = umr.runReactants(reacts); >>> >>> >>> System.out.println("Reagents: " + reacts.size()); >>> System.err.println("Product AMT: " + prods.size()); >>> if (prods.size() < 1) { >>> // Write out untransformed molecules if they don't >>> have the pattern >>> //writer.write(rdmol); >>> ; >>> } else { >>> for (int i = 0; i < prods.size(); i++) >>> { >>> System.err.println("In here finally"); >>> prods.get(i).get(0).setProp("_Name",ID); >>> // Why am I getting the query back to me? >>> writer.write(prods.get(i).get(0)); >>> } >>> } >>> } catch (Exception e) { >>> System.err.println(e); >>> } catch (Error e) { >>> System.err.println(e); >>> } >>> } >>> >>> >>> >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> Rdkit-discuss mailing list >> Rdkit-discuss@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >> >> >
------------------------------------------------------------------------------
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss