https://github.com/brsynth/rrparser
Reaction rules parser
https://github.com/brsynth/rrparser
Last synced: 8 months ago
JSON representation
Reaction rules parser
- Host: GitHub
- URL: https://github.com/brsynth/rrparser
- Owner: brsynth
- License: mit
- Created: 2020-07-02T08:53:24.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-31T09:48:29.000Z (about 1 year ago)
- Last Synced: 2025-10-21T19:59:05.766Z (8 months ago)
- Language: Python
- Homepage:
- Size: 357 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# rrparser
Reaction Rules Parser
| Name | Downloads | Version | Platforms |
| --- | --- | --- | --- |
| [](https://anaconda.org/conda-forge/rrparser) | [](https://anaconda.org/conda-forge/rrparser) | [](https://anaconda.org/conda-forge/rrparser) | [](https://anaconda.org/conda-forge/rrparser) |
[](https://github.com/brsynth/RRParser/actions/workflows/code_quality.yml) [](https://github.com/brsynth/RRParser/actions/workflows/test.yml)
## Description
*Reaction Rules Parser*. If no input reaction files is provided, retrieves the reaction rules from [RetroRules](https://retrorules.org).
## Input
* **rules-file**: (string) Filename of reaction rules
* **outfile**: (string) Filename containing the result of the parsing. If not set, result is printed out in the console. If ends with '.gz', it will be gzipped.
* **input-format**: (string) Valid options: csv, tsv. Format of the input file
* **rule-type**: (string) Valid options: retro, forward, all. Return the rules that are in reverse, forward or both direction
* **diameters**: (integer list) Valid options: 2, 4, 6, 8, 10, 12, 14, 16. The diameter of the rules to return
* **output-format**: (string) Valid options: csv, tar.gz. Format of the returned file
## Install
### From Conda
```sh
[sudo] conda install -c conda-forge rrparser
```
## Use
### Function call from Python code
```python
from rrparser import parse_rules
outfile = parse_rules(
,
,
input_format=<'csv' | 'tsv'>,
rule_type=<'all' | 'retro' | 'forward'>,
diameters=<'2,4,6,8,10,12,14,16'>,
output_format=<'csv' | 'tsv'>
)
```
If parameters from CLI have to be parsed, the function `build_args_parser` is available:
```python
from rrparser import build_args_parser
parser = buildparser()
params = parser.parse_args()
```
### Run from CLI
```sh
python -m rrparser \
rules-file \
[--input-format {csv,tsv}] \
[--rule-type {all,retro,forward}] \
[--outfile ] \
[--diameters {2,4,6,8,10,12,14,16}] \
[--output-format {csv,tsv}]
```
If `rules_files` is set to `retrorules`, RetroRules are fetched from `retrorules.org` and considered as input file.
## Tests
Test can be run with the following commands:
### Natively
```bash
python -m 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)).
## Authors
* **Joan Hérisson**
* Melchior du Lac
* Thomas Duigou
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
### How to cite RetroRules?
Please cite:
Duigou, Thomas, et al. "RetroRules: a database of reaction rules for engineering biology." Nucleic acids research 47.D1 (2019): D1229-D1235.