Guillaume,

Here's how to read in a molecule and skip aromaticity perception:

In [12]: m =
Chem.MolFromSmiles('c1ccccc1-c1cccnc1-c1cc[nH]c1',sanitize=False)

In [13]:
Chem.SanitizeMol(m,sanitizeOps=Chem.SANITIZE_ALL^Chem.SANITIZE_SETAROMATICITY)
Out[13]: rdkit.Chem.rdmolops.SanitizeFlags.SANITIZE_NONE

In [14]: Chem.MolToSmiles(m)
Out[14]: 'C1=CC=C(C2=CC=CN=C2C2=CNC=C2)C=C1'


Then you need to find all of the benzene-like rings and set the appropriate
flags:

In [16]: def set_aroms(m,pattern='[#6]1=[#6][#6]=[#6][#6]=[#6]1'):
    ...:     p = Chem.MolFromSmarts(pattern)
    ...:     matches = m.GetSubstructMatches(p)
    ...:     for match in matches:
    ...:         for mi in match:
    ...:             m.GetAtomWithIdx(mi).SetIsAromatic(True)
    ...:         for bond in p.GetBonds():
    ...:             mb =
m.GetBondBetweenAtoms(match[bond.GetBeginAtomIdx()],match[bond.GetEndAtomIdx()])
    ...:             assert mb
    ...:             mb.SetBondType(Chem.BondType.AROMATIC)
    ...:             mb.SetIsAromatic(True)
    ...:
    ...:

In [17]: set_aroms(m)

In [18]: Chem.MolToSmiles(m)
Out[18]: 'C1=CN=C(C2=CNC=C2)C(c2ccccc2)=C1'



Note that the RDKit does have a simplified aromaticity model available out
of the box that only recognizes aromaticity in 5- and 6- rings, but this
isn't quite as simple as what you're looking for.

Best,
-greg


On Tue, Sep 20, 2016 at 6:52 AM, Guillaume GODIN <
guillaume.go...@firmenich.com> wrote:

> Dear All,
>
>
> I would like to kekulize the molecule, but only conserve the aromaticity
> knowledge of C6 (benzene like)  type rings
>
>
> So what to need to do after this command?
>
>
> Chem.rdmolops.Kekulize(mol, clearAromaticFlags=True)
>
>
> Should I need to store benzene like location before the Kekulize process
> and restore it after and How to restore it (SetIsAromatic of atoms as true
> and change bondtype )?
>
>
> best regards,
>
>
> Guillaume GODIN
>
> **********************************************************************
> DISCLAIMER
> This email and any files transmitted with it, including replies and
> forwarded copies (which may contain alterations) subsequently transmitted
> from Firmenich, are confidential and solely for the use of the intended
> recipient. The contents do not represent the opinion of Firmenich except to
> the extent that it relates to their official business.
> **********************************************************************
>
> ------------------------------------------------------------
> ------------------
>
> _______________________________________________
> 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

Reply via email to