Skip to main content

Evaluate atom-mapping equivalence of chemical reactions using graph isomorphism.

Project description

atommap_eval

Evaluate the equivalence of atom-mapped reaction SMILES using graph-based isomorphism.

Overview

atommap_eval is a Python package for comparing two atom-mapped reactions and determining whether they are chemically equivalent, using graph theory and RDKit.

It supports:

  • ✅ Canonicalization and standardization of SMILES
  • ✅ Graph construction with atom-level / bond-level attributes and mapping
  • ✅ Graph isomorphism checks using networkx
  • ✅ Evaluation over single or batch pairs (in parallel or sequentially)
  • ✅ CLI support for evaluating CSV/JSON files
  • ✅ Fast testing and linting with pytest, ruff, and black

It allows consistent evaluation of atom-mapping validity (e.g. against a ground truth atom-mapped reaction) by taking into account equivalence of some atoms (i.e. all CH3 in t-Bu are equivalent, any shuffling of atom-map indices should not impact correctness of the mapping)

Warning: tautomeric mappings are not considered equivalent even though from a chemist's perspective they are. Because template extraction of the underlying reactivity would yield different results. Flags for tautomers will however be implemented in further implementations to better deal with this specific case.


Installation

# Clone the repo and install in editable mode
git clone https://github.com/yvsgrndjn/atommap_eval.git
cd atommap_eval
pip install -e ".[dev]"

or with Conda:

conda create -n atommap_eval python=3.9
conda activate atommap_eval
pip install -e ".[dev]"

Usage

Python

from atommap_eval.evaluator import are_atom_maps_equivalent

gt = "[C:1](=[O:2])[O-:3].[H+:4]>>[C:1](=[O:2])[OH:3]"
pred = "[H+:4].[C:1](=[O:2])[O-:3]>>[C:1](=[O:2])[OH:3]"
result = are_atom_maps_equivalent(gt, pred)
print(result) # True

CLI

atommap_eval reactions.csv -f csv -p 4 -o results.csv

Project structure

src/atommap_eval/
├── canonicalizer.py
├── cli.py
├── data_models.py
├── evaluator.py
├── input_io.py
├── parallel.py
├── rxn_graph.py
├── rxnmapper_utils.py
tests/

Development

Run tests:

make test

Format code:

make format

Lint:

make lint

Test examples

Unit tests are located under test/ and cover evaluator logic, CLI execution, and multiprocessing correctness.

License

MIT License © 2025 Yves Grandjean

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atommap_eval-1.0.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atommap_eval-1.0.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file atommap_eval-1.0.0.tar.gz.

File metadata

  • Download URL: atommap_eval-1.0.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for atommap_eval-1.0.0.tar.gz
Algorithm Hash digest
SHA256 66f484aed4a718c8c86823aab651df3ae1bce5bd4dd0f6689527550184942da6
MD5 410f22f07925bfee55e2ce487ece6481
BLAKE2b-256 ac42be4eac9497451b7120878ee7e23560a3da99dfafd334a3f09ea87b87108c

See more details on using hashes here.

File details

Details for the file atommap_eval-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: atommap_eval-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for atommap_eval-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dfbedc60c25a6260ecd4dba3344c7aac5d6edb806512af16788dbd346950e6da
MD5 ec4b71ac5c7d17c5e94ab4bffa7275fc
BLAKE2b-256 ad2d7db49c0474c6b15b58861314f9dd21ed9ccd9fdf20f65f4e75162a114b57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page