syntemp

Graph based Reaction Template Extraction

https://github.com/tieulongphan/syntemp

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: acs.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary

Keywords

atom-atom-mapping graph-transformation reaction-rules reactions-clustering
Last synced: 6 months ago · JSON representation ·

Repository

Graph based Reaction Template Extraction

Basic Info
  • Host: GitHub
  • Owner: TieuLongPhan
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 95.8 MB
Statistics
  • Stars: 29
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 10
Topics
atom-atom-mapping graph-transformation reaction-rules reactions-clustering
Created almost 2 years ago · Last pushed 8 months ago
Metadata Files
Readme Changelog License Citation

README.md

SynTemp

Graph-based Reaction Templates/Rules Extraction

Overview

This repository is dedicated to the systematic extraction of reaction rules from reaction databases. Our primary focus is the computational analysis and transformation of molecular reactions into a structured set of rules. This work facilitates a deeper understanding of reaction mechanisms and pathways. The SynTemp framework is organized into four main phases:

  1. AAMs Inference: Based on ensemble AAMs for accurate atom mapping.
  2. Imaginary Transition State (ITS) Completion: Enhances ITS by incorporating hydrogen inference to fully capture the reaction mechanism.
  3. Reaction Center Detection and Extension: Focuses on identifying and extending the core active sites of reactions.
  4. Hierarchical Clustering: Groups extended reaction centers or partial ITS to analyze reaction patterns.

The general framework and its components are depicted in Figures A, B, and C below. Please visit full user guide & API reference for detailed examples, configuration options, and best practices.

screenshot

Downstream Applications

  • Templates Analysis: We have developed topological descriptors for ITS graphs to encapsulate the essential information of templates.
  • Rules Application: Observes the trade-off between radii and coverage/novelty metrics. Increased coverage tends to reduce the number of output solutions due to the complexities of subgraph matching within the DPO framework. However, it also decreases novelty. This trade-off serves as a precursor to our forthcoming research, which will focus on developing a constrained framework for synthesis planning.

Table of Contents

Installation

To install and set up the SynTemp framework, follow these steps.

Prerequisites

  • Python 3.11
  • rdkit>=2024.3.5
  • networkx>=3.3
  • synrbl>=1.0.0
  • synkit>=0.0.4

If you want to run ensemble AAMs

  • dgl==2.1.0
  • dgllife==0.3.2
  • localmapper>=0.1.5
  • rxn-chem-utils>=1.6.0
  • rxn-utils>=2.0.0
  • rxnmapper>=0.4.1
  • chython==1.78
  • chytorch>=1.65
  • chytorch-rxnmap>=1.4
  • torch==2.2.0
  • torchdata==0.7.1

Step-by-Step Installation Guide

  1. Python Installation: Ensure that Python 3.11 or later is installed on your system. You can download it from python.org.

  2. Creating a Virtual Environment (Optional but Recommended): It's recommended to use a virtual environment to avoid conflicts with other projects or system-wide packages. Use the following commands to create and activate a virtual environment:

bash python -m venv syntemp-env source syntemp-env/bin/activate # On Windows use `syntemp-env\Scripts\activate` Or Conda

bash conda create --name syntemp-env python=3.11 conda activate syntemp-env

  1. Install from PyPi: The easiest way to use SynTemp is by installing the PyPI package syntemp.

pip install syntemp Optional if you want to install full version including three types of atom map pip install syntemp[all]

  1. Verify Installation: After installation, you can verify that Syn Temp is correctly installed by running a simple test

bash echo -e "R-id,reaction\n0,COC(=O)[C@H](CCCCNC(=O)OCc1ccccc1)NC(=O)Nc1cc(OC)cc(C(C)(C)C)c1O>>COC(=O)[C@H](CCCCN)NC(=O)Nc1cc(OC)cc(C(C)(C)C)c1O" > test.csv python -m syntemp --data_path test.csv --rebalancing --id 'R-id' --rsmi 'reaction' --rerun_aam --fix_hydrogen --log_file ./log.txt --save_dir ./

Usage

Use in script

```python from syntemp.auto_template import AutoTemp

data = [{'R-id': 0, 'reactions': 'COC(=O)C(CCCCNC(=O)OCc1ccccc1)NC(=O)Nc1cc(OC)cc(C(C)(C)C)c1O.O>>COC(=O)C(CCCCN)NC(=O)Nc1cc(OC)cc(C(C)(C)C)c1O.O=C(O)OCc1ccccc1'}, {'R-id': 1, 'reactions': 'Nc1cccc2cnccc12.O=C(O)c1cc(N+[O-])c(Sc2c(Cl)cncc2Cl)s1>>O.O=C(Nc1cccc2cnccc12)c1cc(N+[O-])c(Sc2c(Cl)cncc2Cl)s1'}, {'R-id': 4, 'reactions': 'CCOc1ccc(Oc2ncnc3c2cnn3C2CCNCC2)c(F)c1.O=C(Cl)OC1CCCC1>>CCOc1ccc(Oc2ncnc3c2cnn3C2CCN(C(=O)OC3CCCC3)CC2)c(F)c1.Cl'}, {'R-id': 5, 'reactions': 'Cn1cnc(-c2cc(C#N)ccn2)c1Br.OB(O)c1ccc(-n2cccn2)cc1>>Cn1cnc(-c2cc(C#N)ccn2)c1-c1ccc(-n2cccn2)cc1.OB(O)Br'}, {'R-id': 6, 'reactions': 'CC1(C)OB(c2ccc(OCc3ccc4ccccc4n3)cc2)OC1(C)C.N#Cc1ccc(OC2CCCCO2)c(Br)c1>>CC1(C)OB(Br)OC1(C)C.N#Cc1ccc(OC2CCCCO2)c(-c2ccc(OCc3ccc4ccccc4n3)cc2)c1'}]

auto = AutoTemp( rebalancing=True, mappertypes=["rxnmapper", "graphormer", "localmapper"], id="R-id", rsmi="reactions", njobs=1, verbose=2, batchsize=1, jobtimeout=None, safemode=False, savedir=None, fix_hydrogen=True, )

(reactiondicts, templates, hiertemplates, itscorrect, uncertainhydrogen,) = auto.tempextract(data, libpath=None)

core_temp = templates[0]

# In order to perform forward prediction, you can use the following code: from synkit.IO import gmltoits from synkit.Synthesis.Reactor.synreactor import SynReactor reactor = SynReactor(substrate='COC(=O)C(CCCCNC(=O)OCc1ccccc1)NC(=O)Nc1cc(OC)cc(C(C)(C)C)c1O.O', template=gmltoits(coretemp[0]['gml']))

print(reactor.smarts) ```

Use in command line

bash echo -e "R-id,reaction\n0,COC(=O)[C@H](CCCCNC(=O)OCc1ccccc1)NC(=O)Nc1cc(OC)cc(C(C)(C)C)c1O>>COC(=O)[C@H](CCCCN)NC(=O)Nc1cc(OC)cc(C(C)(C)C)c1O" > test.csv python -m syntemp --data_path test.csv --rebalancing --id 'R-id' --rsmi 'reaction' --rerun_aam --fix_hydrogen --log_file ./log.txt --save_dir ./

Reproduce templates extraction

Run these commands from the root of the cloned repository. bash python -m syntemp --data_path Data/USPTO_50K_original.csv --log_file Data/Test/log.txt --save_dir Data/Test/ --rebalancing --fix_hydrogen --rerun_aam --n_jobs 3 --batch_size 1000 --rsmi reactions --id ID

Publication

SynTemp: Efficient Extraction of Graph-Based Reaction Rules from Large-Scale Reaction Databases

Citation

@article{phan2025syntemp, title={SynTemp: Efficient Extraction of Graph-Based Reaction Rules from Large-Scale Reaction Databases}, author={Phan, Tieu-Long and Weinbauer, Klaus and Laffitte, Marcos E Gonz{\'a}lez and Pan, Yingjie and Merkle, Daniel and Andersen, Jakob L and Fagerberg, Rolf and Flamm, Christoph and Stadler, Peter F}, journal={Journal of Chemical Information and Modeling}, volume={65}, number={6}, pages={2882--2896}, year={2025}, publisher={ACS Publications} }

Contributing

License

This project is licensed under MIT License - see the License file for details.

Acknowledgments

This project has received funding from the European Unions Horizon Europe Doctoral Network programme under the Marie-Skłodowska-Curie grant agreement No 101072930 (TACsy -- Training Alliance for Computational)

Owner

  • Name: Tieu Long Phan
  • Login: TieuLongPhan
  • Kind: user
  • Location: Vietnam
  • Company: University of Medicine and Pharmacy at Ho Chi Minh city

MS. in Pharmacy; Expertise in applying machine learning techniques, cheminformatics and automated pipeline to screen new biologically active molecules.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Phan"
  given-names: "Tieu-Long"
  orcid: "https://orcid.org/0000-0002-3532-2064"
- family-names: "Weinbauer"
  given-names: "Klaus"
  orcid: "https://orcid.org/0000-0002-3349-9157"
- family-names: "Laffitte"
  given-names: "Marcos E. González"
  orcid: "https://orcid.org/0009-0008-2307-595X"
- family-names: "Pan"
  given-names: "Yingjie"
  orcid: "https://orcid.org/0009-0009-4370-6648"
- family-names: "Merkle"
  given-names: "Daniel"
  orcid: "https://orcid.org/0000-0001-7792-375X"
- family-names: "Andersen"
  given-names: "Jakob L."
  orcid: "https://orcid.org/0000-0002-4165-3732"
- family-names: "Fagerberg"
  given-names: "Rolf"
  orcid: "https://orcid.org/0000-0003-1004-3314"
- family-names: "Flamm"
  given-names: "Christoph"
  orcid: "https://orcid.org/0000-0001-5500-2415"
- family-names: "Stadler"
  given-names: "Peter F."
  orcid: "https://orcid.org/0000-0002-5016-5191"
title: "SynTemp: Efficient Extraction of Graph-Based Reaction Rules from Large-Scale Reaction Databases"
version: 1.0.0
doi: 10.1021/acs.jcim.4c01795
preferred-citation:
  type: "article"
  authors:
  - family-names: "Phan"
    given-names: "Tieu-Long"
    orcid: "https://orcid.org/0000-0002-3532-2064"
  - family-names: "Weinbauer"
    given-names: "Klaus"
    orcid: "https://orcid.org/0000-0002-3349-9157"
  - family-names: "Laffitte"
    given-names: "Marcos E. González"
    orcid: "https://orcid.org/0009-0008-2307-595X"
  - family-names: "Pan"
    given-names: "Yingjie"
    orcid: "https://orcid.org/0009-0009-4370-6648"
  - family-names: "Merkle"
    given-names: "Daniel"
    orcid: "https://orcid.org/0000-0001-7792-375X"
  - family-names: "Andersen"
    given-names: "Jakob L."
    orcid: "https://orcid.org/0000-0002-4165-3732"
  - family-names: "Fagerberg"
    given-names: "Rolf"
    orcid: "https://orcid.org/0000-0003-1004-3314"
  - family-names: "Flamm"
    given-names: "Christoph"
    orcid: "https://orcid.org/0000-0001-5500-2415"
  - family-names: "Stadler"
    given-names: "Peter F."
    orcid: "https://orcid.org/0000-0002-5016-5191"
  title: "SynTemp: Efficient Extraction of Graph-Based Reaction Rules from Large-Scale Reaction Databases"
  journal: "Journal of Chemical Information and Modeling"
  year: 2025
  month: 2
  volume: 65
  number: 6
  doi: "10.1021/acs.jcim.4c01795"
  url: "https://doi.org/10.1021/acs.jcim.4c01795"

GitHub Events

Total
  • Release event: 6
  • Watch event: 8
  • Issue comment event: 1
  • Push event: 35
  • Pull request event: 16
  • Create event: 7
Last Year
  • Release event: 6
  • Watch event: 8
  • Issue comment event: 1
  • Push event: 35
  • Pull request event: 16
  • Create event: 7

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 105 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 10
  • Total maintainers: 1
pypi.org: syntemp

Graph-based reaction templates extraction

  • Versions: 10
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 105 Last month
Rankings
Dependent packages count: 10.2%
Average: 34.0%
Dependent repos count: 57.7%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/publish-package.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v4 composite
  • actions/setup-python v3 composite
  • actions/upload-artifact v4 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/test-and-lint.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
pyproject.toml pypi
  • chython ==1.75
  • chytorch ==1.60
  • chytorch-rxnmap ==1.4
  • dgl ==2.1.0
  • dgllife ==0.3.2
  • fgutils ==0.0.17
  • joblib ==1.3.2
  • localmapper ==0.1.3
  • networkx ==3.3
  • rdkit ==2023.9.5
  • rxn-chem-utils ==1.5.0
  • rxn-utils ==2.0.0
  • rxnmapper ==0.3.0
  • seaborn ==0.13.2
  • torchdata ==0.7.1
requirements.txt pypi
  • chython ==1.75
  • chytorch ==1.60
  • chytorch-rxnmap ==1.4
  • dgl ==2.1.0
  • dgllife ==0.3.2
  • fgutils ==0.0.17
  • joblib ==1.3.2
  • localmapper ==0.1.3
  • networkx ==3.3
  • rdkit ==2023.9.5
  • rxn-chem-utils ==1.5.0
  • rxn-utils ==2.0.0
  • rxnmapper ==0.3.0
  • seaborn ==0.13.2
  • torchdata ==0.7.1
.github/workflows/verify-pypi-install.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite