SubstructureMatcher doesn't see match in a query molecule with ABS stereo-label and the same molecule with AND or OR stereo-label instead of ABS
- Dominant language
- C++
- Stars
- 406
- Forks
- 134
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 24
Description
**Summary**
SubstructureMatcher doesn't see match in a query molecule with ABS stereo-label on an atom and the same molecule with AND or OR stereo-label instead of ABS on the correspondent atom.
Described behavior is not aligned with 'Either' bond examples in the [user-manual-oracle](https://lifescience.opensource.epam.com/bingo/user-manual-oracle.html#substructure-search), so it looks like there is issue in the behavior or in the example from manual
**Steps to Reproduce**
***Preconditions / Preparation***
_Note: all mentioned here files can be found below in Attachments section_
Have two 'mol v3000' files:
- One with query molecule with ABS stereo-label on an atom: query.mol.txt (Please, remove extra txt extension before use)
- One with molecule with AND stereo-label on an atom: molecule.mol.txt (Please, remove extra txt extension before use)
***Steps***
1. Load query molecule using indigo.loadQueryMoleculeFromFile(path_to_query)
2. Load molecule using indigo.loadMoleculeFromFile(path_to_molecule).
3. Create SubstructureMatcher instance using indigo.substructureMatcher(molecule)
4. Check if match is found using: matcher.match(query).
***Example script***
```
from indigo import Indigo
query = indigo.loadQueryMoleculeFromFile("query.mol")
mol = indigo.loadMoleculeFromFile("molecule.mol")
matcher = indigo.substructureMatcher(mol)
if matcher.match(query):
print("Match found")
else:
print("No matches")
```
**Actual behavior**
SubstructureMatcher doesn't find any match: "No matches" is printed
**Expected behavior**
SubstructureMatcher finds a match: "Match found" is printed
Note: this behavior is assumed based on [user-manual-oracle](https://lifescience.opensource.epam.com/bingo/user-manual-oracle.html#substructure-search). Examples for 'Either' bond are designed with this behavior as expectation
**Environment details:**
- indigo: [commit 21eec00cfe8fb5f3174ee2d2f663262370f0c1a9](https://github.com/epam/Indigo/commit/21eec00cfe8fb5f3174ee2d2f663262370f0c1a9)
- python 3.13
- Windows 11 Enterprise. Version 25H2
**Attachments**
These are files that can be used to reproduce this issue:
- [query.mol.txt](https://github.com/user-attachments/files/31741757/query.mol.txt) - mol v300 with query molecule used to reproduce the issue, remove .txt extension, leave .mol
- [molecule.mol.txt](https://github.com/user-attachments/files/31741734/molecule.mol.txt) - mol v300 with molecule used to reproduce the issue, remove .txt extension, leave .mol
How attached molecule and query molecule looks like:
Example given in the [user-manual-oracle](https://lifescience.opensource.epam.com/bingo/user-manual-oracle.html#substructure-search):
**Additional context**
- In the [user-manual-oracle](https://lifescience.opensource.epam.com/bingo/user-manual-oracle.html#substructure-search) it is written: "“AND” stereocenters can match “AND”, “OR”, and absolute ones; “OR” stereocenters can match “OR” and absolute ones. Target stereo-groups cannot be more fragmented than the query stereo-groups."
- Same issue can be reproduced if 'OR' stereo-label is used instead of 'AND' in the molecule
- Same issue can be reproduced with the same query molecule but in the mol v2000 format (Ketcher was used to convert the query molecule)
- In the opposite direction this works fine: if molecule has ABS and query And or OR match is found successfully
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with query.mol and molecule.mol using the Python Indigo API calls in the report. Compare SubstructureMatcher behavior with the stereocenter rules in the linked user-manual-oracle example, including both AND and OR target labels. Done means matcher.match(query) finds the expected match for these cases without breaking the opposite ABS-query behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100