epam / epam/Indigo

Mismatch in Oxygen Atom Mapping Between Reactants and Product in Indigo Automapping

Open
#2,719 2 comments 0 reactions 0 assignees View on GitHub
User`s Feedback
Dominant language
C++
Stars
406
Forks
134
Avg merge
2d 11h
Merged PRs (30d)
24

Description

**Summary**
Automapping of a reaction using the Indigo library appears to mismatch oxygen atom labels (9 and 12) between the reactants and product.

**Steps to Reproduce**
```python
from indigo import Indigo

class IndigoMapper:
def __init__(self):
self.mapper = Indigo()
self.mapper.setOption("timeout", 2000)
self.mapper.setOption("aam-timeout", 2000)

def map_one(self, smiles: str) -> str:
mapped_reaction = self.mapper.loadReaction(smiles)
mapped_reaction.automap("discard")
return mapped_reaction.smiles()

product = "COc1ccccc1OCC(O)CN1CCN(CC(=O)Nc2c(C)cccc2C)CC1"
reactants = ["COc1ccccc1OC(CO)CN1CCN(CC(=O)Nc2c(C)cccc2C)CC1"]

mapper = IndigoMapper()
reaction_smiles = f"{'.'.join(reactants)}>>{product}"
mapped_reaction_smiles = mapper.map_one(reaction_smiles)

print("Mapped Reaction:", mapped_reaction_smiles)
```
**Actual behavior**
After automapping the reaction with automap("discard"), the oxygen atoms labeled as 9 and 12 in the reactants and product appear mismatched. Specifically:

- Oxygen 9 in the reactant maps to 12 in the product.
- Oxygen 12 in the reactant maps to 9 in the product.

This behavior can be visualized in the attached molecule images.

image
image

**Expected behavior**
Oxygen atoms in the reactants and product should retain consistent mapping based on chemical equivalence. Specifically:

- Reactant oxygen labeled 9 should map to product oxygen 9.
- Reactant oxygen labeled 12 should map to product oxygen 12.

**Environment details:**
- Indigo Version: 1.25.0.0-g0b3363e57-x86_64-darwin-appleclang-15000100
- Python Version: 3.9.13 [Clang 12.0.0]
- macOs Sonoma 14.7.1

**Attachments**
1. Image of the mapped product structure.
2. Image of the mapped reactant structure.

**Additional context**
This issue could potentially impact downstream applications that rely on accurate atom mappings for reaction modeling. Could you confirm if this is expected behavior or a bug in the mapping logic?

cc @ben-ikt

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the reported Python reproduction with Indigo 1.25.0 and inspect the output of automap("discard") for the two oxygen mappings. Then trace the automapping implementation and compare its behavior with the expected chemically equivalent mapping; done means confirming a fix or documenting why the mapping is valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.