Dear Hongbin,

I am afraid The SMARTS you are using is not valid, as no SSSR can have less than 3 terms, or it wouldn't be a ring. If you change[a!r0] into, for instance, [a!r3], then you'll find the match you are looking for.

Cheers,
p.

On 27/10/2016 09:36, 杨弘宾 wrote:
Hi,
I tryied using rdkit to match fragments with compounds only to find that rdkit performed not well in SMARTS. The following is the notebook I worked.

from  rdkit  import  Chem
from  rdkit.Chem  import  AllChem
from  rdkit.Chem  import  FragmentMatcher
from  rdkit.Chem.Draw  import  IPythonConsole
In [49]:
p  =  FragmentMatcher.FragmentMatcher()
p.Init('[a!r0][NX3+](=[OX1])([O-])')
In [50]:
mol   =  Chem.MolFromSmiles('c1ccccc1[N+](=O)[O-]')
mol
Out[50]:
In [51]:
p.HasMatch(mol)
Out[51]:
0
In [52]:
print  Chem.MolFromSmarts('[a!r0][NX3+](=[OX1])([O-])')
None
However, openbabel worked well in matching the substrcutre. Even "or operator" was avaiable such as "[a!r0][$([NX3+](=[OX1])([O-])),$([NX3](=O)=O)]".

>>> s=pybel.Smarts('[a!r0][NX3+](=[OX1])([O-])')
>>> s=pybel.Smarts('[a!r0][NX3+](=[OX1])([O-])')
>>> a=pybel.readstring('smi','c1ccccc1[N+](=O)[O-]')
>>> s.findall(a)
[(6, 7, 8, 9)]

It is a pity that rdkit can calculate the topological distance between two atoms while it cannot match the fragments... Is there any better API which I didn't find?


------------------------------------------------------------------------
Hongbin Yang 杨弘宾
Research: Toxicophore and Chemoinformatics
Pharmaceutical Science, School of Pharmacy
East China University of Science and Technology


------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive.
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik


_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to