Hi everyone,
Is there a way to get a substructure match of regioisomers using a smarts by separating the fragments with “.”: The following approach works but is too permissive since it will also match structures with a bromide or a chloride linked to a aliphatic carbon... [image: image.png] mol_smiles_structure = Chem.MolFromSmiles("Clc1cc(Br)ccc1") mol_smarts_fragment = Chem.MolFromSmarts("c1ccccc1.[Cl].[Br]") print(mol_smiles_structure.HasSubstructMatch(mol_smarts_fragment)) ð True mol_smiles_structure = Chem.MolFromSmiles("ClCc1cc(Br)ccc1") print(mol_smiles_structure.HasSubstructMatch(mol_smarts_fragment)) ð True If I specify that the Br and the Cl need to be attached to an aromatic to make it less permissive, it no longer match because I cannot specify that the two general aromatics [a] also belong to the benzene ring... (i,e. it tries to look for 8 aromatics instead of six...) mol_smiles_structure = Chem.MolFromSmiles("Clc1cc(Br)ccc1") mol_smarts_fragment = Chem.MolFromSmarts("c1ccccc1.[a][Cl].[a][Br]") print(mol_smiles_structure.HasSubstructMatch(mol_smarts_fragment)) ð False Thanks! Alexis
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss