Skip to content

Kappa Language Introduction

Alejandro Bernardin edited this page Aug 7, 2017 · 2 revisions

Kappa Syntax

The next information is available in KaSim/Kappa documentation, but we put here a brief resume for a fast implementation of a model in PISKaS.

Agent

We define an agent in the following way

%agent: AgentName(site1~STATE1~STATE2, site2~STATE1, site3)

that mean the agent 'AgentName' has 3 sites, the first site is called 'site1' and has 2 possibles states, STATE1 and STATE2. Equal to site2. The third site 'site3' has no states.

Agents binding

We can join two agents, binding by a site, in the following way

agentA(s~T, c!1), agentB(s~U, d!1)

that means that agentA and agentB are binding each other by the c and d site respectively. The sign ! and it consecutive number make the binding.

Rules

The rules are what governs the agent interactions. A rules syntax is given by

'ruleName' agentA(),agentB() -> agentC() @ 1.5

in this case agentA and agentB joint and create the agentC with a rate of 1.5. In the other example, we have

'ruleName' agentA(c~A), agentB(c~B) -> agentA(c~B), agentB(c~B) @ 0.5

where the interaction among agentA and agentB change the state of site c (from A to B) of agentA with a rate of 0.5. If the rate is replaced with an '[inf]', the reaction will always occur. Note that the rules are commutatives, ie,

'ruleName' agentA(),agentB() -> agentC() @ 1.5

is equal to

'ruleName' agentB(),agentA() -> agentC() @ 1.5

so you don't have to define two operations.

Variables

We can define some variables in the following way

%var: 'varName' 50

which is the same to varName=50. We can also do something like

%var: 'agentNumberA' agentA()

where we are defining agentNumberA equals to the number of agents with name agentA.

Observable

We can define the output of our simulation in the following way

%obs: 'varOutName' agentA(c~S)

this will show in a column the numbers of agents with name agentA and site c in state S. This can be done with many agents

%obs: 'varOutNameA' agentA(c~S)
%obs: 'varOutNameB' agentB(c~R)

and it will display two columns with the respective number of agents in its respective states.

Perturbation language (Modifications, kind of scripting)

%mod:

In this link there is a very detailed description of the perturbation language.

You can find a more detailed description about Kappa language here:

http://www.kappalanguage.org/syntax.html

and you can also read the KaSim manual here in pdf or here in html.

Clone this wiki locally