Well, here's a way to find the rings where all of the bonds are conjugated:
In [1]: from rdkit import Chem
In [2]: m = Chem.MolFromSmiles('C1CC1CC(=O)c1nnc2cc(-c3ccc(OC)cc3)nn2c1CC')
In [3]: ri = m.GetRingInfo()
In [4]: brs = ri.BondRings()
In [5]: conjugatedRings = []
In [6]: for i,br in enumerate(brs):
conj=True
for b in br:
if not m.GetBondWithIdx(b).GetIsConjugated():
conj=False
break
if conj:
conjugatedRings.append(i)
...:
Then, using those indices, you can find the lists of atoms that are in each
of those conjugated rings:
In [7]: ars = ri.AtomRings()
In [8]: conjugatedAtomRings = [ars[x] for x in conjugatedRings]
In [9]: len(ars)
Out[9]: 4
In [10]: len(conjugatedAtomRings)
Out[10]: 3
In [11]: conjugatedAtomRings
Out[11]: [(7, 8, 9, 21, 22, 6), (10, 9, 21, 20, 11), (13, 14, 15, 18, 19,
12)]
>From this point it's a matter of deciding how you want to count electrons
from each atom. The approach used in the RDKit C++ code is described, more
or less accurately, here:
http://rdkit.org/docs/RDKit_Book.html#aromaticity
-greg
On Thu, Aug 27, 2015 at 5:36 PM, Yingfeng Wang <[email protected]> wrote:
> Greg,
>
> Thanks. I believe identifying anti-aromatic bonds even just with simple
> rings will be very helpful to my project. Could you please give me some
> links or sample codes about identifying all the conjugated simple rings and
> do an electron count? Would you also like to share me some relevant rules
> you think could be reasonable?
>
> By the way, if there is a hard way to identify all anti-aromatic bonds,
> could you also please give me some hints? If fortunately I can implement
> it, I will share it by posting my code in this mailing list.
>
>
> Thanks.
>
> Yingfeng
>
> On Thu, Aug 27, 2015 at 10:08 AM, Greg Landrum <[email protected]>
> wrote:
>
>> Hi Yingfeng,
>>
>> Non-aromatic is not a problem, but there's no easy way I can think of off
>> the top of my head for identifying anti-aromatic systems without making C++
>> code changes.
>>
>> If you were willing to limit yourself to simple rings, you could write
>> some python code to identify all the conjugated simple rings and do an
>> electron count according to whatever rules you think are relevant.
>>
>> -greg
>>
>>
>> On Thu, Aug 27, 2015 at 1:52 PM, Yingfeng Wang <[email protected]>
>> wrote:
>>
>>> Could anyone please share your experience with identifying non-aromatic
>>> bonds using RDKit? I would greatly appreciate your help.
>>>
>>> Yingfeng
>>>
>>>
>>> On Mon, Aug 24, 2015 at 9:42 PM, Yingfeng Wang <[email protected]>
>>> wrote:
>>>
>>>> Sorry, my previous email has a typo.
>>>>
>>>> According to the following link,
>>>>
>>>> http://www.rdkit.org/docs/RDKit_Book.html
>>>>
>>>> I get sample code for identifying aromatic bonds like
>>>>
>>>> >>> from rdkit import Chem
>>>> >>> m=Chem.MolFromSmiles('O=C1C=CC(=O)C2=C1OC=CO2')
>>>> >>> m.GetBondBetweenAtoms(6,7).GetIsAromatic()
>>>>
>>>> Is there a way to identify anti-aromatic bonds using Rdkit?
>>>>
>>>> Thanks.
>>>>
>>>> Yingfeng
>>>>
>>>> On Mon, Aug 24, 2015 at 9:38 PM, Yingfeng Wang <[email protected]>
>>>> wrote:
>>>>
>>>>> According to the following link,
>>>>>
>>>>> http://www.rdkit.org/docs/RDKit_Book.html
>>>>>
>>>>> I get sample code for identifying identify anti-aromatic bonds like
>>>>>
>>>>> >>> from rdkit import Chem
>>>>> >>> m=Chem.MolFromSmiles('O=C1C=CC(=O)C2=C1OC=CO2')
>>>>> >>> m.GetBondBetweenAtoms(6,7).GetIsAromatic()
>>>>>
>>>>> Is there a way to identify anti-aromatic bonds using Rdkit?
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Yingfeng
>>>>>
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Rdkit-discuss mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>
>>>
>>
>
------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss