Aromatization can produce stereochemical SMILES that Indigo cannot reload
- Dominant language
- C++
- Stars
- 406
- Forks
- 134
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 24
Description
## Summary
Indigo can produce aromatic SMILES that retain tetrahedral stereochemistry but cannot be loaded again by the same Indigo version.
We have encountered this with multiple atom types and structures while processing PubChem data. The common failure is:
```text
loadMolecule()
-> aromatize()
-> canonicalSmiles()
-> loadMolecule()
```
A valid stereocenter is retained during aromatization, but the resulting aromatic representation is rejected by the SMILES loader or is otherwise incompatible with the retained tetrahedral stereochemistry.
## Reproducing cases
### Sulfur — PubChem CID 21597903
Source:
```text
C[C@@H]1[C@@H](S2=N[S@]1=NC(=N2)C(F)(F)F)C
```
After aromatization, Indigo produces:
```text
C[C@H]1[C@@H](C)[s@@]2[n]c([n][s]1[n]2)C(F)(F)F
```
Loading the generated SMILES fails with:
```text
SMILES loader: chirality not possible on atom #4
```
The equivalent Kekulé representation is accepted.
### Phosphorus — PubChem CID 21732325
Current PubChem source:
```text
CN(C)P1(=NP(=NP(=N1)(F)F)(N(C)C)F)N(C)C
```
The current source does not define phosphorus stereochemistry. During an earlier PubChem import, however, Indigo produced and stored the following aromatic representation:
```text
CN(C)[p@]1(F)[n][p](F)(F)[n][p]([n]1)(N(C)C)N(C)C
```
This representation subsequently failed to reload.
The source structure is useful as a connectivity baseline: canonicalization of the current source should not invent stereochemistry, while valid explicitly stereochemical aromatic representations of the same connectivity should remain loadable.
### Silicon — PubChem CID 59917577
Source:
```text
C[Si]1O[Si]O[Si](O[Si@](O[Si](O[Si](O1)C)O[Si]2O[Si](O[Si](O[Si](O[Si](O[Si](O2)O[Si](O)O)O[Si](O)O[Si](O)O)O[Si](O)O)C)O[Si](C)O)O[Si](O)O)O
```
The source contains a valid tetrahedral silicon stereocenter and can be loaded and canonicalized normally.
Calling `aromatize()` can convert bonds in the siloxane system to aromatic bonds while retaining the silicon stereocenter. The resulting representation cannot be reloaded consistently with that stereochemistry.
In this case, the correct behavior is not necessarily to aromatize the stereocenter's component. If the proposed aromatic representation cannot support the existing tetrahedral stereochemistry, the concrete bond representation should be preserved.
## Additional reduced cases
The same general behavior can be reproduced with smaller structures involving several stereocenter configurations:
```text
C[N@]1C=C(C)C=C1
C[P@]1C=C(C)C=C1
C[S@+]1C=C(C)C=C1
C[N@]1(F)=C(C)C=CC=C1
C[P@]1(F)=C(C)C=CC=C1
C[S@+]1(F)=C(C)C=CC=C1
```
We also found valid stereochemistry involving a single explicit aromatic bond:
```text
C[P@+](F)(Cl):c1ccccc1
C[P@@+](F)(Cl):c1ccccc1
```
Both parities should remain distinct and round-trip successfully when the corresponding Kekulé system permits the stereocenter.
## Actual behavior
Aromatization and SMILES loading do not use consistent rules for tetrahedral stereocenters participating in aromatic systems.
Depending on the structure, Indigo can:
* retain a stereocenter while changing its surrounding bonds to an aromatic representation that the loader rejects;
* serialize an aromatic stereocenter that cannot subsequently be validated;
* reject an aromatic representation even when a valid corresponding Kekulé assignment exists.
This allows Indigo to emit SMILES that the same Indigo version cannot consume.
## Expected behavior
Indigo should maintain a consistent contract between aromatization, SMILES serialization, and SMILES loading.
For a valid stereocenter:
```text
loadMolecule()
-> aromatize()
-> canonicalSmiles()
-> loadMolecule()
-> canonicalSmiles()
```
should succeed without losing or changing the defined stereochemistry.
If an aromatic system has a valid Kekulé assignment compatible with the stereocenter, the aromatic representation should be accepted.
If no compatible aromatic/Kekulé representation exists, aromatization should preserve the existing concrete bond representation rather than produce an aromatic structure that cannot be reloaded.
Invalid aromatic stereocenters should continue to be rejected.
## Environment details
* Indigo 1.45.0 and current master
* Python and Java bindings
* Linux
## Additional context
The issue appears to be a consistency problem between tetrahedral stereocenter validation and aromatic/Kekulé representation.
A solution should not depend on a hard-coded list of sulfur, phosphorus, silicon, or other individual elements. The validity of the stereocenter should be determined from the molecular connectivity and whether a compatible Kekulé realization exists.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the loadMolecule() -> aromatize() -> canonicalSmiles() -> loadMolecule() sequence with the sulfur, phosphorus, silicon, and reduced cases in the issue. Trace the aromatization, SMILES serialization, and loading validation paths; done means compatible stereochemical aromatic forms round-trip without change, while incompatible forms preserve concrete bonds or remain rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, java, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100