Skip to main content

DirectMultiStep: Direct Route Generation for Multi-Step Retrosynthesis

Python Version Ruff Checked with mypy Code style: black License: MIT arXiv image PyPI - Downloads

Overview

This work has been published in J. Chem. Inf. Model. The preprint for this work was posted on arXiv.

You can use DMS models without installation through our web interface at models.batistalab.com. Or, if you want, you can install the package from pypi pip install directmultistep. Check out dms.batistalab.com for full documentation.

How to use

Here's a quick example to generate a retrosynthesis route (you can get relevant checkpoints by running bash download_files.sh).

from directmultistep.generate import generate_routes
from pathlib import Path

data_path = Path(__file__).resolve().parents[1] / "data"
ckpt_path = data_path / "checkpoints"
fig_path = data_path / "figures"
config_path = data_path / "configs" / "dms_dictionary.yaml"

# Generate a route for a target molecule
target = "CNCc1cc(-c2ccccc2F)n(S(=O)(=O)c2cccnc2)c1"
starting_material = "CN"

# Find routes with different models:
# Using flash model with starting material
paths = generate_routes(
    target, 
    n_steps=2, 
    starting_material=starting_material, 
    model="flash", beam_size=5,
    config_path=config_path, ckpt_dir=ckpt_path
)

# Or use explorer model to automatically determine steps
paths = generate_routes(
    target,
    starting_material=starting_material,
    model="explorer",
    beam_size=5,
    config_path=config_path, ckpt_dir=ckpt_path
)

See use-examples/generate-route.py to see more examples with other models. Other example scripts include:

  • train-model.py: Train a new model with customizable configuration for local or cluster environments
  • eval-subset.py: Evaluate a trained model on a subset of data
  • paper-figures.py: Reproduce figures from the paper
  • visualize-train-curves.py: Plot training curves and metrics

Citing

If you use DirectMultiStep in an academic project, please consider citing our publication in J. Chem. Inf. Model:

@article{directmultistep,
    author = {Shee, Yu and Morgunov, Anton and Li, Haote and Batista, Victor S.},
    title = {DirectMultiStep: Direct Route Generation for Multistep Retrosynthesis},
    journal = {Journal of Chemical Information and Modeling},
    volume = {65},
    number = {8},
    pages = {3903-3914},
    year = {2025},
    doi = {10.1021/acs.jcim.4c01982},
    note ={PMID: 40197023},
    URL = {https://doi.org/10.1021/acs.jcim.4c01982},
    eprint = {https://doi.org/10.1021/acs.jcim.4c01982}
}

Extra Materials

Through download_files.sh you can download canonicalized versions of eMols (23M SMILES), Buyables (329k SMILES), ChEMBL-5000 (5k SMILES), and USPTO-190 (190 SMILES). Using pre-canonicalized version saves you roughly a day of cpu time. If you happen to use these canonicalized versions, consider citing the repo from figshare:

@misc{shee2025figshare,
    author = {Yu Shee and Anton Morgunov},
    title = {Data for ``DirectMultiStep: Direct Route Generation for Multistep Retrosynthesis''},
    year = {2025},
    month = {3},
    howpublished = {\url{https://figshare.com/articles/dataset/Data_for_DirectMultiStep_Direct_Route_Generation_for_Multistep_Retrosynthesis_/28629470}},
    doi = {"10.6084/m9.figshare.28629470.v1"},
    note = {Accessed: 20xx-xx-xx}
}

Also check out the HigherLev Retro repo which is the source of the Buyables stock set. route-distances is the source of ChEMBL-5000. Retro* is the source of the eMols stock set and USPTO-190.

Licenses

All code is licensed under MIT License. The content of the pre-print on arXiv is licensed under CC-BY 4.0.

Metadata

Release files for directmultistep 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for directmultistep 1.1.3
File Size Uploaded Provenance
directmultistep-1.1.3.tar.gz 56.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for directmultistep 1.1.3
File Interpreter ABI Platform
directmultistep-1.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 123.9 kB

Release files / directmultistep-1.1.3.tar.gz

Download URL directmultistep-1.1.3.tar.gz
Size 56.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8176d998a3009091aec69b1f871e3772376a52d843891c829374fab7fd02b3c8
BLAKE2b-256 checksum
How to use checksums
2285e18168b9d6ed58a7f7a3961aba5db1d215dd295eb134521a79ceb20baa0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.15

Release files / directmultistep-1.1.3-py3-none-any.whl

Download URL directmultistep-1.1.3-py3-none-any.whl
Size 67.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6a76d168c5a22cad054f421a8dbdd30d8c4292d52b173fadbf7e470c5249864
BLAKE2b-256 checksum
How to use checksums
26cf6fa24cf35365091fd263f59dd6a941cbe4223dbf833671206321fdd2d544
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.15

Security for directmultistep 1.1.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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