Replies: 1 comment 1 reply
-
@Bellsteam Generic groups currently only work from atoms which have a single bond to them, so this case where you are trying to match an unknown number of atoms in the middle of the molecule cannot work. One possibility for how to approximate this would be to use a link node and the RDKit's generalized substructure search features:
There's a bit more info about that here: https://greglandrum.github.io/rdkit-blog/posts/2023-10-17-release-new-stuff-1.html#generalized-substructure-search If you want to indicate that the linking atoms have alkyl groups attached, you could use an SRU group:
But that will not work if you don't have extra substituents on the alkyl chains |
Beta Was this translation helpful? Give feedback.
-
I have written a piece of code, hoping to verify whether a Smiles or Smart containing a Genericgroup matches a Smiles structure. However, using the following code always returns false. How can I modify the code to achieve this goal?
from rdkit import Chem
smiles1 = "C1CCC(CC1)*C1=CC=CC=C1 |$;;;;;;Alkyl_p;;;;;;$|"
smiles2 = "C(CC1CCCCC1)CC1=CC=CC=C1"
mol1 = Chem.MolFromSmiles(smiles1)
mol2 = Chem.MolFromSmiles(smiles2)
if mol1 is None or mol2 is None:
print("error")
else:
Beta Was this translation helpful? Give feedback.
All reactions