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 <[email protected]> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss