## The *mois* Quickstart Guide ##
*mois* is an [http://www.scala-sbt.org][1] project. Prerequisites for running it include the Scala Build Tool, [Java Runtime Environment][2], and [git][3]. The following commands are for Debian GNU/Linux derived systems, but Windows and Macintosh environments will follow the same general procedure.
## install prerequisites (do this manually from above links on Win and Mac)
sudo apt-get install openjdk-7-jre git
## prepare directories (bin, lib, and src)
cd ~
mkdir -p bin lib src
# download sbt from http://www.scala-sbt.org/
## unpack and install sbt into lib
cd ~/lib; gzip -dc ~/Downloads/sbt*.tgz
## add sbt to the path (important, if unsure Google for your environment!)
cd ~/bin; ln -s ~/lib/sbt/bin/sbt .
cd ~; . ./.profile
## get mois and model source code from github
cd ~/src
git clone https://github.com/edinburgh-rbm/mois
git clone https://github.com/edinburgh-rbm/mois-examples
git clone https://github.com/edinburgh-rbm/weisse
Running *sbt* from the terminal (in the appropriate directory, in this case the weisse directory) gives us an interactive shell in which we may employ the *run* command. For example, to simulate the Weisse whole-cell model, use the following command (or variant thereof).
cd weisse
sbt
> run model --duration 10 --steps 100 --output gui \.WeisseModel
For further information regarding *mois* commands and options, use the help option.
> run help
----------------------------
## The Weisse Whole-Cell Model in *mois* ##
We implement the Weisse whole-cell model in *mois* as a deterministic reaction network (from which *mois* automatically derives the underlying system of ODEs for integration). The source code for this model is available [here][4].
We open the code with model annotation (including copyright and licensing statements) and import declarations from the *mois* source. The bulk of the model proper comes after these declarations, in the form of three Scala classes: WeisseRates, WeisseCell, and WeisseModel.
- WeisseModel is the overall model class: it defines the processes involved in the whole-cell model and the scheduler by which they communicate, the parameters to the processes, and the initial conditions.
- The WeisseRates process derives rate calculations for the main process (such that we do not perform the same calculation multiple times during a step).
- The WeisseCell process contains the deterministic reaction network proper.
Let us take a closer look at the WeisseCell class, to better understand how we define the reaction network. The process consists of two main components: variable definitions and reactions. The variable definitions allow us to state the species (reactants) of interest to our system, along with constraints on their behaviour such as the nonnegative() modifier to prevent the value of the species from dropping below zero. Variable definitions also allow us to import the rates calculated in WeisseRates. In a complete model implementation we may wish to further tag these variables with descriptions and annotations, but for the moment we leave these blank.
We make use of these variables in the set of reactions that comprise the whole-cell model, which we group into seven chapters for ease of representation: nutrient import, nutrient metabolism, transcription, translation, mRNA degradation, dilution, and antibiotic action. The reactions are written in the form:
'precondition' --> 'effect' at 'rate'
We leave deciphering the effect of these reactions to the reader (who hopefully by now is familiar with the structure of the Weisse model and the differential equations that underlie it). Taken as a whole, the deterministic reaction network recreates the Weisse whole-cell model.
----------------------------
## Working with the Weisse Model ##
A few questions to help you get started!
Open *sbt* in the *weisse* subdirectory, and run the Weisse model with the following command:
> run model --duration 1000 --steps 10000 --output tsv:data.out \.WeisseModel
This generates an output file (data.out - feel free to change this as you wish!) which is simply a time series of tab-separated values (for example, you should be able to import this easily into your favourite spreadsheet software for inspection and visualisation). Notice that this time series is generated from the default initial conditions, defined at the end of the WeisseModel class:
Double("a") default(1.0)
Double("r") default(1.0)
What effect does changing these initial conditions have on the model? Does it reach a steady state, and if so, the same one every time? Can you perturb this steady state (i.e. nutrient shock!) in a meaningful manner?
Also think about working with the monolithic deterministic reaction network: can you split it up (modularise it) into meaningful subcomponents? How easy is this to do in *mois*? Or perhaps you're more interested in verifying the functionality of the reactions - how might you go about doing this?
[1]: http://www.scala-sbt.org
[2]: https://java.com/en/download/
[3]: http://git-scm.com/downloads
[4]: https://osf.io/j8a59/?sha=031adadccf93a404f601376310d675d738044fde&branch=master