Skip to main content

SynRFP — Graph-based, mapping-free reaction fingerprints

PyPI version Release Last Commit ZENODO CI Stars

SynRFP (Synthesis Reaction FingerPrint) is a mapping-free, permutation-invariant framework for representing chemical transformations as fixed-length fingerprints.
It explicitly factorises the fingerprint pipeline into three modular operators:

  • Ψ (extractor) — isomorphism-invariant subgraph/token extraction from each reaction side;
  • Φ (combination) — algebraic reparameterisation producing the signed net change Δ and total counts U per token;
  • 𝒮 (sketcher) — randomized compression of (Δ,U) into a fixed-dimensional fingerprint f ∈ 𝓕.

SynRFP Workflow


⚙️ Installation

# 1) Clone the repository
git clone https://github.com/TieuLongPhan/synrfp.git
cd synrfp

# 2) Install the package (with optional extras)
pip install .                  # core functionality
pip install .[all]             # with datasketch and pynauty support

or can install via pip

pip install synrfp

🔧 Quick Start

1. Single‐reaction fingerprint

from synrfp.graph.reaction import Reaction
from synrfp import SynRFP
from synrfp.tokenizers.wl import WLTokenizer
from synrfp.sketchers.parity_fold import ParityFold

# Parse RSMI into GraphData
reactant_G, product_G = Reaction.from_rsmi("CCO>>C=C.O")

# Build engine: WL at radius 1 + 1024-bit parity-fold
fp_engine = SynRFP(
    tokenizer=WLTokenizer(),
    radius=1,
    sketch=ParityFold(bits=1024, seed=42),
)

# Compute fingerprint
res = fp_engine.fingerprint(reactant_G, product_G)
print(res)               # SynRFPResult(tokens_R=3 tokens, tokens_P=3 tokens, support=0, sketch_type=bytearray)
bits = res.to_binary()   # [0,1,0,0, …]

2. One‐line wrapper

from synrfp import synrfp

# Generate a 1024-bit binary fingerprint in one call
bits = synrfp(
    "CCO>>C=C.O",
    tokenizer="wl",
    radius=1,
    sketch="parity",
    bits=1024,
    seed=42,
)
print(len(bits), bits[:16])  # e.g. 1024 [0, 1, 0, 0, …]

3. Batch encoding

from synrfp import BatchEncoder

rxn_smiles = [
    "CO.O[C@@H]1CCNC1.[C-]#[N+]CC(=O)OC>>[C-]#[N+]CC(=O)N1CC[C@@H](O)C1",
    "CCOC(=O)C(CC)c1cccnc1.Cl.O>>CCC(C(=O)O)c1cccnc1",
]

# Encode two reactions into a 2×1024 array of bits
fps = BatchEncoder.encode(
    rxn_smiles,
    tokenizer="wl",
    radius=1,
    sketch="parity",
    bits=1024,
    seed=42,
    batch_size=2
)

print(fps.shape)    # (2, 1024)
print(fps[0][:16])  # first 16 bits of the first fingerprint

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)

Metadata

Release files for synrfp 0.0.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 synrfp 0.0.3
File Size Uploaded Provenance Actions
synrfp-0.0.3.tar.gz 7.0 MB With provenance Details for synrfp-0.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 7.0 MB

Release files / synrfp-0.0.3.tar.gz

Download URL synrfp-0.0.3.tar.gz
Size 7.0 MB
Tags Source
SHA-256 checksum
How to use checksums
dd7cfad370f2f2b268ccf57ee3b381aad2a65990d0f612f3ae4066effe622fbd
BLAKE2b-256 checksum
How to use checksums
9670e4df7370bae3f198e5b2cb293e29281e20c442680b7d047fa4f32d4022b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2025.

Transparency log

Release files / synrfp-0.0.3-py3-none-any.whl

Download URL synrfp-0.0.3-py3-none-any.whl
Size 49.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
580f1322aebf867fe9c6e8b0702ec3eb000d09ed6d599a4c8e94bda1345cb82b
BLAKE2b-256 checksum
How to use checksums
e062294492937d4360bf50cf6d1efe8b1fe4acaaac0a4996210d621781af8ed2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2025.

Transparency log

Security for synrfp 0.0.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for synrfp-0.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2025.

Transparency log

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