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_atoms_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-0.4.0.tar.gz (13.4 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-0.4.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for atommap_eval-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f68e3b3ec95f0e476545b702a03332393f16a1e3d8a0a479e1e372ddd60418e5
MD5 70e9c8ab4ac015ef16a7b89d0cead4f8
BLAKE2b-256 8dca3093350cf6ca67764c1c108d6ebcc0acf1dfd9db2299ccd9d036d9b0f272

See more details on using hashes here.

File details

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

File metadata

  • Download URL: atommap_eval-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 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-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37b405859c24c581b4da827e2d366261d1d64f8b70c6bc818202a55a2f849a1d
MD5 48a0863251e8491954bf60d72a105339
BLAKE2b-256 f74d4c1a77c82f63d21689dc45cce103a6a007460261255c558a79b8503d57b2

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