Skip to main content

AgaveChem

PyPI version Maintenance License Run Tests Build Docs Open In Colab

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)

Unbalanced reaction

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)

Balanced mapped reaction

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

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)

Source distribution for agave-chem 0.2.0
File Size Uploaded
agave_chem-0.2.0.tar.gz 13.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for agave-chem 0.2.0
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page