AgaveChem
Try the web demo: denovochem.com/demos/reaction-atom-mapper
An open-source Python library for classification and atom-to-atom mapping (AAM) of chemical reactions. The default interface map_reactions for extracting atom-mapped reaction SMILES achieves state-of-the-art accuracy on the 1,758 reaction golden dataset benchmark.
AgaveChem mappers:
-
Template mapper: Reaction SMIRKS templates sourced from ReactionFlash, Rxn-INSIGHT, and manual curation are applied to classify and map reactions into a scheme inspired by Carey et al., as well as RXNO ontology classifications.
-
MCS-like mapper: Fingerprint based mapper that generates conservative partial maps at some radius around detected reaction centers.
-
Identical fragment mapper: Maps fragments appearing structurally unchanged on both sides of the reaction (counter-ions, solvents, spectator reagents).
-
Neural mapper: An ALBERT model trained in two phases - unsupervised masked language model (MLM) pre-training followed by supervised fine-tuning with a direct attention alignment objective against generated "ground truth" maps from the other three mappers. The supervised training data for the second phase is generated automatically from ~0.97M filtered Lowe USPTO reactions; the other three mappers fully map ~63% of reactions and ~90% of all product atoms in this dataset. The neural mapper is capable of mapping and automatically balancing unbalanced reactions.
These mappers can be used individually, or called as a pipeline using map_reactions().
Benchmark:
| Mapper | Per-reaction mapping accuracy |
|---|---|
| RXNMapper | 87.09% |
| RXNMapperv2 | 89.59% |
| GraphormerMapper | 89.76% |
| LocalMapper | 89.59% |
| AgaveChem (neural only) | 91.87% |
AgaveChem (using map_reactions()) |
92.72% |
Requirements
- Python (version >= 3.10)
- RDKit
- rdchiral-plus
- PyTorch
- Transformers (Hugging Face)
Installation
Install AgaveChem from PyPi:
pip install agave_chem
Or install AgaveChem with pip directly from this repo:
pip install git+https://github.com/denovochem/agave_chem.git
Or clone and install locally:
git clone https://github.com/denovochem/agave_chem.git
cd agave_chem
pip install .
Basic usage
Mapping a batch of reactions through the full pipeline
from agave_chem import map_reactions
reactions = [
"CC(Cl)(Cl)OC(C)(Cl)Cl.CC(=O)C(=O)O>>CC(=O)C(=O)Cl",
"OCC(=O)OCCCO.Cl>>ClCC(=O)OCCCO",
]
results = map_reactions(reactions)
for r in results:
print(r.final_mapping)
Neural mapper
from agave_chem import NeuralReactionMapper
mapper = NeuralReactionMapper("neural_mapper")
result = mapper.map_reaction("CC(Cl)(Cl)OC(C)(Cl)Cl.CC(=O)C(=O)O>>CC(=O)C(=O)Cl")
print(result.selected_mapping)
MCS-like mapper
from agave_chem import MCSReactionMapper
mapper = MCSReactionMapper("mcs_mapper")
result = mapper.map_reaction("CC(Cl)(Cl)OC(C)(Cl)Cl.CC(=O)C(=O)O>>CC(=O)C(=O)Cl")
print(result.selected_mapping)
Template mapper
from agave_chem import TemplateReactionMapper
mapper = TemplateReactionMapper("template_mapper")
result = mapper.map_reaction("CC(Cl)(Cl)OC(C)(Cl)Cl.CC(=O)C(=O)O>>CC(=O)C(=O)Cl")
print(result.selected_mapping)
Handling unbalanced reactions
The neural mapper is capable of mapping unbalanced reactions and returning balanced mapped reactions when one_to_one_correspondence is set to "auto" or False. When one_to_one_correspondence is set to "auto", the neural mapper uses heuristics to automatically determine for each reaction whether one_to_one_correspondence should be True or False.
from rdkit import Chem
from rdkit.Chem import rdChemReactions
rxn = "c1c(O)cc(O)cc1O.O=[N+]([O-])O>>c(O)1c([N+](=O)[O-])c(O)c([N+](=O)[O-])c(O)c1[N+](=O)[O-]"
rdChemReactions.ReactionFromSmarts(rxn, useSmiles=True)
from agave_chem import NeuralReactionMapper
mapper = NeuralReactionMapper("neural_mapper")
result = mapper.map_reaction(rxn, one_to_one_correspondence=False)
rdChemReactions.ReactionFromSmarts(result.selected_mapping, useSmiles=True)
Documentation
Documentation is a work in progress available here.
Contributing
- Feature ideas and bug reports are welcome on the Issue Tracker.
- Fork the source code on GitHub, make changes and file a pull request.
License
AgaveChem is licensed under the MIT license.
References
- RXNMapper: Schwaller et al., Science Advances, 2021
- RXNMapperv2: Grandjean et al., ChemRxiv, 2026
- LocalMapper: Chen et al., Nat. Commun., 2024
- GraphormerMapper: Nugmanov et al., ChemRxiv, 2022
- Rxn-INSIGHT: Probst et al.
- rdchiral: Coley et al., J. Chem. Inf. Model., 2019
- rdchiral_plus
- Lowe USPTO dataset
- Benchmarking study: Lin et al., ChemRxiv, 2020
- ReactionFlash
Release files for agave-chem 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agave_chem-0.2.0.tar.gz | 13.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agave_chem-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.2 MB
Release files / agave_chem-0.2.0.tar.gz
| Download URL | agave_chem-0.2.0.tar.gz |
|---|---|
| Size | 13.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f43077e9a826b0b247939de5b747dab2f9096ca306cfc2eb46c6beccb8e85965
|
|
BLAKE2b-256 checksum How to use checksums |
0e2069ae35614f6f719cc667429198793fa5362f114fe28fe9f3bd1d49e197bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / agave_chem-0.2.0-py3-none-any.whl
| Download URL | agave_chem-0.2.0-py3-none-any.whl |
|---|---|
| Size | 13.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b7190d117d5ff25e8641af142da7b51594653eaf491e91c4952b29c91292683
|
|
BLAKE2b-256 checksum How to use checksums |
4e1e87d421a7bfe5e2c9cdbed9a8e0b0ace5f78fe73e9d1acdcf4eb448c544b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency log