Page
Library
Module
Module type
Parameter
Class
Class type
Source
KaSim is a stochastic simulator for rule-based models written in Kappa. KaSa is a static analyser for Kappa models.
Kappy is a python library to launch and analyse runs and outputs of Kappa models.
If you are new to Kappa, the easiest way to start experimenting with it is using the webapp.
It's available directly in your browser, or for more performance as a downloadable electron app, available for MacOS, Windows and Linux.
Kappa tools are also available as Command-Line Interface programs, which you can either build following the instructions below, or find the binaries included with the electron app in subdir resources/bin
.
If you would like to use python to interact with the Kappa tools, the kappy
lib is where to look. Here's an example of its usage with ipython
In [2]: import kappy
In [3]: model_text = "%agent: A(x)\nA(x[.]), A(x[.]) <-> A(x[1]), A(x[1]) @ 1e-2,1\n%plot: |A(x[.])|\n%init: 100 A()"
In [4]: kappa_client = kappy.KappaStd()
In [5]: kappa_client.add_model_string(model_text)
Out[5]: [...]
In [6]: kappa_client.project_parse()
Out[6]: [...]
In [7]: kappa_client.simulation_start(kappy.SimulationParameter(.1,"[T] > 10"))
Out[7]: {'simulation_artifact_simulation_seed': 297327779}
In [8]: kappa_client.wait_for_simulation_stop()
Out[8]: [...]
In [9]: kappa_client.simulation_plot()
Out[9]:
[6.7, 48.0],
[...]
[0.4, 60.0],
[0.3, 50.0],
[0.2, 64.0],
[0.1, 62.0],
[0.0, 100.0]]}
See the install instructions to start using kappy.
See documentation page on kappalanguage.org.
Kappy API documentation is online.
The latex sources of the "older" reference manual (and KaSa one) are available in the man/
directory. To compile the manuel, in addition of a decent LaTeX distribution you need gnuplot and graphviz to generate images (make sure that dot
is in the PATH of your OS). To generate the pdf of the manual type
make doc
Released versions come with binaries for MacOS, Windows and Debian derivatives (as Ubuntu). Nightly builds of the master branch are built for these platforms by the continuous integration tools.
If you want or need your own build,
opam init
)opam install --deps-only pinned_libs/default
if your OS is OSX or linux, or opam install --deps-only pinned_libs/windows
if your OS is Windows.dune build
You can be more fine grained if you only need the command-line tools (and therefore could install less dependencies) by doing opam install --deps-only kappa-binaries
followed by make all
If nothing worked for you so far. Well, you're pretty much on your own... Kappa tools depend upon the OCaml native compiler version 4.05.0 or above as well as dune, findlib, Lwt (>= 2.6.0), Re, Fmt, Logs and Yojson libraries. Find any way to install them and you'll be only a make all
away from getting Kappa binaries...
You should be able to pip install kappy
.
opam install kappa-binaries kappa-agents
(or use an externaly hosted REST API)In order to run a simulation for 100 time units printing observables values every 0.5 time unit, type
bin/KaSim kappa_file_1 ... kappa_file_n -l 100 -p 0.5 -o data_file
This will produce a data file of 200 point containing the trajectory that was produced during the simulation.
Type:
bin/KaSim --help
for a complete list of options.
Do:
import kappy
client = kappy.KappaStd()
to get a kappa client that uses a kappa agent installed locally. Add a string argument specifing the path/to/KaSimAgent
to use a specific agent.
A minimal example of usage is:
model = "\
%agent: A(x[x.A]) \
%var: n_0 100 \
%var: k_on 1e-2 \
'rule' A(x[.]), A(x[.]) <-> A(x[1]), A(x[1]) @ k_on, 1 \
%plot: |A(x[.])| \
%init: n_0 A()"
client.add_model_string(model)
client.project_parse()
sim_params = kappy.SimulationParameter(pause_condition="[T] > 100",plot_period=1)
client.simulation_start(sim_params)
client.wait_for_simulation_stop()
results = client.simulation_plot()
client.simulation_delete()
# Rerun with some overwritten values for algebraic variables
client.project_parse(k_on=5e-2,n_0=500)
client.simulation_start(sim_params)
client.wait_for_simulation_stop()
results' = client.simulation_plot()
client.shutdown()
Launch the core/integration tests by make check
.
Regenerate the reference files if you've changed something in the outputs by make build-tests
Launch python tests by nosetests
(after having followed the "Get your own build" section).