Hi Jim,
Would it not be easier to use a recursive SMARTS, so that you only count
the carbon atoms? Something like [$([C,c]Cl)]-,=,:[$([C,c]Cl)], or, more
compactly [$([#6]Cl)]~[$([#6]Cl)]. I haven't tested these, as I'm not
close to a suitably equipped computer, but you should be able to get the
Jim,
I'm a bit confused by what you're trying to do.
Maybe we can try simplifying. What would you like to have returned for each
of these SMILES:
1) ClC=CCl
2) ClC(Cl)=CCl
3) ClC(Cl)=C(Cl)Cl
If the answer is the same between 1) and 2), but different for 3), then the
next question will be:
You can use Chem.CanonicalRankAtoms to de-duplicate the SMARTS matches
based upon the atom symmetry like this:
def count_unique_substructures(smiles, smarts):
mol = Chem.MolFromSmiles(smiles)
ranks = list(Chem.CanonicalRankAtoms(mol, breakTies=False))
pattern =
I think you probably used a slightly different SMILES than the one you
showed. The one you showed should have given ((0,1,3,4),(2,1,3,4)).
The proper merge rule would then be to consider all matches equivalent if
the 2nd and 3rd atom in the match agree, in any order; i.e, the two
carbons, indices
RDkit Discussion Group,
I have written a SMARTS to detect vicinal chlorine groups
using RDkit. There are 4 atoms involved in a vicinal chlorine group.
SMARTS = '[Cl]-[C,c]-,=,:[C,c]-[Cl]'
I am trying to count the number of ("unique") occurrences of this
pattern.
For some
5 matches
Mail list logo