Scala library for stochastic kinetic modelling, biochemical network simulation, and parameter inference, associated with the 3rd edition of the textbook Stochastic Modelling for Systems Biology
- The current stable version of this library is "1.0", for Scala 2.13 and Scala 3
- Use version "0.7" for Scala 2.11 and 2.12
- The current unstable snapshot release of this library is "1.1-SNAPSHOT" (cross-built for Scala 2.13 and Scala 3)
Binaries are published to Sonatype.
- To use this software library, you should first install a recent JDK and sbt.
sbtfrom an empty/temp directory:
sbt "-Dsbt.version=1.8.0" set libraryDependencies += "com.github.darrenjw" %% "scala-smfsb" % "1.0" set libraryDependencies += "org.scalanlp" %% "breeze-viz" % "2.1.0" set scalaVersion := "3.2.1" 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:
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.
- 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 runfrom inside the examples directory.
- Latest API docs
- I also have a couple of (oldish) blog posts: An introduction to scala-smfsb - a "taster", and a post looking at stochastic reaction-diffusion modelling using the library. But please note that these use an older version of the library and an older version of Scala, so a few details may need updating.
Using the library in your own Scala projects
To create a new Scala
sbt project template, just use:
sbt new darrenjw/scala-smfsb.g8
This will create a new project including a dependence on the stable version of the library.
"com.github.darrenjw" %% "scala-smfsb" % "1.0"
sbt library dependencies. You might also need to add an explicit dependence on
"org.scalanlp" %% "breeze-viz" % "2.1.0"
Just add something like:
libraryDependencies += "com.github.darrenjw" %% "scala-smfsb" % "1.1-SNAPSHOT" resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
sbt build file.
Building from source
Download or clone the repo and do something like:
sbt clean compile doc mdoc test +package
from the top-level directory (the directory containing