Skip to main content

RxnTools

RxnTools is a lightweight collection of RDKit-powered utilities for reaction-centric cheminformatics workflows. It grew out of template-extraction notebooks and now bundles reusable helpers for:

  • parsing unmapped reaction strings, filtering cofactors, and building reaction descriptors
  • tracing atom-mapped changes and extracting environment-specific SMARTS templates
  • enumerating products from SMARTS templates (including optional stereochemical filters)
  • visualising molecules or highlighting substructures inside Jupyter notebooks

Whether you are curating reaction datasets, prototyping retrosynthesis heuristics, or inspecting stereochemical templates, RxnTools provides the glue code built on top of RDKit so you do not have to rewrite it from scratch.

Installation

From PyPI (recommended)

pip install rxntools-kit

Note: RxnTools targets Python 3.10. You must install an RDKit build that matches your platform; conda-forge is the most reliable source (conda install -c conda-forge rdkit).

From source with Poetry

git clone https://github.com/<your-handle>/RxnTools.git
cd RxnTools
poetry env use /path/to/python3.10
poetry install

Quickstart

from rxntools.reaction import unmapped_reaction

# Provide a minimal cofactor list so helpers can filter them out
cofactors = ["O=C=O"]   # typically loaded from data/raw/cofactors.json

rxn = unmapped_reaction("CCO + O=C=O >> CC(=O)O + O")
substrates = rxn.get_substrates(cofactors_list=cofactors, consider_stereo=False)
products = rxn.get_products(cofactors_list=cofactors, consider_stereo=False)

print(substrates)  # ['CCO']
print(products)    # ['CC(=O)O', 'O']

Need to inspect transformed atoms? Switch to rxntools.reaction.mapped_reaction:

from rxntools.reaction import mapped_reaction

rxn_smarts = "[CH3:1][CH2:2][OH:3].[C:4](=[O:5])=[O:6]>>[CH3:1][CH:2](=[O:5])[OH:3].[OH2:7]"
mr = mapped_reaction(rxn_smarts, include_stereo=True)
changed_atoms, broken_bonds, formed_bonds = mr.get_all_changed_atoms()

For template extraction, pass the mapped substrate SMARTS plus atom indices to mapped_reaction.get_template_around_rxn_site.

Data Files

Two reference files ship with the source distribution and can be redistributed with your projects:

  • data/raw/all_cofactors.csv
  • data/raw/cofactors.json

Larger third-party datasets (e.g., enzymemap*) remain in the repository but are excluded from the published wheel to respect their original licenses. If you rely on them, keep a clone of the repository or source the datasets separately.

Running Tests

poetry install --with dev  # ensure pytest and optional tooling are installed
poetry run pytest

Contributing

Issues and pull requests are welcome. If you plan significant changes:

  1. Fork the repository and create a topic branch.
  2. Add or update tests that cover the new behaviour.
  3. Run poetry run pytest before opening a PR.

License

RxnTools is released under the MIT License.

Release files for rxntools-kit 0.1.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 rxntools-kit 0.1.0
File Size Uploaded
rxntools_kit-0.1.0.tar.gz 14.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rxntools-kit 0.1.0
File Interpreter ABI Platform
rxntools_kit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.7 kB

Release files / rxntools_kit-0.1.0.tar.gz

Download URL rxntools_kit-0.1.0.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
33955db70eda5a4f14d3c4d86cadc33a80ceb95d945beec4af4bf3784b10529c
BLAKE2b-256 checksum
How to use checksums
3b90c5639322e62918fc9220626dca9be37403593976d30ada052560b4f94724
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.13 Darwin/24.6.0

Release files / rxntools_kit-0.1.0-py3-none-any.whl

Download URL rxntools_kit-0.1.0-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca79c7ab9293653b8ead1f0ffe994afcea67f08cae085f290d6213855521b5ec
BLAKE2b-256 checksum
How to use checksums
019bed7099cb7e623dbb3c5c68487f5e6914aae9ace6b5d42aab32eaaf249eaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.13 Darwin/24.6.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

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