substructureMatcher - get count of non equivalent same groups

42 views
Skip to first unread message

Karen Karapetyan

unread,
Jun 15, 2012, 5:49:59 PM6/15/12
to indigo-...@googlegroups.com
There is a need to get count of non-equivalent same groups in molecule. As you know same functional groups can be not equivalent by their environment  (like S- in the attached file) .
Could you please advise how to :

a) get count of non-equivalent same groups?
b) iterate through same equivalent groups

When I applied IndigoObject.countMatches and iterateMatches to the attached molecule with SMARTS "c[S-]" I get all 3 matches without regards of uniqueness, though the meta-S- groups on both sides of fluorine are equivalent but differ from 3rd S- on the other benzene ring.

Thanks.


miltiple_OSO3H_2_S-.mol

Mikhail Rybalkin

unread,
Jun 16, 2012, 4:37:56 AM6/16/12
to indigo-...@googlegroups.com
Hello Karen,

It seems strange because you have a query "c[S-]" that contains aromatic carbon and it cannot match the third "S" at least because there are no carbons near it.
I wrote a simple test script in python, and it is attached. The output is also attached and it shows that there are 2 matchings.

Could you check your code, and provide us a code snippet that reproduces such behavior?

Best regards,
Mikhail
test.py
output.txt

Karen Karapetyan

unread,
Jun 17, 2012, 6:46:28 AM6/17/12
to indigo-...@googlegroups.com
I am sorry - a wrong file was attached. Correct one is attached with 3 S- groups attached to aromatic carbons. Note that two of S- groups that are in orto positions to fluorine are equivalent and 3rd one is not.  There could be more complex cases when same functional group could be equivalent or not.

So, in general, is there a way/API to distinguish equivalent matches when iterating through all same groups by IndigoObject.iterateMatches ?
miltiple_OSO3H_3_S-.mol

Mikhail Rybalkin

unread,
Jun 20, 2012, 5:50:34 AM6/20/12
to indigo-...@googlegroups.com
Hello Karen,

Here is a link to the next version of Indigo 1.1.1 where such functionality is implemented: http://ggasoftware.com/accept?file=indigo-1.1.1%2Findigo-dotnet-1.1.1-win.zip

Now the molecule object has a method symmetryClasses() that returns an array with a symmetry class ID for each atom.

To get an atom class you can just get the value for the corresponding index. Here is a code in Python, that prints symmetry classes for all atoms:

classes = m.symmetryClasses()
for a in m.iterateAtoms():
print(" %d: %d" % (a.index(), classes[a.index()]))

Symmetric atoms has the same class number. You can use this information to iterate over substructure matchers and check if query atom is mapped to an different symmetry class each time.

qa = query.getAtom(0)
classes[match.map(qa).index()] <- this gives you a symmetry class for a mapped atom

Let me know, if such solution works for you or not.

Best regards,
Mikhail
Reply all
Reply to author
Forward
0 new messages