{"id":16518108,"url":"https://github.com/armavica/rebop","last_synced_at":"2025-04-05T14:04:37.039Z","repository":{"id":62443790,"uuid":"123193649","full_name":"Armavica/rebop","owner":"Armavica","description":"Fast stochastic simulator for chemical reaction networks","archived":false,"fork":false,"pushed_at":"2025-02-17T15:49:03.000Z","size":477,"stargazers_count":46,"open_issues_count":9,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T13:08:19.180Z","etag":null,"topics":["gillespie","monte-carlo","science","scientific-computing","simulation","systems-biology"],"latest_commit_sha":null,"homepage":"https://armavica.github.io/rebop/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Armavica.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-27T21:56:38.000Z","updated_at":"2025-02-17T15:48:18.000Z","dependencies_parsed_at":"2023-09-24T05:09:41.716Z","dependency_job_id":"ca51fccc-7580-4b70-9010-8b0209e0b3dc","html_url":"https://github.com/Armavica/rebop","commit_stats":{"total_commits":109,"total_committers":2,"mean_commits":54.5,"dds":0.05504587155963303,"last_synced_commit":"10c26203621a805fa64ff209e2ca6130224c0c8d"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Armavica%2Frebop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Armavica%2Frebop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Armavica%2Frebop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Armavica%2Frebop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Armavica","download_url":"https://codeload.github.com/Armavica/rebop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345850,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gillespie","monte-carlo","science","scientific-computing","simulation","systems-biology"],"created_at":"2024-10-11T16:34:54.259Z","updated_at":"2025-04-05T14:04:37.011Z","avatar_url":"https://github.com/Armavica.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"| Rust                                                                                                                                                    | Python                                                                                                                                              |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [![Build status](https://github.com/Armavica/rebop/actions/workflows/rust.yml/badge.svg)](https://github.com/Armavica/rebop/actions/workflows/rust.yml) | [![Build status](https://github.com/Armavica/rebop/actions/workflows/CI.yml/badge.svg)](https://github.com/Armavica/rebop/actions/workflows/CI.yml) |\n| [![Crates.io](https://img.shields.io/crates/v/rebop)](https://crates.io/crates/rebop/)                                                                  | [![PyPI - Version](https://img.shields.io/pypi/v/rebop)](https://pypi.org/project/rebop/)                                                           |\n| [![Docs.rs](https://docs.rs/rebop/badge.svg)](https://docs.rs/rebop/)                                                                                   | [![readthedocs.org](https://readthedocs.org/projects/rebop/badge/?version=latest)](https://rebop.readthedocs.io/en/latest/)                         |\n\n# rebop\n\nrebop is a fast stochastic simulator for well-mixed chemical\nreaction networks.\n\nPerformance and ergonomics are taken very seriously. For this reason,\ntwo independent APIs are provided to describe and simulate reaction\nnetworks:\n\n- a macro-based DSL implemented by \\[`define_system`\\], usually the\n  most efficient, but that requires to compile a rust program;\n- a function-based API implemented by the module \\[`gillespie`\\], also\n  available through Python bindings. This one does not require a rust\n  compilation and allows the system to be defined at run time. It is\n  typically 2 or 3 times slower than the macro DSL, but still faster\n  than all other software tried.\n\n## The macro DSL\n\nIt currently only supports reaction rates defined by the law of mass\naction. The following macro defines a dimerization reaction network\nnaturally:\n\n```rust\nuse rebop::define_system;\ndefine_system! {\n    r_tx r_tl r_dim r_decay_mRNA r_decay_prot;\n    Dimers { gene, mRNA, protein, dimer }\n    transcription   : gene      =\u003e gene + mRNA      @ r_tx\n    translation     : mRNA      =\u003e mRNA + protein   @ r_tl\n    dimerization    : 2 protein =\u003e dimer            @ r_dim\n    decay_mRNA      : mRNA      =\u003e                  @ r_decay_mRNA\n    decay_protein   : protein   =\u003e                  @ r_decay_prot\n}\n```\n\nTo simulate the system, put this definition in a rust code file and\ninstantiate the problem, set the parameters, the initial values, and\nlaunch the simulation:\n\n```rust\nlet mut problem = Dimers::new();\nproblem.r_tx = 25.0;\nproblem.r_tl = 1000.0;\nproblem.r_dim = 0.001;\nproblem.r_decay_mRNA = 0.1;\nproblem.r_decay_prot = 1.0;\nproblem.gene = 1;\nproblem.advance_until(1.0);\nprintln!(\"t = {}: dimer = {}\", problem.t, problem.dimer);\n```\n\nOr for the classic SIR example:\n\n```rust\nuse rebop::define_system;\n\ndefine_system! {\n    r_inf r_heal;\n    SIR { S, I, R }\n    infection   : S + I =\u003e 2 I  @ r_inf\n    healing     : I     =\u003e R    @ r_heal\n}\n\nfn main() {\n    let mut problem = SIR::new();\n    problem.r_inf = 1e-4;\n    problem.r_heal = 0.01;\n    problem.S = 999;\n    problem.I = 1;\n    println!(\"time,S,I,R\");\n    for t in 0..250 {\n        problem.advance_until(t as f64);\n        println!(\"{},{},{},{}\", problem.t, problem.S, problem.I, problem.R);\n    }\n}\n```\n\nwhich can produce an output similar to this one:\n\n![Typical SIR output](https://github.com/Armavica/rebop/blob/main/sir.png?raw=true)\n\n## Python bindings\n\nThis API shines through the Python bindings which allow one to\ndefine a model easily:\n\n```python\nimport rebop\n\nsir = rebop.Gillespie()\nsir.add_reaction(1e-4, ['S', 'I'], ['I', 'I'])\nsir.add_reaction(0.01, ['I'], ['R'])\nprint(sir)\n\nds = sir.run({'S': 999, 'I': 1}, tmax=250, nb_steps=250)\n```\n\nYou can test this code by installing `rebop` from PyPI with\n`pip install rebop`. To build the Python bindings from source,\nthe simplest is to clone this git repository and use `maturin develop`.\n\n## The traditional API\n\nThe function-based API underlying the Python package is also available\nfrom Rust, if you want to be able to define models at run time (instead\nof at compilation time with the macro DSL demonstrated above).\nThe SIR model is defined as:\n\n```rust\nuse rebop::gillespie::{Gillespie, Rate};\n\nlet mut sir = Gillespie::new([999, 1, 0]);\n//                           [  S, I, R]\n// S + I =\u003e 2 I with rate 1e-4\nsir.add_reaction(Rate::lma(1e-4, [1, 1, 0]), [-1, 1, 0]);\n// I =\u003e R with rate 0.01\nsir.add_reaction(Rate::lma(0.01, [0, 1, 0]), [0, -1, 1]);\n\nprintln!(\"time,S,I,R\");\nfor t in 0..250 {\n    sir.advance_until(t as f64);\n    println!(\"{},{},{},{}\", sir.get_time(), sir.get_species(0), sir.get_species(1), sir.get_species(2));\n}\n```\n\n## Performance\n\nPerformance is taken very seriously, and as a result, rebop\noutperforms every other package and programming language that we\ntried.\n\n_Disclaimer_: Most of this software currently contains much more\nfeatures than rebop (e.g. spatial models, custom reaction rates,\netc.). Some of these features might have required them to make\ncompromises on speed. Moreover, as much as we tried to keep the\ncomparison fair, some return too much or too little data, or write\nthem on disk. The baseline that we tried to approach for all these\nprograms is the following: _the model was just modified, we want\nto simulate it `N` times and print regularly spaced measurement\npoints_. This means that we always include initialization or\n(re-)compilation time if applicable. We think that it is the most\ntypical use-case of a researcher who works on the model. This\nbenchmark methods allows to record both the initialization time\n(y-intercept) and the simulation time per simulation (slope).\n\nMany small benchmarks on toy examples are tracked to guide the\ndevelopment. To compare the performance with other software,\nwe used a real-world model of low-medium size (9 species and 16\nreactions): the Vilar oscillator (_Mechanisms of noise-resistance\nin genetic oscillators_, Vilar et al., PNAS 2002). Here, we\nsimulate this model from `t=0` to `t=200`, reporting the state at\ntime intervals of `1` time unit.\n\n![Vilar oscillator benchmark](https://github.com/Armavica/rebop/blob/main/benches/vilar/vilar.png?raw=true)\n\nWe can see that rebop's macro DSL is the fastest of all, both in\ntime per simulation, and with compilation time included. The second\nfastest is rebop's traditional API invoked by convenience through\nthe Python bindings.\n\n## Features to come\n\n- compartment volumes\n- arbitrary reaction rates\n- other SSA algorithms\n- tau-leaping\n- adaptive tau-leaping\n- hybrid models (continuous and discrete)\n- SBML\n- CLI interface\n- parameter estimation\n- local sensitivity analysis\n- parallelization\n\n## Features probably not to come\n\n- events\n- space (reaction-diffusion systems)\n- rule modelling\n\n## Benchmark ideas\n\n- DSMTS\n- purely decoupled exponentials\n- ring\n- Toggle switch\n- LacZ, LacY/LacZ (from STOCKS)\n- Lotka Volterra, Michaelis--Menten, Network (from StochSim)\n- G protein (from SimBiology)\n- Brusselator / Oregonator (from Cellware)\n- GAL, repressilator (from Dizzy)\n\n## Similar software\n\n### Maintained\n\n- [GillesPy2](https://github.com/StochSS/GillesPy2)\n- [STEPS](https://github.com/CNS-OIST/STEPS)\n- [SimBiology](https://fr.mathworks.com/help/simbio/)\n- [Copasi](http://copasi.org/)\n- [BioNetGen](http://bionetgen.org/)\n- [VCell](http://vcell.org/)\n- [Smoldyn](http://www.smoldyn.org/)\n- [KaSim](https://kappalanguage.org/)\n- [StochPy](https://github.com/SystemsBioinformatics/stochpy)\n- [BioSimulator.jl](https://github.com/alanderos91/BioSimulator.jl)\n- [DiffEqJump.jl](https://github.com/SciML/DiffEqJump.jl)\n- [Gillespie.jl](https://github.com/sdwfrost/Gillespie.jl)\n- [GillespieSSA2](https://github.com/rcannood/GillespieSSA2)\n- [Cayenne](https://github.com/quantumbrake/cayenne)\n\n### Seem unmaintained\n\n- [Dizzy](http://magnet.systemsbiology.net/software/Dizzy/)\n- [Cellware](http://www.bii.a-star.edu.sg/achievements/applications/cellware/)\n- [STOCKS](https://doi.org/10.1093/bioinformatics/18.3.470)\n- [StochSim](http://lenoverelab.org/perso/lenov/stochsim.html)\n- [Systems biology toolbox](http://www.sbtoolbox.org/)\n- [StochKit](https://github.com/StochSS/StochKit) (successor: GillesPy2)\n- [SmartCell](http://software.crg.es/smartcell/)\n- [NFsim](http://michaelsneddon.net/nfsim/)\n\nLicense: MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmavica%2Frebop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farmavica%2Frebop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmavica%2Frebop/lists"}