Re: [Rdkit-discuss] symmetry class
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Greg L. <gre...@gm...> - 2011-08-04 05:52:13
|
Dear Alan, On Wed, Aug 3, 2011 at 10:58 PM, Alan Smith <ala...@gm...> wrote: > > I was just wondering if it there is a function to get the "symmetry class" > of an atom in a molecule using rdkit ? Just to clarify, what I mean by > "symmetry class" is that it is an arbitrary label for atoms that are > symmetrically equivalent in a molecule - so to identify atoms that are > symmetrically equivalent you just look for atoms that have the same symmetry > class. I hope that makes sense. There's not something exactly like that, but you can get the same information using the substructure matching machinery by finding all of the matches a molecule has to itself. Here's how (working code attached): def FindSymmetryClasses(m): equivs = defaultdict(set) matches = m.GetSubstructMatches(m,uniquify=False) for match in matches: for idx1,idx2 in enumerate(match): equivs[idx1].add(idx2) classes = set() for s in equivs.values(): classes.add(tuple(s)) return classes This is not the most efficient way of doing things for a large number of molecules (particularly high-symmetry molecules), but it does work. The RDKit code that does stereochemistry perception generates all the information required to more directly assign symmetry class information, but this code is currently only called for molecules that have either potential stereocenters or possible double bonds with stereochemistry. It's not currently possible to force this call from Python, but it would straightforward to add that. -greg |