Skip to main content

SynRecon

Reconstruct molecular formulas from exact (monoisotopic) mass.

Given a neutral exact (monoisotopic) mass, SynRecon searches for a non-negative integer composition over a chosen element set that matches the mass within a configurable tolerance (default 1e-5 Da). Enumeration is performed using integer scaling with a fast DFS enumeration and an optional ILP backend. Scope: basic single best formula; optional chemistry filters (DBE ≥ 0, even-electron rule, nitrogen rule) can be enabled to tighten results.

Highlights

  • Integer-weight DFS enumeration for raw candidate formulas.
  • Optional chemical filters: DBE, even-electron rule, nitrogen rule.
  • Optional simple isotopologue expansion (e.g. D for H).
  • Small, dependency-light core; optional ILP backend for constrained searches.

Install

pip install synrecon

Quick examples

Python API (recommended)

from synrecon.solver import solve_formula, enumerate_formulas

# single best solution (or None)
sol = solve_formula(
    180.063388104,
    elements=["C", "H", "O"],
    abs_tol_da=1e-5,
    enforce_dbe=True,
)

if sol is None:
    print("No solution found within tolerance.")
else:
    print("Best formula:", sol.formula)
    print("Calculated mass:", sol.mass_calc)
    print("Absolute error (Da):", sol.abs_error)
    print("DBE:", sol.dbe)

# enumerate several candidates (more verbose)
candidates = enumerate_formulas(
    180.063388104,
    elements=["C", "H", "O"],
    abs_tol_da=1e-5,
    enforce_dbe=True,
    max_candidates=20,
    sort_by="abs_error",
)

print("\nTop candidates:")
for s in candidates[:10]:
    print(f"{s.formula:12s} mass={s.mass_calc:.6f} err={s.abs_error:.6e} dbe={s.dbe}")

CLI

synrecon solve --mass 180.063388104 \
              --elements "C H O" \
              --tol 1e-5 \
              --dbe \
              --allow-isotopes \
              --labels "D T"

Contributing

Publication

SynRecon:

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 synrecon 0.0.1

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

Source distribution (sdist)

Source distribution for synrecon 0.0.1
File Size Uploaded Provenance Actions
synrecon-0.0.1.tar.gz 23.9 kB With provenance Details for synrecon-0.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 42.8 kB

Release files / synrecon-0.0.1.tar.gz

Download URL synrecon-0.0.1.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3be21a5a8edc055e7d8a1cacff92b051759dc00b1cf8243017f54e3124ef55c5
BLAKE2b-256 checksum
How to use checksums
0b07218514d380af8616e2abb3b075fa5d733823d3559b3d4f540319465beb96
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 Oct 15, 2025.

Transparency log

Release files / synrecon-0.0.1-py3-none-any.whl

Download URL synrecon-0.0.1-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0d7bbde33305255fec795759b5f89b465ecdc93ce4879832c21cb8a2087a6f9
BLAKE2b-256 checksum
How to use checksums
32f2869d194cc19326f60d39e7bd51389a69ce6d82e56c2c835f9628356644ac
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 Oct 15, 2025.

Transparency log

Security for synrecon 0.0.1

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 synrecon-0.0.1.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 Oct 15, 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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

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