Re: [Rdkit-discuss] problem matching SMART pattern

2022-08-29 Thread Alfredo Quevedo
Thank you very much Scott for pointing this issue, I did not noticed 
that the problem was originated in the SMILES parsing,


kind regards

Alfredo

On 28/8/22 21:57, Scott Harrison wrote:

Hi Alfredo,

After parsing the SMILES strings of your molecules the RDKit considers all of 
the atoms of your triazole to be aromatic, which you can see in the SMILES 
string created from parsing your query molecule and regenerating its RDKit 
SMILES string.  I've included a simple template query that works below, which 
you could be made more specific with additional SMARTS features as you like.


from rdkit import Chem
query = 'N1N=NC=C1'
mol = Chem.MolFromSmiles(query)
Chem.MolToSmiles(mol)

'c1c[nH]nn1'

template = 'n1nncc1'
mol.HasSubstructMatch(Chem.MolFromSmarts(template))

True

specific_template = '[n&D2]1[n&D2][n&D2][c][c]1'
mol.HasSubstructMatch(Chem.MolFromSmarts(specific_template))

True

Cheers,
Scott

-Original Message-
From: Alfredo Quevedo  
Sent: Sunday, August 28, 2022 7:09 PM

To: RDKit Discuss
Subject: [Rdkit-discuss] problem matching SMART pattern

Dear users,

I am trying to math a triazole scaffold using SMARTS notation. My code is shown 
below:

query = 'N1N=NC=C1'
template = '[NX3H1]1[N]=[N][C]=[C]1'
mol = Chem.MolFromSmiles(query)
mol.HasSubstructMatch(Chem.MolFromSmarts(template))

This results in 'False'. By depicting the structures I can see that the SMARTS 
pattern is not including the explicit hydrogen in the structure.
However as long as I understand I am indicating the nitrogen atom to contain 
the explicit hydrogen ('[NX3H1]'). However the structure is show as aromatic.

Can anyone suggest what is wrong with my code? the SMARTS pattern or some 
keyword to make hydrogens explicit?

thanks in advance for the support,

regards

Alfredo



___
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

--
*Dr. Alfredo Quevedo,*
Faculty of Chemical Sciences,
National University of Córdoba,
Argentina.
TE: +54 351 5353850 int 55437___
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] problem matching SMART pattern

2022-08-28 Thread Scott Harrison
Hi Alfredo,

After parsing the SMILES strings of your molecules the RDKit considers all of 
the atoms of your triazole to be aromatic, which you can see in the SMILES 
string created from parsing your query molecule and regenerating its RDKit 
SMILES string.  I've included a simple template query that works below, which 
you could be made more specific with additional SMARTS features as you like. 

>>> from rdkit import Chem
>>> query = 'N1N=NC=C1'
>>> mol = Chem.MolFromSmiles(query)
>>> Chem.MolToSmiles(mol)
'c1c[nH]nn1'
>>> template = 'n1nncc1'
>>> mol.HasSubstructMatch(Chem.MolFromSmarts(template))
True
>>> specific_template = '[n&D2]1[n&D2][n&D2][c][c]1'
>>> mol.HasSubstructMatch(Chem.MolFromSmarts(specific_template))
True

Cheers,
Scott

-----Original Message-
From: Alfredo Quevedo  
Sent: Sunday, August 28, 2022 7:09 PM
To: RDKit Discuss 
Subject: [Rdkit-discuss] problem matching SMART pattern

Dear users,

I am trying to math a triazole scaffold using SMARTS notation. My code is shown 
below:

query = 'N1N=NC=C1'
template = '[NX3H1]1[N]=[N][C]=[C]1'
mol = Chem.MolFromSmiles(query)
mol.HasSubstructMatch(Chem.MolFromSmarts(template))

This results in 'False'. By depicting the structures I can see that the SMARTS 
pattern is not including the explicit hydrogen in the structure. 
However as long as I understand I am indicating the nitrogen atom to contain 
the explicit hydrogen ('[NX3H1]'). However the structure is show as aromatic.

Can anyone suggest what is wrong with my code? the SMARTS pattern or some 
keyword to make hydrogens explicit?

thanks in advance for the support,

regards

Alfredo



___
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


[Rdkit-discuss] problem matching SMART pattern

2022-08-28 Thread Alfredo Quevedo

Dear users,

I am trying to math a triazole scaffold using SMARTS notation. My code 
is shown below:


query = 'N1N=NC=C1'
template = '[NX3H1]1[N]=[N][C]=[C]1'
mol = Chem.MolFromSmiles(query)
mol.HasSubstructMatch(Chem.MolFromSmarts(template))

This results in 'False'. By depicting the structures I can see that the 
SMARTS pattern is not including the explicit hydrogen in the structure. 
However as long as I understand I am indicating the nitrogen atom to 
contain the explicit hydrogen ('[NX3H1]'). However the structure is show 
as aromatic.


Can anyone suggest what is wrong with my code? the SMARTS pattern or 
some keyword to make hydrogens explicit?


thanks in advance for the support,

regards

Alfredo



___
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss