Skip to main content

Wrapper for RDKit's RunReactants to improve stereochemistry handling

Project description

PyPI version Maintenance License Run Tests Build Docs Open In Colab

rdchiral_plus

Wrapper for RDKit's RunReactants to improve stereochemistry handling

This repository is a fork of rdchiral. It has been modified for improved performance while maintaining high consistency with the upstream library. These modifications provide speed that is marginally slower than the fast C++ version (rdchiral_cpp), but has the benefits of being written in Python. This library is pip installable cross platform.

The interface (rdchiralRun, rdchiralRunText, rdchiralReaction, rdchiralReactants, rdchiralExtract, etc.) and returned data structures remain unchanged from the original library, so existing code should work with no modifications. While behavior is mostly consistent with the original library, this fork includes several important fixes and improvements.

Template application

  • Conjugated system bond direction correction: Corrects corrupted single-bond directions (ENDUPRIGHT, ENDDOWNRIGHT) in conjugated systems. Implemented from here
  • Broader stereochemistry handling: Stereochemistry for tetrahedral centers with lone pairs is accounted for
  • One-pot reactions: Templates are initialized with parentheses where needed so that templates defining multiple reactions on the same product are properly handled
  • Recursive template application: Templates can be recursively applied with a max_depth parameter, useful for symmetric reactions, or reactions that occur at multiple sites in a molecule

Template extraction

  • Configurable template extraction: Template extraction supports configurable radius and special group handling. Implemented from here
  • Deterministic template extraction: Replaced random shuffle-based tetrahedral center correction loops with deterministic permutation parity - the old behavior could lead to inconsistent results or hang in rare instances.
  • Stereochemistry tracking: Inversions of tetrahedral centers are counted as a changed atom, and included in the extracted template
  • Spectator tracking: Spectator molecules are included in extracted template dictionaries

General

  • Automatic dependency installation: RDKit is automatically installed as a dependency

Consistency with the original library

The changes above result in minor differences in behavior compared to the original library. In most cases where behavior is different, rdchiral_plus produces the more accurate result. The table below shows the roundtripability of extracting a template from atom mapped reaction SMILES, and then applying that template to the product SMILES to recover the expected reactant SMILES. rdchiral_plus reduces the number of incorrect roundtrips by 90% compared to rdchiral, and 94% compared to rdchiral_cpp.

library successful roundtrips success rate
rdchiral 49223 / 50016 98.41%
rdchiral_cpp 48694 / 50016 97.36%
rdchiral_plus 49935 / 50016 99.84%

See here for details on how consistency is measured against the original library and full details of what changes you can expect compared to the original rdchiral library.

Requirements

  • RDKit (version >= 2019)
  • Python (version >= 3.10)

Installation

Install rdchiral_plus from PyPI:

pip install rdchiral-plus

Or install rdchiral_plus with pip directly from this repo:

pip install git+https://github.com/denovochem/rdchiral_plus.git

This fork can be optionally compiled with mypyc. In our testing performance is not noticeably improved, as most of the computationally expensive work in this library is done with rdkit, which is already primarily written in C++.

For mypyc compilation:

RDCHIRAL_USE_MYPYC=1 pip install "git+https://github.com/denovochem/rdchiral_plus.git"

Basic usage

from rdchiral import rdchiralRunText, rdchiralReaction, rdchiralReactants

# Run directly from SMARTS and SMILES strings
# This is slower than pre-initializing rdchiralReaction and rdchiralReactants when
# processing a large number of reactions
reaction_smarts = '[C:1][OH:2]>>[C:1][O:2][C]'
reactant_smiles = 'OCC(=O)OCCCO'
outcomes = rdchiralRunText(reaction_smarts, reactant_smiles)
print(outcomes)

# Pre-initialize then run
rxn = rdchiralReaction(reaction_smarts)
reactants = rdchiralReactants(reactant_smiles)
outcomes = rdchiralRun(rxn, reactants)
print(outcomes)

# Get list of atoms that changed
outcomes, mapped_outcomes = rdchiralRun(rxn, reactants, return_mapped=True)
print(outcomes, mapped_outcomes)

Documentation

Full documentation is 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

rdchiral_plus is licensed under the MIT license.

References

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

rdchiral_plus-0.4.0.tar.gz (48.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rdchiral_plus-0.4.0-cp313-cp313-win_amd64.whl (301.7 kB view details)

Uploaded CPython 3.13Windows x86-64

rdchiral_plus-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (654.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

rdchiral_plus-0.4.0-cp313-cp313-macosx_11_0_arm64.whl (396.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rdchiral_plus-0.4.0-cp312-cp312-win_amd64.whl (301.5 kB view details)

Uploaded CPython 3.12Windows x86-64

rdchiral_plus-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (658.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

rdchiral_plus-0.4.0-cp312-cp312-macosx_11_0_arm64.whl (397.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rdchiral_plus-0.4.0-cp311-cp311-win_amd64.whl (300.6 kB view details)

Uploaded CPython 3.11Windows x86-64

rdchiral_plus-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (625.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

rdchiral_plus-0.4.0-cp311-cp311-macosx_11_0_arm64.whl (395.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rdchiral_plus-0.4.0-cp310-cp310-win_amd64.whl (300.1 kB view details)

Uploaded CPython 3.10Windows x86-64

rdchiral_plus-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (623.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

rdchiral_plus-0.4.0-cp310-cp310-macosx_11_0_arm64.whl (398.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: rdchiral_plus-0.4.0.tar.gz
  • Upload date:
  • Size: 48.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rdchiral_plus-0.4.0.tar.gz
Algorithm Hash digest
SHA256 023b6ea6cb0503f95ce25491ca211cfc13f71693d03ed8ab4644ca86a86e7f60
MD5 b08da06191c62a8c04a39513602e37a6
BLAKE2b-256 90b17eff2ac9c94853dc84fe1cc083385b4cf014cfdc085cc1f5ddf785e48c1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0.tar.gz:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c16e9cc70bab65249dce48e36ad8bfad2dd53516f26cafbfa980dcb2c3b5d767
MD5 7c3ee8c3d3374f1fc37ddc95e8396d58
BLAKE2b-256 d864a62e3cfc484dabf772a955640c4a550fa494144d250aa7bf4fc39523c94e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 607f0dc93fcbebc2900eda80afd7086ae931ca9e043724beda51b62a369bd3fc
MD5 2d2751b1a5b8cab0154dd90964ad78e5
BLAKE2b-256 17806a77762655be077c680449dabfbd7eca5a26c85c80be3b0f4503b52e96c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26b900af115c5d22267a6998ee8f672f1ee7010fedbeb2c832cab7e20151efe4
MD5 2e2d7a75bdcbd061d8c6c2b387c4c394
BLAKE2b-256 cac1b5b339ceb9e0cf61f8fe52a587578c6eea0c1f3582e9e409583dd4fd9873

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a7bed9c734b2814d23768c2e93b317e6f2a3389ca6a101b136d2cd28263e7e22
MD5 2df10d3b3ef1a0163fb15e3f82f2a49c
BLAKE2b-256 f47d7350119894b83f1627e167874cecdc553d4c51b77c766c2598a63ccc8bd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 99f691a40809496e0092e75c9eb30b42218c0e0d3dbe473e1f99b8dc574ade09
MD5 8443643d35098c2392ca3a73879f3576
BLAKE2b-256 e03e4260fc1a09706b5c940b226ad5862ffeb3b84fb41cf919b2579bdb7711c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 209e37f1cd24f57b5cd7d3548b84f687440567ef0a8ea9bd15bc56ca6fa942b3
MD5 5b886befe09a11d00939fed4f9685c7e
BLAKE2b-256 4986ee00608f23fd003d552ea21a79118e5b6de704d947da8a1949373e7a168f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 546567d8be4e105d35ae7029997f652f90b59ae2c6e121b91691d9bcfff751ab
MD5 3815ffa34ebc9e3af33f32d5821979b5
BLAKE2b-256 a9ef10dc66f4ffc5e7b1e685f4ea8f2efa732188e62cba82f6d674cca8484b3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a4e1a605ce16f8e6c17c66d3c75f27ee143cb1fb3b86a2ec44c0eb937ed2698
MD5 afc93741e227477bfa832de88d21333b
BLAKE2b-256 feddebfac91426768910ad401d8f3ac412b1caf1c3686f29b943b17c33583b22

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3604d66c911e3d777f21bc07b955225283e1d131b04de60cf9c944bf65f2aee4
MD5 222c2040e9f8e6a96020d3cbb5d9c9cb
BLAKE2b-256 3f01c744ce74b1ab4715bb440136078e498bd778227a9a725e6cd70e596bd8fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 802f88aaf2143b07ff7f0a6ad104733f1ed134b3e048364bab9b87cacddbcc4f
MD5 49c99ed122a7eb8e23e0174da0e25953
BLAKE2b-256 10a2de148eb110b4ba785a98dc9f8392d3cc4a23194e4eff4d7538f3d2487aea

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 124322088e101c973ea9f92b113dd3fd328ef38f69012a8353799daaa9ac0821
MD5 7251d1ea0effc4efda30abbec89a7df9
BLAKE2b-256 e99194a1292bd5818ac56a2ee09bbf1cf2e9d93a6916a0f6f97c502a3ecab1b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rdchiral_plus-0.4.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rdchiral_plus-0.4.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e504f363bf3fabcd3285546f78845c1993bedcd12d7736da057000cbd52f1028
MD5 8be310c6d76a23a3ba56ac3bdfa3973e
BLAKE2b-256 4ca3bd79e34072c0a570f08507319af5c6cea4619fd377658ee1d00afc30b0e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rdchiral_plus-0.4.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on denovochem/rdchiral_plus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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