Chem.SanitizeMol removes aromaticity tag from smarts Mol #6663
Replies: 3 comments 2 replies
-
I think you are asking a bit much from sanitization. Sanitization really requires a physically reasonable molecule. That being said, the RDKit is largely based on the daylight smiles model, so let's take a look at what you are really doing, first by converting your query to a molecule and then to a smiles string:
What this is converted to in smiles-land are dummy atoms connected by aromatic bonds. In SMILES there is no concept of an aromatic dummy atom so this gets stripped. However, if we read the smiles we just made back into a smarts pattern:
It still matches aromatic atoms so all is good. I think an important concept in SMARTS which is kind of the opposite in SMILES is that the matches are controlled by what you are explicitly set to, otherwise you still match. I.e. if you don't say you are explicitly aliphatic or aromatic, you will match both. |
Beta Was this translation helpful? Give feedback.
-
Hi Brian, Thank you for your explanation. That's helpful! Jocelyn |
Beta Was this translation helpful? Give feedback.
-
I've made this a discussion, because it's not a bug (the RDKit is behaving as intended), but the discussion is good to have. It may be possible to do what you want another way: why are you trying to sanitize the molecules constructed from SMARTS? |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
When creating a
mol
object with MolFromSmarts, the aromaticity tag of atoms is removed byChem.SanitizeMol
.To Reproduce
Before the sanitization, GetIsAromatic() returns True; After
Chem.SanitizeMol(mol)
, GetIsAromatic() returns FalseI can confirm that this issue does not occur if we remove
Chem.SanitizeMol(mol)
or if we havemol = Chem.MolFromSmiles('c1ccccc1')
Expected behavior
I would expect GetIsAromatic() should not change before & after sanitization:
Screenshots
Configuration (please complete the following information):
Additional context
Add any other context about the problem here.
Beta Was this translation helpful? Give feedback.
All reactions