Dear All,
In case it helps, there is a wealth of functional groups already in RDKit
available here:
https://github.com/rdkit/rdkit/blob/master/Data/Functional_Group_Hierarchy.txt
For instance, the functional group halogen pattern we use is a bit more
complicated:
[$([F,Cl,Br,I]-!@[#6]);!$([F,Cl,Br,I]-!@C-!@[F,Cl,Br,I]);!$([F,Cl,Br,I]-[C,S](=[O,S,N]))]
That can (1) help you write your own patterns and (2) be used (from python)
as follows:
from __future__ import print_function
from rdkit import Chem
from rdkit.Chem import FilterCatalog
queryDefs = FilterCatalog.GetFlattenedFunctionalGroupHierarchy()
smiles = "ClC1=CC(C2NCCOC2)=C(C=CC=C3)C3=C1"
mol = Chem.MolFromSmiles(smiles)
items = sorted(queryDefs.items())
for name, pat in items:
print("%s\t%s"%(name, mol.HasSubstructMatch(pat)))
AcidChloride False
AcidChloride.Aliphatic False
AcidChloride.Aromatic False
Alcohol False
Alcohol.Aliphatic False
Alcohol.Aromatic False
Aldehyde False
Aldehyde.Aliphatic False
Aldehyde.Aromatic False
Amine True
Amine.Aliphatic True
Amine.Aromatic False
Amine.Cyclic True
Amine.Primary False
Amine.Primary.Aliphatic False
Amine.Primary.Aromatic False
Amine.Secondary True
Amine.Secondary.Aliphatic True
Amine.Secondary.Aromatic False
Amine.Tertiary False
Amine.Tertiary.Aliphatic False
Amine.Tertiary.Aromatic False
Azide False
Azide.Aliphatic False
Azide.Aromatic False
BoronicAcid False
BoronicAcid.Aliphatic False
BoronicAcid.Aromatic False
CarboxylicAcid False
CarboxylicAcid.Aliphatic False
CarboxylicAcid.AlphaAmino False
CarboxylicAcid.Aromatic False
Halogen True
Halogen.Aliphatic False
Halogen.Aromatic True
Halogen.Bromine False
Halogen.Bromine.Aliphatic False
Halogen.Bromine.Aromatic False
Halogen.Bromine.BromoKetone False
Halogen.NotFluorine True
Halogen.NotFluorine.Aliphatic False
Halogen.NotFluorine.Aromatic True
Isocyanate False
Isocyanate.Aliphatic False
Isocyanate.Aromatic False
Nitro False
Nitro.Aliphatic False
Nitro.Aromatic False
SulfonylChloride False
SulfonylChloride.Aliphatic False
SulfonylChloride.Aromatic False
TerminalAlkyne False
Cheers,
Brian
On Wed, May 17, 2017 at 9:20 AM, Alexis Parenty <
[email protected]> wrote:
> Hi Michal, thanks for your response.
> I think I made a typo somewhere in my previous code since it now works
> fine, even without the the kekule notation... Sorry about the confusion...
> Best,
>
> Alexis
>
> On 17 May 2017 at 13:59, Michal Krompiec <[email protected]>
> wrote:
>
>> Hi Alexis,
>> Try aromatic form instead of Kekule notation.
>> Best,
>> Michal
>>
>> On 17 May 2017 at 12:55, Alexis Parenty <[email protected]>
>> wrote:
>>
>>> Hi everyone,
>>>
>>> I am looking for substructure match between a smarts and a smiles, but I
>>> want any heteroatom from the smarts to match any heteroatom from a smiles:
>>>
>>>
>>> [image: Inline images 1]
>>>
>>>
>>>
>>>
>>>
>>> The following does not return what I would expect:
>>>
>>> smarts1 = " [F,Cl,Br,I]C1=CC(C2[N,O,S]CC[N,O,S]C2)=CC=C1"smiles2 = "
>>> ClC1=CC(C2NCCOC2)=C(C=CC=C3)C3=C1"
>>>
>>> mol1 = Chem.MolFromSmarts(smarts1)mol2 = Chem.MolFromSmiles(smiles2)
>>> *print*("mol1 is a substructure of mol2:
>>> {}".format(mol2.HasSubstructMatch(mol1) *print*("mol2 is a substructure of
>>> mol1: {}".format(mol1.HasSubstructMatch(mol2)))
>>>
>>>
>>>
>>> ð mol1 is a substructure of mol2: False
>>>
>>> ð mol2 is a substructure of mol1: False
>>>
>>> How could I do that?
>>>
>>>
>>>
>>> Thanks,
>>>
>>>
>>>
>>> Alexis
>>>
>>>
>>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Rdkit-discuss mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>
>>>
>>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss