https://github.com/brsynth/rxn_rebuild
Rebuild full reaction from reaction rule
https://github.com/brsynth/rxn_rebuild
Last synced: 2 months ago
JSON representation
Rebuild full reaction from reaction rule
- Host: GitHub
- URL: https://github.com/brsynth/rxn_rebuild
- Owner: brsynth
- License: mit
- Created: 2021-04-08T12:46:46.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2026-02-26T11:25:01.000Z (4 months ago)
- Last Synced: 2026-02-26T17:49:55.887Z (4 months ago)
- Language: Python
- Size: 270 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Authors: AUTHORS.md
Awesome Lists containing this project
README
# rxn_rebuild
Rebuild full reaction from reaction rule
| Name | Downloads | Version | Platforms |
| --- | --- | --- | --- |
| [](https://anaconda.org/conda-forge/rxn_rebuild) | [](https://anaconda.org/conda-forge/rxn_rebuild) | [](https://anaconda.org/conda-forge/rxn_rebuild) | [](https://anaconda.org/conda-forge/rxn_rebuild) |
## Description
*rxn_rebuild* provides a cache for RetroRules and MetaNetX compounds and reactions
# rxn_rebuild
[](https://anaconda.org/brsynth/rxn_rebuild) [](https://anaconda.org/brsynth/rxn_rebuild)
Rebuild full reaction from a reaction rule ID and a chemical transformation by adding co-factors removed when the rule has been generated. The algorithm proceeds to the following:
- seeks for the reaction(s) rule(s) of the given reaction rule ID, in the cache
- for each reaction rule
- seeks for the template reaction of the given reaction rule ID, in the cache
- find compounds to add by doing the difference between the template reaction and the reaction rule
## Input
- reaction rule ID
- chemical transfomation as SMILES (xxx.xxx>>xxx.xxx) or IDs (CMPD_ID_1 + CMPD_ID_2 = CMPD_ID_3)
- (Optional) template reaction ID
## Output
- Prints out the full completed transformation
- Returns a dictionary with the following keys:
- 'full_transfo': completed transformation (SMILES or IDs)
- 'added_cmpds': sub-dictionary of compounds to add to the transformation with:
- keys: IDs
- values: infos (SMILES, InChI, InChIKey, formula, name)
## Install
The conda package manager is required. Fresh instructions on how to install conda are [available online](https://docs.conda.io/projects/conda/en/latest/user-guide/install/).
```shell
conda install -c conda-forge rxn_rebuild
```
## Run
### rxn_rebuild process
**From CLI**
```sh
python -m rxn_rebuild []
```
**From Python code**
```python
from rxn_rebuild import rebuild_rxn, build_args_parser
parser = build_args_parser()
args = parser.parse_args()
completed_transfos = rebuild_rxn(
rxn_rule_id=args.rxn_rule_id,
transfo=args.trans_smi,
tmpl_rxn_id=args.ori_rxn_id
)
```
If `cache` is not provided, it ill be automatically loaded within `rebuild_rxn` function but it could be much slower if called inside a loop.
## Tests
Test can be run with the following commands:
### Natively
```bash
cd tests
pytest -v
```
# CI/CD
For further tests and development tools, a CI toolkit is provided in `ci` folder (see [ci/README.md](ci/README.md)).