vermillion 0.1.0
Tazmilur Saad
Fastest stochastic simulator in the west.
USAGE:
vermillion [OPTIONS] --time <TIME> [ALGORITHMS]...
ARGS:
<ALGORITHMS>... List of algorithms to run [possible values: direct, direct-jump]
OPTIONS:
-g, --granularity <GRANULARITY> Set the timestep in seconds
-h, --help Print help information
-r, --repeats <REPEATS> Set number of repeats [default: 1]
-t, --time <TIME> Set the end time for the simulations
-V, --version Print version information
-w, --write Write to disk
- Download and install Rust from here.
- Install git if you don't have it.
- Clone the repository by running
git clone https://github.com/syedtaz/vermillion.git
cd
into the repository- Run
cargo build
The first time you run build
it will take some time since the package manager will download and build
packages for numpy-style arrays, data wrangling, random numbers, etc. However, subsequent builds should
not take long.
The package comes with two systems preloaded. For example, if you want to simulate a simple MRNA degradation
model with a degradation rate of 1.0
.
- Edit the
main.rs
file and uncomment themrna degradation
block. - Open a terminal and
cd
to the main directory. - Run
cargo build
to compile. cd
to/target/debug/
- If you want to run a single simulation for
10.0
seconds and save every timestep- Run
./vermillion -t 10. -w direct
- Run
- Or if you want an average of
5
different repeats of the simulations for10.
seconds with a granularity of0.5
seconds:- Run
./vermillion -a -g 0.5 -r 5 -t 10. -w direct-jump
- Run
- The results should be saved in a
/data/
folder. - Go back to the main directory and run
python3 plotter.py
. You will need to havepandas
andmatplotlib
installed. - A
plot.png
file will be created in your data directory.
If you want to simulate the repressilator system:
- Edit the
main.rs
file and uncomment therepressilator
block. - Open a terminal and
cd
to the main directory. - Run
cargo build
to compile. cd
to/target/debug/
- If you want to run a single simulation for
1000.0
seconds and save every timestep- Run
./vermillion -t 10. -w direct
- Note that the resulting log file can be very large, so this method is not recommended.
- Run
- If you want an average of
5
different repeats of the simulations for1000.
seconds with a granularity of60
seconds:- Run
./vermillion -a -g 60. -r 5 -t 1000. -w direct-jump
- Run
- The results should be saved in a
/data/
folder. - Go back to the main directory and run
python3 plotter.py
. You will need to havepandas
andmatplotlib
installed. - A
plot.png
file will be created in your data directory.
Vermillion can simulate a system in two ways: it can run a complete simulation of every time jump, or you
can specify a granularity g
and it will only save the results at every g
timestep. In the main.rs
file, you will have to specify a system and its initial conditions and then from the command line
pass in arguments that will define how long you want to simulate, the granularity, whether to save the results
or not and so on.
In order to write your own system called mysystem
:
- Go to the examples directory.
- Create a
mysystem.rs
file. - Edit the
examples.rs
file by addingpub mod mysystem;
- In your
mysystem.rs
file, import the System trait by adding to the topuse crate::system::System;
- Add a struct
pub struct MySystem {}
- Implement the functionality described the
System
trait.- Essentially your system must have four specific functions:
- A propensity function that takes in the current state and mutates it with the new propensities.
- An update function that takes in a reaction that fired and the state, and applies the changes.
- A name function that returns the name of the system to be used when logging the results.
- A size function that returns the number of reactions in the system.
- Essentially your system must have four specific functions:
- Compile by running
cargo build
and edit themain.rs
file to call your system.