Skip to main content

Utility for reaction modeling using graph grammar

Project description

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)

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

synrecon-0.0.1.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

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

synrecon-0.0.1-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file synrecon-0.0.1.tar.gz.

File metadata

  • Download URL: synrecon-0.0.1.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for synrecon-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3be21a5a8edc055e7d8a1cacff92b051759dc00b1cf8243017f54e3124ef55c5
MD5 c74317b593fe11cc640a076724bb4686
BLAKE2b-256 0b07218514d380af8616e2abb3b075fa5d733823d3559b3d4f540319465beb96

See more details on using hashes here.

Provenance

The following attestation bundles were made for synrecon-0.0.1.tar.gz:

Publisher: publish-package.yml on TieuLongPhan/SynRecon

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

File details

Details for the file synrecon-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: synrecon-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for synrecon-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e0d7bbde33305255fec795759b5f89b465ecdc93ce4879832c21cb8a2087a6f9
MD5 9b9e3142a8595b47a2796c395a726698
BLAKE2b-256 32f2869d194cc19326f60d39e7bd51389a69ce6d82e56c2c835f9628356644ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for synrecon-0.0.1-py3-none-any.whl:

Publisher: publish-package.yml on TieuLongPhan/SynRecon

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