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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3be21a5a8edc055e7d8a1cacff92b051759dc00b1cf8243017f54e3124ef55c5
|
|
| MD5 |
c74317b593fe11cc640a076724bb4686
|
|
| BLAKE2b-256 |
0b07218514d380af8616e2abb3b075fa5d733823d3559b3d4f540319465beb96
|
Provenance
The following attestation bundles were made for synrecon-0.0.1.tar.gz:
Publisher:
publish-package.yml on TieuLongPhan/SynRecon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
synrecon-0.0.1.tar.gz -
Subject digest:
3be21a5a8edc055e7d8a1cacff92b051759dc00b1cf8243017f54e3124ef55c5 - Sigstore transparency entry: 607658850
- Sigstore integration time:
-
Permalink:
TieuLongPhan/SynRecon@72ed4dec710b78f9f996057a9cee7427aa91e850 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/TieuLongPhan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@72ed4dec710b78f9f996057a9cee7427aa91e850 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0d7bbde33305255fec795759b5f89b465ecdc93ce4879832c21cb8a2087a6f9
|
|
| MD5 |
9b9e3142a8595b47a2796c395a726698
|
|
| BLAKE2b-256 |
32f2869d194cc19326f60d39e7bd51389a69ce6d82e56c2c835f9628356644ac
|
Provenance
The following attestation bundles were made for synrecon-0.0.1-py3-none-any.whl:
Publisher:
publish-package.yml on TieuLongPhan/SynRecon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
synrecon-0.0.1-py3-none-any.whl -
Subject digest:
e0d7bbde33305255fec795759b5f89b465ecdc93ce4879832c21cb8a2087a6f9 - Sigstore transparency entry: 607658854
- Sigstore integration time:
-
Permalink:
TieuLongPhan/SynRecon@72ed4dec710b78f9f996057a9cee7427aa91e850 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/TieuLongPhan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@72ed4dec710b78f9f996057a9cee7427aa91e850 -
Trigger Event:
release
-
Statement type: