Scala library for biochemical network simulation, associated with the 3rd edition of the textbook Stochastic Modelling for Systems Biology
Switch branches/tags
Clone or download
Latest commit a7d9f13 Nov 28, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs bumping version numbers to 0.4 Nov 28, 2018
examples bumped to 0.5-SNAPSHOT Nov 28, 2018
project initial scala project template Jul 20, 2018
src ABC-SMC working Nov 28, 2018
.gitignore Initial commit May 13, 2018
LICENSE Initial commit May 13, 2018
LV-trajectory.png starting on a readme Jul 24, 2018
Makefile working on rejection ABC example Nov 25, 2018
README.md bumping version numbers to 0.4 Nov 28, 2018
build.sbt bumped to 0.5-SNAPSHOT Nov 28, 2018
sonatype.sbt fix typos in sonatype details Nov 6, 2018

README.md

scala-smfsb

Scala library for biochemical network simulation, associated with the 3rd edition of the textbook Stochastic Modelling for Systems Biology

This library is now ready to use, but is still undergoing rapid development, with regular updates likely until the end of 2018, by which time it should have approximate feature parity with the R package smfsb

  • The current stable version of this library is "0.4"
  • The current unstable snapshot release of this library is "0.5-SNAPSHOT"

Binaries are published to Sonatype, cross-built for Scala 2.11.x and 2.12.x.

Quickstart

  • To use this software library, you should first install a recent JDK and Sbt.
  • Run sbt from an empty/temp directory
  • At the sbt prompt, enter:
set libraryDependencies += "com.github.darrenjw" %% "scala-smfsb" % "0.4"
set libraryDependencies += "org.scalanlp" %% "breeze-viz" % "0.13.2"
set scalaVersion := "2.12.6"
console
  • You should now have a Scala REPL with a dependency on this library. At the Scala REPL, enter the following:
import smfsb._
import breeze.linalg._
val model = SpnModels.lv[IntState]()
val step = Step.gillespie(model)
val ts = Sim.ts(DenseVector(50, 40), 0.0, 20.0, 0.1, step)
Sim.plotTs(ts)
  • This should simulate a trajectory from a Lotka-Volterra model and plot the result in a window on the console which looks a little bit like the following:

Lotka-Volterra trajectory

To get the most out of this library, it will be helpful if you are already familiar with the R package smfsb associated with the (2nd or) 3rd edition of the textbook Stochastic modelling for systems biology, and have a basic familiarity with Scala and Breeze. For those new to Scala, my course on Scala for statistical computing is a good place to start.

Documentation

  • Tutorial - walk through of basic functionality
  • There are more interesting examples in the examples directory. To run them, download or clone the repo, and do sbt run from inside the examples directory.
  • Latest API docs

Using the library in your own Scala projects

Stable:

Just add:

"com.github.darrenjw" %% "scala-smfsb" % "0.4"

to your Sbt dependencies. You might also need to add an explicit dependence on breeze-viz:

"org.scalanlp" %% "breeze-viz" % "0.13.2"

Snapshot:

Just add something like:

libraryDependencies += "com.github.darrenjw" %% "scala-smfsb" % "0.5-SNAPSHOT"
resolvers += "Sonatype Snapshots" at
    "https://oss.sonatype.org/content/repositories/snapshots/"

to your Sbt build file.

Building from source

Download or clone the repo and do:

sbt clean compile test doc package

from the top-level directory.