Skip to main content

Hierarchical reaction templates

Project description

SynEPD

SynEPD is a hierarchical electron-pushing database for polar organic reaction mechanisms. It combines clean reaction records, a POLAR taxonomy, reaction-center templates, atom-mapped reaction graphs, and electron-pushing diagram (EPD) arrows in a local SQLite database with a web explorer.

Official web server: https://synepd.bioinf.uni-leipzig.de

Zenodo release: https://zenodo.org/records/21235892

SynEPD Explorer preview showing the search, taxonomy, statistics, and reaction graph interface

Current Data

The current local build uses the cleaned POLAR dataset:

Item Count
Curated records 1,915
Database reactions 1,915
RC templates 1,497
EPD arrows 7,303
Mechanism contexts 1,915
Taxon rows 1,051
Molecules 2,179

Important files:

Path Purpose
data/polar.json Clean reaction records, IDs starting at 1
data/hierarchy.md Clean hierarchy consumed by the database builder
data/epdb.sqlite Built SQLite database used by the app
data/release-manifest.json Current artifact checksums, semantic version, and counts

Environment

Create or update the Conda environment:

conda env create -f env.yaml
conda activate synepd

For an existing environment:

conda activate synepd
python -m pip install -r requirements.txt

The project metadata lives in pyproject.toml. Runtime dependencies are declared there, and developer tools are available through the dev extra:

python -m pip install -e ".[dev]"

Build The Data

Build the SQLite database:

PYTHONPATH=. python synepd/construct/build_release_db.py

The builder writes data/epdb.sqlite.

Verify the checked-in artifact against its release manifest:

python -m synepd.construct.release_manifest data/epdb.sqlite \
  --verify data/release-manifest.json

Run The Explorer

Use the hosted explorer at:

https://synepd.bioinf.uni-leipzig.de

For local development, start the app with:

./run_server.sh

Open:

http://127.0.0.1:8000/

Stable service routes are exposed under /api/v1; the original /api routes remain compatibility aliases for v0.1 clients.

By default the server reads:

SYNEPD_DATABASE_URL=data/epdb.sqlite

To use another database:

SYNEPD_DATABASE_URL=/path/to/other.sqlite ./run_server.sh

Query Examples

Find reactions that share a reaction-center template:

from pathlib import Path
from synepd.core import find_reactions_by_template

db_path = Path("data/epdb.sqlite")
template_smiles = "[H:2][NH3+:3].[O-:1][CH3:4]>>[NH3:3].[O:1]([H:2])[CH3:4]"

reactions = find_reactions_by_template(template_smiles, db_path=db_path)
print(f"Found {len(reactions)} matching reactions")

Query EPD arrows by reaction SMILES:

from pathlib import Path
from synepd.core import query_epd_by_reaction

db_path = Path("data/epdb.sqlite")
rsmi = "CC[O-].[NH4+]>>CCO"

result = query_epd_by_reaction(rsmi, db_path=db_path)
print(result["success"])
print(result.get("path"))
for arrow in result.get("arrows", []):
    print(arrow["arrow_index"], arrow["arrow_type_code"], arrow["source_atoms"], "->", arrow["target_atoms"])

Query directly from a published release on Zenodo:

from synepd.core import query_epd_by_reaction

rsmi = "CC[O-].[NH4+]>>CCO"
result = query_epd_by_reaction(
    rsmi,
    db_source="zenodo",
    db_version="0.1.0",  # latest configured Zenodo record until v0.2 is published
)

Use the matching GitHub Release asset instead (with a tag-archive fallback):

from synepd.core import get_default_db_path

db_path = get_default_db_path(version="0.1.0", source="github")

For a portable client, prefer Zenodo and fall back to the matching GitHub release automatically:

result = query_epd_by_reaction(
    rsmi,
    db_source="auto",
    db_version="0.1.0",
)

Checks

Useful focused checks:

python -m py_compile synepd/core/ingest.py synepd/construct/build_release_db.py synepd/web/server.py
python -m pytest -q test/construct/test_build_release_db.py test/database/test_database_models.py
python -m pip check

Database Architecture

SynEPD v0.2 stores 1,915 reactions, 1,497 chemistry-aware reaction-center templates, 7,303 EPD arrows, ITS graphs, and one materialized mechanistic context per reaction in a normalized SQLite database. Mechanistic contexts combine an ITS-derived anchor graph with ordered transition and transient-edge events.

Database Architecture Schema

Publishing Notes

The 0.1.0 release is archived on Zenodo at https://zenodo.org/records/21235892. For future releases, add the new Zenodo record ID to ZENODO_RECORD_IDS in synepd/core/data.py. The package itself can then be built and uploaded with:

python -m build
python -m twine upload dist/*

License

The software is licensed under the Apache License 2.0. The curated data release is distributed under CC BY 4.0 where stated in the release metadata. See LICENSE for the software license text.

Acknowledgments

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

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

synepd-0.3.0.tar.gz (107.3 kB view details)

Uploaded Source

Built Distribution

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

synepd-0.3.0-py3-none-any.whl (117.8 kB view details)

Uploaded Python 3

File details

Details for the file synepd-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for synepd-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f24cd55bfa6af5775624eb04240e49c5958cfb1dde8b49365171b66506fc8563
MD5 d09358cdd78d1fc9fc21f5dbda16310a
BLAKE2b-256 2d5a5cb43138c637e78c02b18b1abfe8cfbaed6e8504134d943dcbcd581bbf14

See more details on using hashes here.

Provenance

The following attestation bundles were made for synepd-0.3.0.tar.gz:

Publisher: publish-package.yml on TieuLongPhan/SynEPD

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

File details

Details for the file synepd-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: synepd-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 117.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for synepd-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c4ff9f15682f3b001e88bc939430cbb403b59753dcda65dd8e474d91320510d
MD5 f8fea415489e7e48b4deec219c347bc2
BLAKE2b-256 ff996f4595e1b54e7d9e1a01d7b890715a6c9fba92e56c7c7e721f035181f4a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for synepd-0.3.0-py3-none-any.whl:

Publisher: publish-package.yml on TieuLongPhan/SynEPD

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