Difference between revisions of "Team:Czech Republic/Software/Manual"
(Created page with "{{:Team:Czech_Republic/Template:Top|Software Manual}} {{:Team:Czech_Republic/Template:Bottom}}") |
|||
Line 1: | Line 1: | ||
{{:Team:Czech_Republic/Template:Top|Software Manual}} | {{:Team:Czech_Republic/Template:Top|Software Manual}} | ||
+ | __TOC__ | ||
+ | The CeCe simulator is modular simulator primary designed for modeling signal transmission networks in microfluidics. The simulator architecture is mainly modular where functionality is provided by plugins. Each plugin is responsible for specific part of simulation (may not be used). | ||
+ | = Applications = | ||
+ | |||
+ | === CLI === | ||
+ | |||
+ | Simple command line application that can run prepared simulations. It takes simulation file and perform simulation with optional visualization. | ||
+ | |||
+ | ===== Parameters: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Parameters | ||
+ | !Description | ||
+ | !Notes | ||
+ | |- | ||
+ | |<code>simulation-file</code> | ||
+ | |<code>filepath</code> | ||
+ | |Path to simulation file. | ||
+ | | | ||
+ | |- | ||
+ | |<code>--plugins</code> | ||
+ | | | ||
+ | |Prints a list of available plugins. | ||
+ | | | ||
+ | |- | ||
+ | |<code>--help</code> | ||
+ | | | ||
+ | |Prints help. | ||
+ | | | ||
+ | |- | ||
+ | |<code>--visualize</code> | ||
+ | | | ||
+ | |If simulation should be visualized. | ||
+ | | | ||
+ | |- | ||
+ | |<code>--novisualize</code> | ||
+ | | | ||
+ | |Don’t visualize simulation. | ||
+ | | | ||
+ | |- | ||
+ | |<code>--fullscreen</code> | ||
+ | | | ||
+ | |Start visualization window in fullscreen. You don’t have to specify window width and height. In that case monitor size is used. | ||
+ | | | ||
+ | |- | ||
+ | |<code>--width</code> | ||
+ | |<code>int</code> | ||
+ | |Visualization window width. | ||
+ | | | ||
+ | |- | ||
+ | |<code>--height</code> | ||
+ | |<code>int</code> | ||
+ | |Visualization window height. | ||
+ | | | ||
+ | |- | ||
+ | |<code>--capture</code> | ||
+ | |<code>filepath</code> | ||
+ | |Record video from simulation. Visualization is required. | ||
+ | |May not be available in some builds. Check <code>--help</code> if is supported. | ||
+ | |} | ||
+ | |||
+ | Specifying <code>--visualize</code> or <code>--novisualize</code> override settings from simulation (some simulation don’t explicitly want visualize). | ||
+ | |||
+ | ===== Keys ===== | ||
+ | |||
+ | When CLI application is running with visualization some keys can be used. | ||
+ | |||
+ | {| | ||
+ | !Key | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>Q</code> | ||
+ | |Exits application. | ||
+ | |- | ||
+ | |<code>P</code> | ||
+ | |Pause simulation. | ||
+ | |- | ||
+ | |<code>S</code> | ||
+ | |Perform one simulation step when simulation is paused. | ||
+ | |} | ||
+ | |||
+ | === How to run === | ||
+ | |||
+ | CLI application is supported on all three platforms. | ||
+ | |||
+ | ==== Windows x64 ==== | ||
+ | |||
+ | On Windows the ZIP package contains executable in the main directory and some subdirectories with examples and plugins. Application must be executed from command line (<code>cmd</code> or <code>PowerShell</code>). | ||
+ | |||
+ | <html> | ||
+ | <pre><code>PS > .\cece-cli.exe examples\showcase.xml</code></pre> | ||
+ | </html> | ||
+ | |||
+ | ==== Mac OS X ==== | ||
+ | |||
+ | Application on Mac is shipped as bundle packed in TZG package. Package contains a few directories where the most important is <code>bin</code> where the application is stored. The directory <code>bin/simulator-cli.app</code> contains everything that CLI application needs to be executed. Run it from <code>Finder</code> is not viable (mostly for GUI apps that doesn’t require arguments) so it must be executed from terminal. The bundle have some predefined structure where the executable is stored but it’s not important because there is <code>bin/cece-cli.sh</code> that allows you to run CLI app without knowledge of bundle structure. | ||
+ | |||
+ | Just run the simulator by typing this in terminal in directory of unpacked TZG package. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">./bin/cece-cli.sh</span> examples/showcase.xml</code></pre> | ||
+ | </html> | ||
+ | |||
+ | ==== Linux x64 ==== | ||
+ | |||
+ | We offer only DEB package for Ubuntu-like distributions (Ubuntu 14.10 LTS, Mint 17.2). Just double click on DEB package and everything should be installed. Then just type following into terminal. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode bash"><code class="sourceCode bash">$ <span class="kw">cece-cli</span> /usr/share/cece/examples/showcase.xml</code></pre> | ||
+ | </html> | ||
+ | |||
+ | = Data Types = | ||
+ | |||
+ | In following text there are several data types that have different meaning. You can find their meaning in following table: | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Description | ||
+ | !Example | ||
+ | |- | ||
+ | |<code>int</code> | ||
+ | |Integer value. | ||
+ | |<code>5</code>, <code>-3</code> | ||
+ | |- | ||
+ | |<code>uint</code> | ||
+ | |Unsigned integer value. | ||
+ | |<code>5</code> | ||
+ | |- | ||
+ | |<code>float</code> | ||
+ | |Floating point value. | ||
+ | |<code>5.3</code> | ||
+ | |- | ||
+ | |<code>string</code> | ||
+ | |String value. | ||
+ | |<code>hello world</code> | ||
+ | |- | ||
+ | |<code>expression</code> | ||
+ | |Expression. Can contains parameters that are defined by parameter element. | ||
+ | |<code>10 * 5 + 3 * sin(alpha)</code> | ||
+ | |- | ||
+ | |<code>plugin-name</code> | ||
+ | |Name of existing plugin. | ||
+ | |<code>cell</code> | ||
+ | |- | ||
+ | |<code>name</code> | ||
+ | |Similar to <code>string</code>. | ||
+ | |<code>print</code> | ||
+ | |- | ||
+ | |<code>unit[?]</code> | ||
+ | |SI unit based on specified symbol in square braces. Accepts value without unit symbol but if symbol is specified it must match the unit type (prefix are supported). Value without symbol have unspecified size, but mostly corresponds to basic unit specified by simulator (<code>um</code>, <code>s</code>, <code>ng</code>). | ||
+ | |<code>0</code>, <code>30um/s</code>, <code>1.3m/s2</code>, <code>0.01/s</code>, <del><code>5um/us</code></del> | ||
+ | |- | ||
+ | |<code>vector[?]</code> | ||
+ | |Value of '''two''' values separated by space. In case the second value is not supplied it is same as the first one. | ||
+ | |<code>10um/s 1um/s</code>, <code>0 0</code> | ||
+ | |- | ||
+ | |<code>color</code> | ||
+ | |Color value. Value can be name of predefined color or in CSS color definition format (#RRGGBB). | ||
+ | |<code>red</code>, <code>#0000FF</code> | ||
+ | |- | ||
+ | |<code>it</code> | ||
+ | |Simulation iteration number. | ||
+ | |<code>10</code>, <code>55</code> | ||
+ | |- | ||
+ | |<code>range[?]</code> | ||
+ | |Range of values. Values can be separated by dash ‘-’. If dash is not present the meaning is: <code>X-X</code>. | ||
+ | |<code>10</code>, <code>10-15</code> | ||
+ | |- | ||
+ | |<code>array[?]</code> | ||
+ | |List of values of same type. | ||
+ | |<code>10 10 -5</code>, <code>a b c d e f g</code> | ||
+ | |} | ||
+ | |||
+ | = Data Tables = | ||
+ | |||
+ | Data tables are way how the simulator stores data within simulation. Anything can store data in named data table and when simulation ends those data tables are stored into ''CSV'' files in current working directory. | ||
+ | |||
+ | <blockquote>All data is stored in memory during simulation and are stored into file when simulation ends. This cause a large memory requirements depending on stored data. | ||
+ | </blockquote> | ||
+ | <!-- include loaders/* --> | ||
+ | |||
+ | <!-- include plugins/* --> | ||
+ | |||
+ | |||
+ | = Loaders = | ||
+ | |||
+ | Loaders are responsible for loading different type of source files. They understand the source file and create simulation from them. | ||
+ | |||
+ | == Reactions == | ||
+ | |||
+ | This loader loads simple files that contains reaction rules and some parameters. Syntax of reaction rules is same as stochastic-reaction plugins. | ||
+ | |||
+ | <pre>@iterations 500 | ||
+ | @dt 1s | ||
+ | null > 0.3 > A; | ||
+ | A > 0.1 > B + C;</pre> | ||
+ | Lines that begins with <code>@</code> symbol are considered as directives that setups simulation. Remaining lines are parsed by reactions parser and used as program for cell. | ||
+ | |||
+ | Coresponding XML file looks like: | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><?xml</span> version="1.0" encoding="UTF-8" standalone="yes" <span class="kw">?></span> | ||
+ | <span class="kw"><simulation</span><span class="ot"> dt=</span><span class="st">"1s"</span><span class="ot"> iterations=</span><span class="st">"500"</span><span class="kw">></span> | ||
+ | <span class="kw"><program</span><span class="ot"> name=</span><span class="st">"__local__"</span><span class="ot"> language=</span><span class="st">"stochastic-reactions-intercellular"</span><span class="kw">></span> | ||
+ | <span class="bn"><![CDATA[</span> | ||
+ | null > 0.3 > A; | ||
+ | A > 0.1 > B + C; | ||
+ | <span class="bn">]]></span> | ||
+ | <span class="kw"></program></span> | ||
+ | <span class="kw"><object</span><span class="ot"> class=</span><span class="st">"cell.Yeast"</span><span class="ot"> programs=</span><span class="st">"__local__"</span> <span class="kw">/></span> | ||
+ | <span class="kw"></simulation></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | List of available directives: | ||
+ | |||
+ | {| | ||
+ | !Directive | ||
+ | !Parameters | ||
+ | !Description | ||
+ | !Example | ||
+ | |- | ||
+ | |<code>iterations</code> | ||
+ | |<code>int</code> | ||
+ | |Number of simulation iterations. | ||
+ | |<code>@iterations 100</code> | ||
+ | |- | ||
+ | |<code>dt</code> | ||
+ | |<code>time</code> | ||
+ | |Simulation iteration step. | ||
+ | |<code>@dt 10s</code> | ||
+ | |- | ||
+ | |<code>molecule</code> | ||
+ | |<code>string</code>, <code>int</code> | ||
+ | |Initial amount of specified molecule. | ||
+ | |<code>@molecule A 500</code> | ||
+ | |- | ||
+ | |<code>parameter</code> | ||
+ | |<code>string</code>, <code>expression</code> | ||
+ | |Set simulation parameter that can be used in reaction rules. | ||
+ | |<code>@parameter kA 0.3</code> | ||
+ | |} | ||
+ | |||
+ | == XML == | ||
+ | |||
+ | Basic and most supported loader. It loads simulation from valid ''XML'' file. Some basic knowledge of ''XML'' files is required. The simplest simulation file looks like: | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><?xml</span> version="1.0" encoding="UTF-8" standalone="yes" <span class="kw">?></span> | ||
+ | </html> | ||
+ | |||
+ | <simulation dt="1s"> | ||
+ | </simulation></source> | ||
+ | This simulation does almost nothing just runs with iteration time step 1 second. | ||
+ | |||
+ | In the simulation element can be several other elements that specifies the simulation. Those elements can have sub-elements but that mostly depends on element type and used plugin. | ||
+ | |||
+ | === Basic elements: === | ||
+ | |||
+ | Simulator core defines following elements and their parameters. | ||
+ | |||
+ | ==== Simulation ==== | ||
+ | |||
+ | The ''XML'' file root element. It must be always present. | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>world-size</code> | ||
+ | |<code>vector[unit[m]]</code> | ||
+ | |- | ||
+ | |Simulation world size. | ||
+ | |- | ||
+ | |<code>dt</code> | ||
+ | |<code>unit[s]</code> | ||
+ | |- | ||
+ | |Simulation time step. | ||
+ | |- | ||
+ | |<code>iterations</code> | ||
+ | |<code>uint</code> | ||
+ | |<code>0</code> | ||
+ | |Number of simulation iterations. <code>0</code> means unlimited. | ||
+ | |- | ||
+ | |<code>background</code> | ||
+ | |<code>color</code> | ||
+ | |<code>white</code> | ||
+ | |Background color. | ||
+ | |- | ||
+ | |<code>text-color</code> | ||
+ | |<code>color</code> | ||
+ | |<code>background</code> inverse | ||
+ | |Color of UI text. | ||
+ | |- | ||
+ | |<code>text-size</code> | ||
+ | |<code>uint</code> | ||
+ | |<code>30</code> | ||
+ | |UI text size. | ||
+ | |- | ||
+ | |<code>show-simulation-time</code> | ||
+ | |<code>bool</code> | ||
+ | |<code>false</code> | ||
+ | |If simulation time should be rendered. | ||
+ | |} | ||
+ | |||
+ | ==== Init ==== | ||
+ | |||
+ | This element defines program that is executed before the simulation is started. It’s good for simulation scene initialization in cases when manual specification is hard to write. | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>language</code> | ||
+ | |<code>plugin-name</code> | ||
+ | |- | ||
+ | |Language in element content. | ||
+ | |} | ||
+ | |||
+ | ==== Plugin ==== | ||
+ | |||
+ | Explicitly loads required plugin. Plugin is implicitly loaded and when is needed but in some cases there is need for explicit load and configuration. | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>name</code> | ||
+ | |<code>plugin-name</code> | ||
+ | |- | ||
+ | |Plugin name. | ||
+ | |} | ||
+ | |||
+ | <blockquote>Additional attributes are passed to plugin configuration. | ||
+ | </blockquote> | ||
+ | ==== Module ==== | ||
+ | |||
+ | Adds module to simulation. | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>name</code> | ||
+ | |<code>plugin-name(.module-name)</code> | ||
+ | |- | ||
+ | |Name of required module. In most cases you can specify only plugin name but some plugins offsers more modules so you can specify which one you want by adding a suffix. | ||
+ | |} | ||
+ | |||
+ | <blockquote>Additional attributes are passed to module configuration. | ||
+ | </blockquote> | ||
+ | ==== Program ==== | ||
+ | |||
+ | Defines a program that is available for objects. Programs are not executed until are assigned to objects. | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>name</code> | ||
+ | |<code>string</code> | ||
+ | |- | ||
+ | |Unique program name. | ||
+ | |- | ||
+ | |<code>language</code> | ||
+ | |<code>plugin-name</code> | ||
+ | |- | ||
+ | |Language in which is the program written. | ||
+ | |} | ||
+ | |||
+ | ==== Object ==== | ||
+ | |||
+ | Adds an object into simulation. Objects are physical entities that can be affected during simulation. | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>class</code> | ||
+ | |<code>plugin-name.name</code> | ||
+ | |- | ||
+ | |Unique program name. | ||
+ | |- | ||
+ | |<code>visible</code> | ||
+ | |<code>bool</code> | ||
+ | |<code>true</code> | ||
+ | |If object is rendered. | ||
+ | |- | ||
+ | |<code>position</code> | ||
+ | |<code>vector[unit[m]]</code> | ||
+ | |<code>0 0</code> | ||
+ | |Initial object position. <code>0 0</code> is in middle of the world. | ||
+ | |- | ||
+ | |<code>velocity</code> | ||
+ | |<code>vector[unit[m/s]]</code> | ||
+ | |<code>0 0</code> | ||
+ | |Initial object velocity. | ||
+ | |- | ||
+ | |<code>density</code> | ||
+ | |<code>unit[g/m3]</code> | ||
+ | |<code>1</code> | ||
+ | |Initial object density. | ||
+ | |- | ||
+ | |<code>programs</code> | ||
+ | |<code>array[string]</code> | ||
+ | |- | ||
+ | |A list of object programs. | ||
+ | |} | ||
+ | |||
+ | ==== Obstacle ==== | ||
+ | |||
+ | Adds a physical obstacle into simulation. There are 3 different types of obstacles. Each of them require different attributes. | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>visible</code> | ||
+ | |<code>bool</code> | ||
+ | |<code>true</code> | ||
+ | |If object is rendered. | ||
+ | |- | ||
+ | |<code>position</code> | ||
+ | |<code>vector[unit[m]]</code> | ||
+ | |<code>0 0</code> | ||
+ | |Initial object position. <code>0 0</code> is in middle of the world. | ||
+ | |- | ||
+ | |<code>type</code> | ||
+ | |<code>string</code> | ||
+ | |- | ||
+ | |Type of obstacle. Possible values: <code>circle</code>, <code>rectangle</code>, <code>polygon</code>. | ||
+ | |- | ||
+ | |<code>radius</code> | ||
+ | |<code>unit[m]</code> | ||
+ | |- | ||
+ | |Circle radius. Required for <code>circle</code> type. | ||
+ | |- | ||
+ | |<code>size</code> | ||
+ | |<code>vector[unit[m]]</code> | ||
+ | |- | ||
+ | |Rectangle size. Required for <code>rectangle</code> type. | ||
+ | |- | ||
+ | |<code>vertices</code> | ||
+ | |<code>array[vector[unit[m]]]</code> | ||
+ | |- | ||
+ | |A list of vertices. Required for <code>polygon</code> type. | ||
+ | |} | ||
+ | |||
+ | = Plugins = | ||
+ | |||
+ | List of available plugins supplied within official distribution. Depending on how the simulator is built, some plugins can be builtin and rest of them can be extern as shared libraries (<code>dll</code> / <code>dynlib</code> / <code>so</code>). | ||
+ | |||
+ | <blockquote>Some of them may not be available on your platform, so check the list by calling application with <code>--plugins</code> flag. | ||
+ | </blockquote> | ||
+ | == Agglutination == | ||
+ | |||
+ | This plugin enables simulation object sticking. When two simulation object collides they might be bound together and after some time the bound can be removed. This is based on bond definition where you can specify required molecules in both collided cells to create a bond. Specifying association and dissociation constant you indirectly defines probability of bond creation and destruction. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | Example defines bonds between cells. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"agglutination"</span><span class="kw">></span> | ||
+ | <span class="kw"><bond</span><span class="ot"> ligand=</span><span class="st">"LM1"</span><span class="ot"> receptor=</span><span class="st">"LM3"</span><span class="ot"> association-constant=</span><span class="st">"50"</span><span class="ot"> disassociation-constant=</span><span class="st">"1"</span> <span class="kw">/></span> | ||
+ | <span class="kw"><bond</span><span class="ot"> ligand=</span><span class="st">"LM2"</span><span class="ot"> receptor=</span><span class="st">"LM4"</span><span class="ot"> association-constant=</span><span class="st">"20"</span><span class="ot"> disassociation-constant=</span><span class="st">"10"</span> <span class="kw">/></span> | ||
+ | <span class="kw"><bond</span><span class="ot"> ligand=</span><span class="st">"LM5"</span><span class="ot"> receptor=</span><span class="st">"LM6"</span><span class="ot"> association-constant=</span><span class="st">"1"</span><span class="ot"> disassociation-constant=</span><span class="st">"0"</span> <span class="kw">/></span> | ||
+ | <span class="kw"></module></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | === Bonds === | ||
+ | |||
+ | ===== Parameters: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>ligand</code> | ||
+ | |<code>name</code> | ||
+ | |- | ||
+ | |Name of the first molecule. | ||
+ | |- | ||
+ | |<code>receptor</code> | ||
+ | |<code>name</code> | ||
+ | |- | ||
+ | |Name of the second molecule. | ||
+ | |- | ||
+ | |<code>association-constant</code> | ||
+ | |<code>float</code> | ||
+ | |- | ||
+ | |Bond association constant. | ||
+ | |- | ||
+ | |<code>disassociation-constant</code> | ||
+ | |<code>float</code> | ||
+ | |- | ||
+ | |Bond dissociation constant. | ||
+ | |} | ||
+ | |||
+ | == Background == | ||
+ | |||
+ | Plugin that renders defined image in each iteration. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"background"</span><span class="ot"> image=</span><span | ||
+ | </html> | ||
+ | |||
+ | ===== Parameters: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>image</code> | ||
+ | |<code>path</code> | ||
+ | |- | ||
+ | |Used background image. | ||
+ | |} | ||
+ | |||
+ | == Cell == | ||
+ | |||
+ | Plugin offers things usefull to working with cells. | ||
+ | |||
+ | === Objects === | ||
+ | |||
+ | Objects offered by <code>cell</code> plugin: | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>cell.Cell</code> | ||
+ | |Common cell object. | ||
+ | |- | ||
+ | |<code>cell.Yeast</code> | ||
+ | |Yeast cell. | ||
+ | |} | ||
+ | |||
+ | All object share common (unavailable) ancestor that have following properties: | ||
+ | |||
+ | {| | ||
+ | !Property | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | !Example | ||
+ | |- | ||
+ | |<code>volume</code> | ||
+ | |<code>unit[m3]</code> | ||
+ | |<code>100um3</code> | ||
+ | |Cell volume. | ||
+ | |<code>300um3</code> | ||
+ | |- | ||
+ | |<code>volume-max</code> | ||
+ | |<code>unit[m3]</code> | ||
+ | |<code>100um3</code> | ||
+ | |Maximum cell volume. | ||
+ | |<code>300um3</code> | ||
+ | |- | ||
+ | |<code>growth-rate</code> | ||
+ | |<code>unit[m3/s]</code> | ||
+ | |<code>0</code> | ||
+ | |Cell growth rate. | ||
+ | |<code>3um3/s</code> | ||
+ | |- | ||
+ | |<code>saturation-gfp</code> | ||
+ | |<code>unit[/m3]</code> | ||
+ | |<code>20/um3</code> | ||
+ | |Number of “GFP” molecules required to have full green color. | ||
+ | |<code>100/um3</code> | ||
+ | |- | ||
+ | |<code>saturation-rfp</code> | ||
+ | |<code>unit[/m3]</code> | ||
+ | |<code>20/um3</code> | ||
+ | |Number of “RFP” molecules required to have full red color. | ||
+ | |<code>100/um3</code> | ||
+ | |- | ||
+ | |<code>saturation-yfp</code> | ||
+ | |<code>unit[/m3]</code> | ||
+ | |<code>20/um3</code> | ||
+ | |Number of “YFP” molecules required to have full yellow color. | ||
+ | |<code>100/um3</code> | ||
+ | |- | ||
+ | |<code>saturation-cfp</code> | ||
+ | |<code>unit[/m3]</code> | ||
+ | |<code>20/um3</code> | ||
+ | |Number of “CFP” molecules required to have full cyan color. | ||
+ | |<code>100/um3</code> | ||
+ | |- | ||
+ | |<code>saturation-bfp</code> | ||
+ | |<code>unit[/m3]</code> | ||
+ | |<code>20/um3</code> | ||
+ | |Number of “BFP” molecules required to have full blue color. | ||
+ | |<code>100/um3</code> | ||
+ | |} | ||
+ | |||
+ | Cell can have set initial amount of molecule at the beginning. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><object</span><span class="ot"> class=</span><span class="st">"cell.Yeast"</span><span class="kw">></span> | ||
+ | <span class="kw"><molecule</span><span class="ot"> name=</span><span class="st">"GFP"</span><span class="ot"> amount=</span><span class="st">"500"</span> <span class="kw">/></span> | ||
+ | <span class="kw"></object></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | ==== Yeast ==== | ||
+ | |||
+ | {| | ||
+ | !Property | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | !Example | ||
+ | |- | ||
+ | |<code>volume-bud-create</code> | ||
+ | |<code>unit[m3]</code> | ||
+ | |<code>42um3</code> | ||
+ | |Yeast volume when a bud is created. | ||
+ | |<code>300um3</code> | ||
+ | |- | ||
+ | |<code>volume-bud-release</code> | ||
+ | |<code>unit[m3]</code> | ||
+ | |<code>35um3</code> | ||
+ | |Bud volume when is release. | ||
+ | |<code>300um3</code> | ||
+ | |} | ||
+ | |||
+ | === Programs === | ||
+ | |||
+ | ==== <code>store-molecules</code> ==== | ||
+ | |||
+ | Program that stores amount of all molecules in current iteration to <code>molecules</code> data table. It stores object identifier to distinguish between multiple cells. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><object</span><span class="ot"> class=</span><span class="st">"cell.Yeast"</span><span class="ot"> programs=</span><span class="st">"cell.store-molecules"</span> <span class="kw">/></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | ===== Stored data: ===== | ||
+ | |||
+ | * <code>iteration</code> - Iteration number. | ||
+ | * <code>totalTime</code> - Simulation time in seconds. | ||
+ | * <code>id</code> - Object identifier. | ||
+ | * <code>...</code> - Column given by molecule name and value is amount of that molecule. | ||
+ | |||
+ | == Cell Python == | ||
+ | |||
+ | Adds access to <code>cell</code> plugin objects from Python. | ||
+ | |||
+ | === Objects === | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Parent | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>cell.BaseCell</code> | ||
+ | |<code>simulator.Object</code> | ||
+ | |Base cell object. | ||
+ | |- | ||
+ | |<code>cell.Yeast</code> | ||
+ | |<code>cell.BaseCell</code> | ||
+ | |Yeast cell. | ||
+ | |} | ||
+ | |||
+ | ==== Object <code>cell.BaseCell</code> ==== | ||
+ | |||
+ | Base class for all cell objects. | ||
+ | |||
+ | ===== Properties: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>volume</code> | ||
+ | |<code>float</code> | ||
+ | |Cell volume | ||
+ | |- | ||
+ | |<code>growthRate</code> | ||
+ | |<code>float</code> | ||
+ | |Cell growth rate. | ||
+ | |} | ||
+ | |||
+ | ===== Methods: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Return | ||
+ | !Arguments | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>moleculeCount</code> | ||
+ | |<code>float</code> | ||
+ | |<code>string</code> | ||
+ | |Return amount of required molecule stored in cell. | ||
+ | |- | ||
+ | |<code>kill</code> | ||
+ | |- | ||
+ | |- | ||
+ | |Kills the cell. | ||
+ | |} | ||
+ | |||
+ | ==== Object <code>cell.Yeast</code> ==== | ||
+ | |||
+ | Nothing special. | ||
+ | |||
+ | == Diffusion == | ||
+ | |||
+ | The main module adds support for global diffusion in simulation. Diffusion can handle any number of separate signals. They cannot affect each other. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | Enables diffusion with two signals named ''GFP'' and ''RFP'' with diffusion and degradation rates. Those signals have specified colors how they are rendered. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"diffusion"</span><span class="ot"> grid=</span><span class="st">"100"</span><span class="kw">></span> | ||
+ | <span class="kw"><signal</span><span class="ot"> name=</span><span class="st">"GFP"</span><span class="ot"> diffusion-rate=</span><span class="st">"30um2/s"</span><span class="ot"> degradation-rate=</span><span class="st">"0.1/s"</span><span class="ot"> color=</span><span class="st">"green"</span> <span class="kw">/></span> | ||
+ | <span class="kw"><signal</span><span class="ot"> name=</span><span class="st">"RFP"</span><span class="ot"> diffusion-rate=</span><span class="st">"5um2/s"</span><span class="ot"> color=</span><span class="st">"red"</span><span class="ot"> saturation=</span><span class="st">"1uM"</span> <span class="kw">/></span> | ||
+ | <span class="kw"></module></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | ===== Parameters: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>grid</code> | ||
+ | |<code>vector[uint]</code> | ||
+ | |- | ||
+ | |Diffusion grid size. | ||
+ | |- | ||
+ | |<code>background</code> | ||
+ | |<code>color</code> | ||
+ | |<code>transparent</code> | ||
+ | |Background color. | ||
+ | |} | ||
+ | |||
+ | === Signals === | ||
+ | |||
+ | You can specify any number of different signals, there is no limitation. Each signal is specified separately. | ||
+ | |||
+ | ===== Parameters: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>name</code> | ||
+ | |<code>string</code> | ||
+ | |- | ||
+ | |Signal name. | ||
+ | |- | ||
+ | |<code>diffusion-rate</code> | ||
+ | |<code>unit[m2/s]</code> | ||
+ | |- | ||
+ | |Diffusion rate. | ||
+ | |- | ||
+ | |<code>degradation-rate</code> | ||
+ | |<code>unit[/s]</code> | ||
+ | |<code>0/s</code> | ||
+ | |Degradation rate. | ||
+ | |- | ||
+ | |<code>color</code> | ||
+ | |<code>color</code> | ||
+ | |Predefined | ||
+ | |Signal color when the module is rendered. | ||
+ | |- | ||
+ | |<code>saturation</code> | ||
+ | |<code>unit[mol/m3]</code> | ||
+ | |<code>1umol/um3</code> | ||
+ | |Defines concentration when signal color is 100%. | ||
+ | |} | ||
+ | |||
+ | === Additional modules === | ||
+ | |||
+ | ==== <code>store-state</code> ==== | ||
+ | |||
+ | Module that stores values from signal grid of all signals into <code>diffusion</code> data table. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | Store diffusion data for all iterations. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"diffusion.store-state"</span> <span class="kw">/></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | ===== Stored data: ===== | ||
+ | |||
+ | * <code>iteration</code> - Iteration number. | ||
+ | * <code>totalTime</code> - Simulation time in seconds. | ||
+ | * <code>x</code> - Grid X coordinate. | ||
+ | * <code>y</code> - Grid Y coordinate. | ||
+ | * <code>...</code> - Column given by molecule name and value is amount of that molecule in grid cell. | ||
+ | |||
+ | == Diffusion Python == | ||
+ | |||
+ | Python language binding for <code>diffusion</code> plugin. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | This module generates in every iteration some diffusion signal inside defined circle. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"python:generate"</span><span class="kw">></span><span class="bn"><![CDATA[</span> | ||
+ | import math | ||
+ | |||
+ | def update(dt, simulation): | ||
+ | diffusion = simulation.useModule("diffusion") | ||
+ | size = diffusion.gridSize | ||
+ | radius = size.x / 20 | ||
+ | signalAmount = 1 | ||
+ | signalId = diffusion.getSignalId("S1") | ||
+ | |||
+ | for x in range(-radius, radius + 1): | ||
+ | for y in range(-radius, radius + 1): | ||
+ | if (math.sqrt(x * x + y * y) <= radius): | ||
+ | diffusion.setSignal(signalId, size.x / 2 + x, size.y / 2 + y, signalAmount) | ||
+ | <span class="bn">]]></span><span class="kw"></module></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | === Class <code>diffusion.Module</code> === | ||
+ | |||
+ | Diffusion module wrapping class. | ||
+ | |||
+ | ===== Properties: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>gridSize</code> | ||
+ | |<code>vector[uint]</code> | ||
+ | |Grid size. | ||
+ | |- | ||
+ | |<code>signalCount</code> | ||
+ | |<code>uint</code> | ||
+ | |Number of registered diffusion signals. | ||
+ | |} | ||
+ | |||
+ | ===== Methods: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Return | ||
+ | !Arguments | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>getSignalId</code> | ||
+ | |<code>int</code> | ||
+ | |<code>string</code> | ||
+ | |Returns signal identifier from signal name. | ||
+ | |- | ||
+ | |<code>getSignal</code> | ||
+ | |<code>float</code> | ||
+ | |<code>string</code>, <code>int</code>, <code>int</code> | ||
+ | |Return signal value of given signal at given coordinates. | ||
+ | |- | ||
+ | |<code>setSignal</code> | ||
+ | |- | ||
+ | |<code>string</code>, <code>int</code>, <code>int</code>, <code>float</code> | ||
+ | |Change signal value of given signal at given coordinates. | ||
+ | |} | ||
+ | |||
+ | == Diffusion Streamlines == | ||
+ | |||
+ | Without this plugin/module the streamlines does not affect diffusion. Just simply add: | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"diffusion-streamlines"</span> <span class="kw">/></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | <blockquote>It doesn’t require from diffusion and streamlines module to have same grid sizes. | ||
+ | </blockquote> | ||
+ | == Object generator == | ||
+ | |||
+ | Module that generates specified object with some probability and parameters. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | This example create module that generates different Yeast cells in each iteration with some probability. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"object-generator"</span><span class="kw">></span> | ||
+ | <span class="kw"><object</span><span class="ot"> class=</span><span class="st">"cell.Yeast"</span><span class="ot"> probability=</span><span class="st">"0.004"</span><span class="ot"> programs=</span><span class="st">"make-gfp"</span><span class="ot"> position-min=</span><span class="st">"-80um -30um"</span><span class="ot"> position-max=</span><span class="st">"-78um 30um"</span> <span class="kw">/></span> | ||
+ | <span class="kw"><object</span><span class="ot"> class=</span><span class="st">"cell.Yeast"</span><span class="ot"> probability=</span><span class="st">"0.004"</span><span class="ot"> programs=</span><span class="st">"make-rfp"</span><span class="ot"> position-min=</span><span class="st">"-80um -30um"</span><span class="ot"> position-max=</span><span class="st">"-78um 30um"</span> <span class="kw">/></span> | ||
+ | <span class="kw"><object</span><span class="ot"> class=</span><span class="st">"cell.Yeast"</span><span class="ot"> probability=</span><span class="st">"0.004"</span><span class="kw">></span> | ||
+ | <span class="kw"><molecule</span><span class="ot"> name=</span><span class="st">"GFP"</span><span class="ot"> amount=</span><span class="st">"1000"</span> <span class="kw">/></span> | ||
+ | <span class="kw"></object></span> | ||
+ | <span class="kw"><object</span><span class="ot"> class=</span><span class="st">"cell.Yeast"</span><span class="ot"> probability=</span><span class="st">"0.005"</span> <span class="kw">/></span> | ||
+ | <span class="kw"></module></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | === Objects === | ||
+ | |||
+ | Object definition is same as for <code>object</code> in <code>simulation</code> just some additional parameters are required. | ||
+ | |||
+ | ===== Parameters: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>probability</code> | ||
+ | |<code>unit[]</code> | ||
+ | |- | ||
+ | |Probability of object spawning in iteration. | ||
+ | |- | ||
+ | |<code>position-min</code> | ||
+ | |<code>vector[unit[m]]</code> | ||
+ | |Left side of simulation scene. | ||
+ | |Minimum position where object can be spawned. | ||
+ | |- | ||
+ | |<code>position-max</code> | ||
+ | |<code>vector[unit[m]]</code> | ||
+ | |Left side of simulation scene. | ||
+ | |Maximum position where object can be spawned. | ||
+ | |- | ||
+ | |<code>active</code> | ||
+ | |<code>array[range[it]]</code> | ||
+ | |- | ||
+ | |List of ranges when is generator active. | ||
+ | |} | ||
+ | |||
+ | <blockquote>Changing simulation time step affects spawning probability. | ||
+ | </blockquote> | ||
+ | == Obstacles image == | ||
+ | |||
+ | Plugin generate obstacles from graycolored image by finding contours. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><plugin</span><span class="ot"> name=</span><span class="st">"obstacles-image"</span><span class="ot"> image=</span><span class="st">"obstacles.png"</span> <span class="kw">/></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | ===== Parameters: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>image</code> | ||
+ | |<code>path</code> | ||
+ | |- | ||
+ | |Path to source file. Path is relative to same directory as simulation file. | ||
+ | |} | ||
+ | |||
+ | == Picture == | ||
+ | |||
+ | Module that can store scene picture into file. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | Stores scene picture each 100 iterations into file with name <code>pic_$1.png</code> in directory <code>pictures</code>. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"picture"</span><span class="ot"> pattern=</span><span class="st">"pictures/pic_$1.png"</span><span class="ot"> iteration=</span><span class="st">"100"</span> <span class="kw">/></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | ===== Parameters: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>pattern</code> | ||
+ | |<code>string</code> | ||
+ | |<code>image_$1.png</code> | ||
+ | |Path to output file. Pattern can have special <code>$1</code> sequence that is replaced by iteration number. | ||
+ | |- | ||
+ | |<code>iteration</code> | ||
+ | |<code>int</code> | ||
+ | |<code>1</code> | ||
+ | |Number of iteration to skip before store picture (~ store each Nth iteration). | ||
+ | |} | ||
+ | |||
+ | <blockquote>If pattern contains directory that directory must exist. ## Python | ||
+ | </blockquote> | ||
+ | Python support for dynamic programming. | ||
+ | |||
+ | <blockquote>Python plugin doesn’t support <code>unit</code> data type and <code>float</code> type is used instead. | ||
+ | </blockquote> | ||
+ | === Programs === | ||
+ | |||
+ | Dynamic program generated from Python source code. Called (function <code>call</code>) once in each iteration per object that uses this program. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode python"><code class="sourceCode python"><span class="co"># Optional initialization code</span> | ||
+ | |||
+ | <span class="co"># Required function prototype.</span> | ||
+ | <span class="co"># object: Object that owns this program.</span> | ||
+ | <span class="co"># simulation: Current simulation.</span> | ||
+ | <span class="co"># dt: Current iteration time step.</span> | ||
+ | <span class="kw">def</span> call(<span class="dt">object</span>, simulation, dt): | ||
+ | <span class="kw">pass</span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | === Modules === | ||
+ | |||
+ | Dynamic modules generated from Python source code. Module’s <code>update</code> function is called once in each iteration. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode python"><code class="sourceCode python"><span class="co"># Optional initialization code</span> | ||
+ | |||
+ | <span class="co"># Optional function prototype</span> | ||
+ | <span class="co"># @param simulator.Simulation simulation Current simulation.</span> | ||
+ | <span class="co"># @param simulator.Configuration config Configuration from XML file.</span> | ||
+ | <span class="kw">def</span> configure(simulation, config): | ||
+ | <span class="kw">pass</span> | ||
+ | |||
+ | <span class="co"># Recommended function prototype</span> | ||
+ | <span class="co"># @param simulator.Simulation simulation Current simulation.</span> | ||
+ | <span class="co"># @param float dt Current iteration time step.</span> | ||
+ | <span class="kw">def</span> update(simulation, dt): | ||
+ | <span class="kw">pass</span> | ||
+ | |||
+ | <span class="co"># Optional function prototype.</span> | ||
+ | <span class="co"># @param render.Context context Rendering context.</span> | ||
+ | <span class="co"># @param simulator.Simulation simulation Current simulation.</span> | ||
+ | <span class="kw">def</span> draw(context, simulation): | ||
+ | <span class="kw">pass</span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | === Classes === | ||
+ | |||
+ | There are some wrappers around simulator core classes. | ||
+ | |||
+ | ==== class <code>simulator.Configuration</code> ==== | ||
+ | |||
+ | Configuration class. | ||
+ | |||
+ | ===== Methods: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Return | ||
+ | !Arguments | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>get</code> | ||
+ | |<code>string</code> | ||
+ | |<code>string</code> | ||
+ | |Returns configuration value under given name. | ||
+ | |} | ||
+ | |||
+ | ==== class <code>simulator.Simulation</code> ==== | ||
+ | |||
+ | Main simulation class that contains everything about simulation. | ||
+ | |||
+ | === Properties: === | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>worldSize</code> | ||
+ | |<code>vector[float]</code> | ||
+ | |Simulation scene/world size. | ||
+ | |- | ||
+ | |<code>iteration</code> | ||
+ | |<code>uint</code> | ||
+ | |Current iteration number. | ||
+ | |- | ||
+ | |<code>iterations</code> | ||
+ | |<code>uint</code> | ||
+ | |Total number of required iterations. Can be <code>0</code>, if there is no limitation. | ||
+ | |- | ||
+ | |<code>timeStep</code> | ||
+ | |<code>float</code> | ||
+ | |Simulation time step. | ||
+ | |- | ||
+ | |<code>totalTime</code> | ||
+ | |<code>float</code> | ||
+ | |Total time spend in simulation in seconds. | ||
+ | |- | ||
+ | |<code>objectsCount</code> | ||
+ | |<code>uint</code> | ||
+ | |Number of objects in scene. | ||
+ | |} | ||
+ | |||
+ | ===== Methods: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Return | ||
+ | !Arguments | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>useModule</code> | ||
+ | |<code>simulator.Module</code> | ||
+ | |<code>string</code> | ||
+ | |Returns required module. If module is not used, it is created by with default configuration. | ||
+ | |- | ||
+ | |<code>buildObject</code> | ||
+ | |<code>simulator.Object</code> | ||
+ | |<code>string</code>, <code>bool</code> | ||
+ | |Create a new object. The first argument is class name and second one is if object should be static (non-movable). | ||
+ | |} | ||
+ | |||
+ | ==== class <code>simulator.Module</code> ==== | ||
+ | |||
+ | Base class for all modules. It doesn’t offer anything. | ||
+ | |||
+ | ==== class <code>simulator.Object</code> ==== | ||
+ | |||
+ | Basic simulation object. | ||
+ | |||
+ | === Properties: === | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>id</code> | ||
+ | |<code>uint</code> | ||
+ | |Grid size. | ||
+ | |- | ||
+ | |<code>position</code> | ||
+ | |<code>vector[float]</code> | ||
+ | |Number of different signals. | ||
+ | |- | ||
+ | |<code>rotation</code> | ||
+ | |<code>float</code> | ||
+ | |Object rotation in radians. | ||
+ | |- | ||
+ | |<code>velocity</code> | ||
+ | |<code>vector[float]</code> | ||
+ | |Object velocity. | ||
+ | |} | ||
+ | |||
+ | ===== Methods: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Return | ||
+ | !Arguments | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>useProgram</code> | ||
+ | |- | ||
+ | |<code>string</code> | ||
+ | |Add program with given name to object. | ||
+ | |} | ||
+ | |||
+ | == Stochastic reactions - Intercellular == | ||
+ | |||
+ | Allows to specify reactions program that happens in surrounding environment. Plugin is an extension of intracellular reactions. | ||
+ | |||
+ | Extension’s functionality lies in keyword <code>env</code> which is abbreviation for environment, which handles absorbing the molecules inside the cell or producing them outside. Please note that <code>env</code> must be alone on its side of reaction rule. | ||
+ | |||
+ | <blockquote>Plugin requires properly set <code>diffusion</code> module with signals that have same name as molecules released into environment. | ||
+ | </blockquote> | ||
+ | This plugin extends basic Intracellular reactions functionality with two types of reactions, expression and absorption. | ||
+ | |||
+ | Expression of molecule <code>A</code> is either represented using: | ||
+ | |||
+ | <pre>A > 1 > env;</pre> | ||
+ | or using: | ||
+ | |||
+ | <pre>null > 1 > env_A;</pre> | ||
+ | Please note that those two representations are not exactly the same although they lead to the same result. In first example there must be molecule <code>A</code> present in the cell, after executing the reaction the molecule gets substracted and added to the environment. Therefore this reaction represents transportation of molecule outside the cell. In second reaction, the molecule is added and released directly to the environment in single step. | ||
+ | |||
+ | Representation of absorption: | ||
+ | |||
+ | <pre>env > 1 > A;</pre> | ||
+ | This reaction follows the same concept. Subtracts molecule from environment and adds inside the cell. However, you may not want the molecules to get absorbed, you may only want to detect if those molecules are outside. | ||
+ | |||
+ | <pre>if env_A: B > 1 > C;</pre> | ||
+ | Extended conditional reactions are the key. Usage is completely the same as you know from standard intracellular reactions, just add the <code>env_</code> prefix before molecule name. The threshold functionality is of course kept too. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><parameter name="T1" value="20uM" /></code></pre> | ||
+ | </html> | ||
+ | <pre>if env_A > T1: B > 1 > C;</pre> | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | This example is production of <code>A</code> molecules and releasing them with some rate into diffusion. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><program</span><span class="ot"> name=</span><span class="st">"expression-of-A"</span><span class="ot"> language=</span><span class="st">"stochastic-reactions-intercellular"</span><span class="kw">></span><span class="bn"><![CDATA[</span> | ||
+ | null > 50 > env_A; | ||
+ | <span class="bn">]]></span><span class="kw"></program></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | == Stochastic reactions - Intracellular == | ||
+ | |||
+ | Allows to specify reactions rules that are stochastically being executed inside the cell. | ||
+ | |||
+ | <blockquote>The syntax is similar to one in NFSim. | ||
+ | </blockquote> | ||
+ | This reaction changes molecule <code>A</code> to molecule <code>B</code> with rate 1. In other words, when this reaction occurs, one molecule <code>A</code> gets substracted and one molecule <code>B</code> gets added. | ||
+ | |||
+ | <pre>A > 1 > B;</pre> | ||
+ | This reaction changes one molecule <code>A</code> into molecules <code>B</code> and <code>C</code>. | ||
+ | |||
+ | <pre>A > 1 > B + C;</pre> | ||
+ | If you need reaction to happen only when some other molecule is present, take a look at following reaction. This reaction subtracts <code>A</code> and <code>B</code>, and adds <code>C + B</code>. Therefore, this reaction changes <code>A</code> to <code>C</code> only when <code>B</code> is present. Please note you can’t use this concept with environmental reactions. | ||
+ | |||
+ | <pre>A + B > 3 > C + B;</pre> | ||
+ | This reaction creates complex <code>C</code> from 2 molecules of <code>A</code>. That means that at least two As are required for this reaction to occur. | ||
+ | |||
+ | <pre>A + A > 2 > C;</pre> | ||
+ | This reaction uses keyword <code>null</code> and represents expression of <code>A</code>. No molecule gets substracted and one molecule of <code>A</code> gets added. | ||
+ | |||
+ | <pre>null > 2 > A;</pre> | ||
+ | Similarly, this reaction represents degradation of <code>A</code>. | ||
+ | |||
+ | <pre>A > 5 > null;</pre> | ||
+ | The two reactions above can be easily rewritten like this using reversible reaction syntax. First rate is rate of reaction going back, and second rate is for reaction going forward. | ||
+ | |||
+ | <pre>A < 5, 2 > null; | ||
+ | null < 2, 5 > A;</pre> | ||
+ | Another keywords which help user to make his reaction rules more understandable are <code>if</code>, <code>and</code> and <code>or</code>. | ||
+ | |||
+ | <pre>if not C and D and E: A + B > 1 > C;</pre> | ||
+ | This reaction merges <code>A</code> and <code>B</code> into <code>C</code>, but this reaction can occur only when there is no molecule of <code>C</code> present and simultaneously there must be <code>D</code> and <code>E</code> present. You can combine as many logic combinations as you can. Please note that <code>and</code> is prior to <code>or</code>, this means that following reaction only occur when there is either <code>A</code> or <code>B</code> and <code>C</code> together present in the cell. | ||
+ | |||
+ | <pre>if A or B and C: D > 1 > E;</pre> | ||
+ | We want to make your reactions easily tunable, so we included the principle of threshold. The following reaction get executed only when there is 500 molecules of <code>B</code> present in the cell. | ||
+ | |||
+ | <pre>If B > 500: A > 1 > C;</pre> | ||
+ | ===== Example: ===== | ||
+ | |||
+ | Defines reactions that create molecules <code>GFP</code> and <code>A</code> with some degradation. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><parameter</span><span class="ot"> name=</span><span class="st">"K1"</span><span class="ot"> value=</span><span class="st">"20"</span> <span class="kw">/></span> | ||
+ | <span class="kw"><program</span><span class="ot"> name=</span><span class="st">"make"</span><span class="ot"> language=</span><span class="st">"stochastic-reactions-intracellular"</span><span class="kw">></span><span class="bn"><![CDATA[</span> | ||
+ | if A > K1: null > 1.505149978 > GFP; | ||
+ | GFP > 0.001 > null; | ||
+ | null < 0.5, 0.8 > A; | ||
+ | <span class="bn">]]></span><span class="kw"></program></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | == Streamlines == | ||
+ | |||
+ | Module that simulate streamlines in whole scene. It using Lattice Boltzman method to calculate velocities in simulation grid. Simulation can handle static and even dynamic obstacles. Dynamic obstacles are moving objects in scene. Dynamic obstacles (i.e. objects) are affected by computed velocities. | ||
+ | |||
+ | There are some limitations that come from Lattice Boltzman method. Maximum velocity is limited by grid size, time step and scene/world size. If the velocity is higher than this limit, it’s changed to the maximum otherwise the streamlines simulation crashes. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"streamlines"</span><span class="ot"> grid=</span><span class="st">"200"</span><span class="ot"> inlet-velocity=</span><span class="st">"300um/s"</span><span class="ot"> kinematic-viscosity=</span><span class="st">"0.658mm2/s"</span> <span class="kw">/></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | ===== Parameters: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>grid</code> | ||
+ | |<code>vector[uint]</code> | ||
+ | |- | ||
+ | |Simulation grid size. | ||
+ | |- | ||
+ | |<code>layout</code> | ||
+ | |4x <code>string</code> | ||
+ | |<code>barrier outlet barrier inlet</code> | ||
+ | |Defines scene layout. Four values define layout in order: '''top''' '''right''' '''bottom''' '''left'''. Possible values are: <code>none</code>, <code>barrier</code>, <code>inlet</code>, <code>outlet</code>. | ||
+ | |- | ||
+ | |<code>inlet-velocity</code> | ||
+ | |<code>unit[m/s]</code> | ||
+ | |<code>0</code> | ||
+ | |Velocity for all inlets. | ||
+ | |- | ||
+ | |<code>inlet-velocities</code> | ||
+ | |4x <code>unit[m/s]</code> | ||
+ | |<code>0 0 0 0</code> | ||
+ | |Specific inlet velocities for layout. | ||
+ | |- | ||
+ | |<code>kinematic-viscosity</code> | ||
+ | |<code>unit[m2/s]</code> | ||
+ | |<code>0.658mm/s</code> | ||
+ | |Fluid kinematic viscosity. | ||
+ | |} | ||
+ | |||
+ | === Additional modules === | ||
+ | |||
+ | ==== <code>store-state</code> ==== | ||
+ | |||
+ | Module that stores velicities from grid into <code>streamlines</code> data table. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"streamlines.store-state"</span> <span class="kw">/></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | <blockquote>This module generates a huge amount of data so use with caution. | ||
+ | </blockquote> | ||
+ | ===== Stored data: ===== | ||
+ | |||
+ | * <code>iteration</code> - Iteration number. | ||
+ | * <code>totalTime</code> - Simulation time in seconds. | ||
+ | * <code>x</code> - Grid X coordinate. | ||
+ | * <code>y</code> - Grid Y coordinate. | ||
+ | * <code>velX</code> - Velocity in specified grid cell, X coordinate. | ||
+ | * <code>velY</code> - Velocity in specified grid cell, Y coordinate. | ||
+ | |||
+ | === Additional programs === | ||
+ | |||
+ | ==== <code>store-object-state</code> ==== | ||
+ | |||
+ | Module that stores object position and velicities into <code>object-state</code> data table. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><object</span> <span class="er">...</span><span class="ot"> programs=</span><span class="st">"streamlines.store-object-state"</span> <span class="kw">/></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | ===== Stored data: ===== | ||
+ | |||
+ | * <code>iteration</code> - Iteration number. | ||
+ | * <code>totalTime</code> - Simulation time in seconds. | ||
+ | * <code>id</code> - Object identifier. | ||
+ | * <code>x</code> - Object X world coordinate. | ||
+ | * <code>y</code> - Object Y world coordinate. | ||
+ | * <code>velX</code> - Object velocity, X coordinate. | ||
+ | * <code>velY</code> - Object velocity, Y coordinate. | ||
+ | |||
+ | == Streamlines Python == | ||
+ | |||
+ | Python language binding for <code>streamlines</code> plugin. | ||
+ | |||
+ | ===== Example: ===== | ||
+ | |||
+ | This module generates in every iteration some diffusion signal inside defined circle. | ||
+ | |||
+ | <html> | ||
+ | <pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw"><module</span><span class="ot"> name=</span><span class="st">"python:generate"</span><span class="kw">></span><span class="bn"><![CDATA[</span> | ||
+ | layouts = [ | ||
+ | ["barrier", "outlet", "barrier", "inlet"], | ||
+ | ["barrier", "inlet", "barrier", "outlet"] | ||
+ | ] | ||
+ | |||
+ | mode = 1 | ||
+ | |||
+ | def update(dt, simulation): | ||
+ | global mode | ||
+ | module = simulation.useModule("streamlines") | ||
+ | |||
+ | if (simulation.iteration % 200 == 0): | ||
+ | module.setLayout(layouts[mode % 2]) | ||
+ | module.initBarriers(simulation) | ||
+ | mode = mode + 1 | ||
+ | <span class="bn">]]></span><span class="kw"></module></span></code></pre> | ||
+ | </html> | ||
+ | |||
+ | === Constants: === | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Type | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>LEFT</code> | ||
+ | |<code>uint</code> | ||
+ | |Left side. | ||
+ | |- | ||
+ | |<code>RIGHT</code> | ||
+ | |<code>uint</code> | ||
+ | |Right side. | ||
+ | |- | ||
+ | |<code>TOP</code> | ||
+ | |<code>uint</code> | ||
+ | |Top side. | ||
+ | |- | ||
+ | |<code>BOTTOM</code> | ||
+ | |<code>uint</code> | ||
+ | |Bottom side. | ||
+ | |} | ||
+ | |||
+ | === Class <code>streamlines.Module</code> === | ||
+ | |||
+ | Streamlines module wrapping class. | ||
+ | |||
+ | ===== Methods: ===== | ||
+ | |||
+ | {| | ||
+ | !Name | ||
+ | !Return | ||
+ | !Arguments | ||
+ | !Description | ||
+ | |- | ||
+ | |<code>setLayout</code> | ||
+ | |<code>int</code> | ||
+ | |<code>string</code>, <code>string</code>, <code>string</code>, <code>string</code> | ||
+ | |Set streamlines layout. Top, right, bottom, left. Possible values <code>barrier</code>, <code>inlet</code>, <code>outlet</code>, <code>none</code>. | ||
+ | |- | ||
+ | |<code>initBarriers</code> | ||
+ | |<code>float</code> | ||
+ | |- | ||
+ | |Initialize barriers after setLayout call. | ||
+ | |- | ||
+ | |<code>setInletVelocity</code> | ||
+ | |- | ||
+ | |<code>int</code>, <code>float</code> | ||
+ | |Change inlet velocity for specific scene side (see constants). | ||
+ | |} | ||
{{:Team:Czech_Republic/Template:Bottom}} | {{:Team:Czech_Republic/Template:Bottom}} |
Revision as of 11:32, 15 September 2015
Software Manual
Contents
- 1 Applications
- 2 Data Types
- 3 Data Tables
- 4 Loaders
- 5 Plugins
- 5.1 Agglutination
- 5.2 Background
- 5.3 Cell
- 5.4 Cell Python
- 5.5 Diffusion
- 5.6 Diffusion Python
- 5.7 Diffusion Streamlines
- 5.8 Object generator
- 5.9 Obstacles image
- 5.10 Picture
- 5.11 Stochastic reactions - Intercellular
- 5.12 Stochastic reactions - Intracellular
- 5.13 Streamlines
- 5.14 Streamlines Python
The CeCe simulator is modular simulator primary designed for modeling signal transmission networks in microfluidics. The simulator architecture is mainly modular where functionality is provided by plugins. Each plugin is responsible for specific part of simulation (may not be used).
Applications
CLI
Simple command line application that can run prepared simulations. It takes simulation file and perform simulation with optional visualization.
Parameters:
Name | Parameters | Description | Notes |
---|---|---|---|
simulation-file
|
filepath
|
Path to simulation file. | |
--plugins
|
Prints a list of available plugins. | ||
--help
|
Prints help. | ||
--visualize
|
If simulation should be visualized. | ||
--novisualize
|
Don’t visualize simulation. | ||
--fullscreen
|
Start visualization window in fullscreen. You don’t have to specify window width and height. In that case monitor size is used. | ||
--width
|
int
|
Visualization window width. | |
--height
|
int
|
Visualization window height. | |
--capture
|
filepath
|
Record video from simulation. Visualization is required. | May not be available in some builds. Check --help if is supported.
|
Specifying --visualize
or --novisualize
override settings from simulation (some simulation don’t explicitly want visualize).
Keys
When CLI application is running with visualization some keys can be used.
Key | Description |
---|---|
Q
|
Exits application. |
P
|
Pause simulation. |
S
|
Perform one simulation step when simulation is paused. |
How to run
CLI application is supported on all three platforms.
Windows x64
On Windows the ZIP package contains executable in the main directory and some subdirectories with examples and plugins. Application must be executed from command line (cmd
or PowerShell
).
PS > .\cece-cli.exe examples\showcase.xml
Mac OS X
Application on Mac is shipped as bundle packed in TZG package. Package contains a few directories where the most important is bin
where the application is stored. The directory bin/simulator-cli.app
contains everything that CLI application needs to be executed. Run it from Finder
is not viable (mostly for GUI apps that doesn’t require arguments) so it must be executed from terminal. The bundle have some predefined structure where the executable is stored but it’s not important because there is bin/cece-cli.sh
that allows you to run CLI app without knowledge of bundle structure.
Just run the simulator by typing this in terminal in directory of unpacked TZG package.
$ ./bin/cece-cli.sh examples/showcase.xml
Linux x64
We offer only DEB package for Ubuntu-like distributions (Ubuntu 14.10 LTS, Mint 17.2). Just double click on DEB package and everything should be installed. Then just type following into terminal.
$ cece-cli /usr/share/cece/examples/showcase.xml
Data Types
In following text there are several data types that have different meaning. You can find their meaning in following table:
Name | Description | Example |
---|---|---|
int
|
Integer value. | 5 , -3
|
uint
|
Unsigned integer value. | 5
|
float
|
Floating point value. | 5.3
|
string
|
String value. | hello world
|
expression
|
Expression. Can contains parameters that are defined by parameter element. | 10 * 5 + 3 * sin(alpha)
|
plugin-name
|
Name of existing plugin. | cell
|
name
|
Similar to string .
|
print
|
unit[?]
|
SI unit based on specified symbol in square braces. Accepts value without unit symbol but if symbol is specified it must match the unit type (prefix are supported). Value without symbol have unspecified size, but mostly corresponds to basic unit specified by simulator (um , s , ng ).
|
0 , 30um/s , 1.3m/s2 , 0.01/s , 5um/us |
vector[?]
|
Value of two values separated by space. In case the second value is not supplied it is same as the first one. | 10um/s 1um/s , 0 0
|
color
|
Color value. Value can be name of predefined color or in CSS color definition format (#RRGGBB). | red , #0000FF
|
it
|
Simulation iteration number. | 10 , 55
|
range[?]
|
Range of values. Values can be separated by dash ‘-’. If dash is not present the meaning is: X-X .
|
10 , 10-15
|
array[?]
|
List of values of same type. | 10 10 -5 , a b c d e f g
|
Data Tables
Data tables are way how the simulator stores data within simulation. Anything can store data in named data table and when simulation ends those data tables are stored into CSV files in current working directory.
All data is stored in memory during simulation and are stored into file when simulation ends. This cause a large memory requirements depending on stored data.
Loaders
Loaders are responsible for loading different type of source files. They understand the source file and create simulation from them.
Reactions
This loader loads simple files that contains reaction rules and some parameters. Syntax of reaction rules is same as stochastic-reaction plugins.
@iterations 500 @dt 1s null > 0.3 > A; A > 0.1 > B + C;
Lines that begins with @
symbol are considered as directives that setups simulation. Remaining lines are parsed by reactions parser and used as program for cell.
Coresponding XML file looks like:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<simulation dt="1s" iterations="500">
<program name="__local__" language="stochastic-reactions-intercellular">
<![CDATA[
null > 0.3 > A;
A > 0.1 > B + C;
]]>
</program>
<object class="cell.Yeast" programs="__local__" />
</simulation>
List of available directives:
Directive | Parameters | Description | Example |
---|---|---|---|
iterations
|
int
|
Number of simulation iterations. | @iterations 100
|
dt
|
time
|
Simulation iteration step. | @dt 10s
|
molecule
|
string , int
|
Initial amount of specified molecule. | @molecule A 500
|
parameter
|
string , expression
|
Set simulation parameter that can be used in reaction rules. | @parameter kA 0.3
|
XML
Basic and most supported loader. It loads simulation from valid XML file. Some basic knowledge of XML files is required. The simplest simulation file looks like:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<simulation dt="1s">
</simulation></source>
This simulation does almost nothing just runs with iteration time step 1 second.
In the simulation element can be several other elements that specifies the simulation. Those elements can have sub-elements but that mostly depends on element type and used plugin.
Basic elements:
Simulator core defines following elements and their parameters.
Simulation
The XML file root element. It must be always present.
Name
Type
Default
Description
world-size
vector[unit[m]]
Simulation world size.
dt
unit[s]
Simulation time step.
iterations
uint
0
Number of simulation iterations. 0
means unlimited.
background
color
white
Background color.
text-color
color
background
inverse
Color of UI text.
text-size
uint
30
UI text size.
show-simulation-time
bool
false
If simulation time should be rendered.
Init
This element defines program that is executed before the simulation is started. It’s good for simulation scene initialization in cases when manual specification is hard to write.
Name
Type
Default
Description
language
plugin-name
Language in element content.
Plugin
Explicitly loads required plugin. Plugin is implicitly loaded and when is needed but in some cases there is need for explicit load and configuration.
Name
Type
Default
Description
name
plugin-name
Plugin name.
Additional attributes are passed to plugin configuration.
Module
Adds module to simulation.
Name
Type
Default
Description
name
plugin-name(.module-name)
Name of required module. In most cases you can specify only plugin name but some plugins offsers more modules so you can specify which one you want by adding a suffix.
Additional attributes are passed to module configuration.
Program
Defines a program that is available for objects. Programs are not executed until are assigned to objects.
Name
Type
Default
Description
name
string
Unique program name.
language
plugin-name
Language in which is the program written.
Object
Adds an object into simulation. Objects are physical entities that can be affected during simulation.
Name
Type
Default
Description
class
plugin-name.name
Unique program name.
visible
bool
true
If object is rendered.
position
vector[unit[m]]
0 0
Initial object position. 0 0
is in middle of the world.
velocity
vector[unit[m/s]]
0 0
Initial object velocity.
density
unit[g/m3]
1
Initial object density.
programs
array[string]
A list of object programs.
Obstacle
Adds a physical obstacle into simulation. There are 3 different types of obstacles. Each of them require different attributes.
Name
Type
Default
Description
visible
bool
true
If object is rendered.
position
vector[unit[m]]
0 0
Initial object position. 0 0
is in middle of the world.
type
string
Type of obstacle. Possible values: circle
, rectangle
, polygon
.
radius
unit[m]
Circle radius. Required for circle
type.
size
vector[unit[m]]
Rectangle size. Required for rectangle
type.
vertices
array[vector[unit[m]]]
A list of vertices. Required for polygon
type.
Plugins
List of available plugins supplied within official distribution. Depending on how the simulator is built, some plugins can be builtin and rest of them can be extern as shared libraries (dll
/ dynlib
/ so
).
Some of them may not be available on your platform, so check the list by calling application with --plugins
flag.
Agglutination
This plugin enables simulation object sticking. When two simulation object collides they might be bound together and after some time the bound can be removed. This is based on bond definition where you can specify required molecules in both collided cells to create a bond. Specifying association and dissociation constant you indirectly defines probability of bond creation and destruction.
Example:
Example defines bonds between cells.
<module name="agglutination">
<bond ligand="LM1" receptor="LM3" association-constant="50" disassociation-constant="1" />
<bond ligand="LM2" receptor="LM4" association-constant="20" disassociation-constant="10" />
<bond ligand="LM5" receptor="LM6" association-constant="1" disassociation-constant="0" />
</module>
Bonds
Parameters:
Name
Type
Default
Description
ligand
name
Name of the first molecule.
receptor
name
Name of the second molecule.
association-constant
float
Bond association constant.
disassociation-constant
float
Bond dissociation constant.
Background
Plugin that renders defined image in each iteration.
Example:
<module name="background" image=
Parameters:
Name
Type
Default
Description
image
path
Used background image.
Cell
Plugin offers things usefull to working with cells.
Objects
Objects offered by cell
plugin:
Name
Description
cell.Cell
Common cell object.
cell.Yeast
Yeast cell.
All object share common (unavailable) ancestor that have following properties:
Property
Type
Default
Description
Example
volume
unit[m3]
100um3
Cell volume.
300um3
volume-max
unit[m3]
100um3
Maximum cell volume.
300um3
growth-rate
unit[m3/s]
0
Cell growth rate.
3um3/s
saturation-gfp
unit[/m3]
20/um3
Number of “GFP” molecules required to have full green color.
100/um3
saturation-rfp
unit[/m3]
20/um3
Number of “RFP” molecules required to have full red color.
100/um3
saturation-yfp
unit[/m3]
20/um3
Number of “YFP” molecules required to have full yellow color.
100/um3
saturation-cfp
unit[/m3]
20/um3
Number of “CFP” molecules required to have full cyan color.
100/um3
saturation-bfp
unit[/m3]
20/um3
Number of “BFP” molecules required to have full blue color.
100/um3
Cell can have set initial amount of molecule at the beginning.
<object class="cell.Yeast">
<molecule name="GFP" amount="500" />
</object>
Yeast
Property
Type
Default
Description
Example
volume-bud-create
unit[m3]
42um3
Yeast volume when a bud is created.
300um3
volume-bud-release
unit[m3]
35um3
Bud volume when is release.
300um3
Programs
store-molecules
Program that stores amount of all molecules in current iteration to molecules
data table. It stores object identifier to distinguish between multiple cells.
<object class="cell.Yeast" programs="cell.store-molecules" />
Stored data:
-
iteration
- Iteration number.
-
totalTime
- Simulation time in seconds.
-
id
- Object identifier.
-
...
- Column given by molecule name and value is amount of that molecule.
Cell Python
Adds access to cell
plugin objects from Python.
Objects
Name
Parent
Description
cell.BaseCell
simulator.Object
Base cell object.
cell.Yeast
cell.BaseCell
Yeast cell.
Object cell.BaseCell
Base class for all cell objects.
Properties:
Name
Type
Description
volume
float
Cell volume
growthRate
float
Cell growth rate.
Methods:
Name
Return
Arguments
Description
moleculeCount
float
string
Return amount of required molecule stored in cell.
kill
Kills the cell.
Object cell.Yeast
Nothing special.
Diffusion
The main module adds support for global diffusion in simulation. Diffusion can handle any number of separate signals. They cannot affect each other.
Example:
Enables diffusion with two signals named GFP and RFP with diffusion and degradation rates. Those signals have specified colors how they are rendered.
<module name="diffusion" grid="100">
<signal name="GFP" diffusion-rate="30um2/s" degradation-rate="0.1/s" color="green" />
<signal name="RFP" diffusion-rate="5um2/s" color="red" saturation="1uM" />
</module>
Parameters:
Name
Type
Default
Description
grid
vector[uint]
Diffusion grid size.
background
color
transparent
Background color.
Signals
You can specify any number of different signals, there is no limitation. Each signal is specified separately.
Parameters:
Name
Type
Default
Description
name
string
Signal name.
diffusion-rate
unit[m2/s]
Diffusion rate.
degradation-rate
unit[/s]
0/s
Degradation rate.
color
color
Predefined
Signal color when the module is rendered.
saturation
unit[mol/m3]
1umol/um3
Defines concentration when signal color is 100%.
Additional modules
store-state
Module that stores values from signal grid of all signals into diffusion
data table.
Example:
Store diffusion data for all iterations.
<module name="diffusion.store-state" />
Stored data:
-
iteration
- Iteration number.
-
totalTime
- Simulation time in seconds.
-
x
- Grid X coordinate.
-
y
- Grid Y coordinate.
-
...
- Column given by molecule name and value is amount of that molecule in grid cell.
Diffusion Python
Python language binding for diffusion
plugin.
Example:
This module generates in every iteration some diffusion signal inside defined circle.
<module name="python:generate"><![CDATA[
import math
def update(dt, simulation):
diffusion = simulation.useModule("diffusion")
size = diffusion.gridSize
radius = size.x / 20
signalAmount = 1
signalId = diffusion.getSignalId("S1")
for x in range(-radius, radius + 1):
for y in range(-radius, radius + 1):
if (math.sqrt(x * x + y * y) <= radius):
diffusion.setSignal(signalId, size.x / 2 + x, size.y / 2 + y, signalAmount)
]]></module>
Class diffusion.Module
Diffusion module wrapping class.
Properties:
Name
Type
Description
gridSize
vector[uint]
Grid size.
signalCount
uint
Number of registered diffusion signals.
Methods:
Name
Return
Arguments
Description
getSignalId
int
string
Returns signal identifier from signal name.
getSignal
float
string
, int
, int
Return signal value of given signal at given coordinates.
setSignal
string
, int
, int
, float
Change signal value of given signal at given coordinates.
Diffusion Streamlines
Without this plugin/module the streamlines does not affect diffusion. Just simply add:
<module name="diffusion-streamlines" />
It doesn’t require from diffusion and streamlines module to have same grid sizes.
Object generator
Module that generates specified object with some probability and parameters.
Example:
This example create module that generates different Yeast cells in each iteration with some probability.
<module name="object-generator">
<object class="cell.Yeast" probability="0.004" programs="make-gfp" position-min="-80um -30um" position-max="-78um 30um" />
<object class="cell.Yeast" probability="0.004" programs="make-rfp" position-min="-80um -30um" position-max="-78um 30um" />
<object class="cell.Yeast" probability="0.004">
<molecule name="GFP" amount="1000" />
</object>
<object class="cell.Yeast" probability="0.005" />
</module>
Objects
Object definition is same as for object
in simulation
just some additional parameters are required.
Parameters:
Name
Type
Default
Description
probability
unit[]
Probability of object spawning in iteration.
position-min
vector[unit[m]]
Left side of simulation scene.
Minimum position where object can be spawned.
position-max
vector[unit[m]]
Left side of simulation scene.
Maximum position where object can be spawned.
active
array[range[it]]
List of ranges when is generator active.
Changing simulation time step affects spawning probability.
Obstacles image
Plugin generate obstacles from graycolored image by finding contours.
Example:
<plugin name="obstacles-image" image="obstacles.png" />
Parameters:
Name
Type
Default
Description
image
path
Path to source file. Path is relative to same directory as simulation file.
Picture
Module that can store scene picture into file.
Example:
Stores scene picture each 100 iterations into file with name pic_$1.png
in directory pictures
.
<module name="picture" pattern="pictures/pic_$1.png" iteration="100" />
Parameters:
Name
Type
Default
Description
pattern
string
image_$1.png
Path to output file. Pattern can have special $1
sequence that is replaced by iteration number.
iteration
int
1
Number of iteration to skip before store picture (~ store each Nth iteration).
If pattern contains directory that directory must exist. ## Python
Python support for dynamic programming.
Python plugin doesn’t support unit
data type and float
type is used instead.
Programs
Dynamic program generated from Python source code. Called (function call
) once in each iteration per object that uses this program.
# Optional initialization code
# Required function prototype.
# object: Object that owns this program.
# simulation: Current simulation.
# dt: Current iteration time step.
def call(object, simulation, dt):
pass
Modules
Dynamic modules generated from Python source code. Module’s update
function is called once in each iteration.
# Optional initialization code
# Optional function prototype
# @param simulator.Simulation simulation Current simulation.
# @param simulator.Configuration config Configuration from XML file.
def configure(simulation, config):
pass
# Recommended function prototype
# @param simulator.Simulation simulation Current simulation.
# @param float dt Current iteration time step.
def update(simulation, dt):
pass
# Optional function prototype.
# @param render.Context context Rendering context.
# @param simulator.Simulation simulation Current simulation.
def draw(context, simulation):
pass
Classes
There are some wrappers around simulator core classes.
class simulator.Configuration
Configuration class.
Methods:
Name
Return
Arguments
Description
get
string
string
Returns configuration value under given name.
class simulator.Simulation
Main simulation class that contains everything about simulation.
Properties:
Name
Type
Description
worldSize
vector[float]
Simulation scene/world size.
iteration
uint
Current iteration number.
iterations
uint
Total number of required iterations. Can be 0
, if there is no limitation.
timeStep
float
Simulation time step.
totalTime
float
Total time spend in simulation in seconds.
objectsCount
uint
Number of objects in scene.
Methods:
Name
Return
Arguments
Description
useModule
simulator.Module
string
Returns required module. If module is not used, it is created by with default configuration.
buildObject
simulator.Object
string
, bool
Create a new object. The first argument is class name and second one is if object should be static (non-movable).
class simulator.Module
Base class for all modules. It doesn’t offer anything.
class simulator.Object
Basic simulation object.
Properties:
Name
Type
Description
id
uint
Grid size.
position
vector[float]
Number of different signals.
rotation
float
Object rotation in radians.
velocity
vector[float]
Object velocity.
Methods:
Name
Return
Arguments
Description
useProgram
string
Add program with given name to object.
Stochastic reactions - Intercellular
Allows to specify reactions program that happens in surrounding environment. Plugin is an extension of intracellular reactions.
Extension’s functionality lies in keyword env
which is abbreviation for environment, which handles absorbing the molecules inside the cell or producing them outside. Please note that env
must be alone on its side of reaction rule.
Plugin requires properly set diffusion
module with signals that have same name as molecules released into environment.
This plugin extends basic Intracellular reactions functionality with two types of reactions, expression and absorption.
Expression of molecule A
is either represented using:
A > 1 > env;
or using:
null > 1 > env_A;
Please note that those two representations are not exactly the same although they lead to the same result. In first example there must be molecule A
present in the cell, after executing the reaction the molecule gets substracted and added to the environment. Therefore this reaction represents transportation of molecule outside the cell. In second reaction, the molecule is added and released directly to the environment in single step.
Representation of absorption:
env > 1 > A;
This reaction follows the same concept. Subtracts molecule from environment and adds inside the cell. However, you may not want the molecules to get absorbed, you may only want to detect if those molecules are outside.
if env_A: B > 1 > C;
Extended conditional reactions are the key. Usage is completely the same as you know from standard intracellular reactions, just add the env_
prefix before molecule name. The threshold functionality is of course kept too.
<parameter name="T1" value="20uM" />
if env_A > T1: B > 1 > C;
Example:
This example is production of A
molecules and releasing them with some rate into diffusion.
<program name="expression-of-A" language="stochastic-reactions-intercellular"><![CDATA[
null > 50 > env_A;
]]></program>
Stochastic reactions - Intracellular
Allows to specify reactions rules that are stochastically being executed inside the cell.
The syntax is similar to one in NFSim.
This reaction changes molecule A
to molecule B
with rate 1. In other words, when this reaction occurs, one molecule A
gets substracted and one molecule B
gets added.
A > 1 > B;
This reaction changes one molecule A
into molecules B
and C
.
A > 1 > B + C;
If you need reaction to happen only when some other molecule is present, take a look at following reaction. This reaction subtracts A
and B
, and adds C + B
. Therefore, this reaction changes A
to C
only when B
is present. Please note you can’t use this concept with environmental reactions.
A + B > 3 > C + B;
This reaction creates complex C
from 2 molecules of A
. That means that at least two As are required for this reaction to occur.
A + A > 2 > C;
This reaction uses keyword null
and represents expression of A
. No molecule gets substracted and one molecule of A
gets added.
null > 2 > A;
Similarly, this reaction represents degradation of A
.
A > 5 > null;
The two reactions above can be easily rewritten like this using reversible reaction syntax. First rate is rate of reaction going back, and second rate is for reaction going forward.
A < 5, 2 > null;
null < 2, 5 > A;
Another keywords which help user to make his reaction rules more understandable are if
, and
and or
.
if not C and D and E: A + B > 1 > C;
This reaction merges A
and B
into C
, but this reaction can occur only when there is no molecule of C
present and simultaneously there must be D
and E
present. You can combine as many logic combinations as you can. Please note that and
is prior to or
, this means that following reaction only occur when there is either A
or B
and C
together present in the cell.
if A or B and C: D > 1 > E;
We want to make your reactions easily tunable, so we included the principle of threshold. The following reaction get executed only when there is 500 molecules of B
present in the cell.
If B > 500: A > 1 > C;
Example:
Defines reactions that create molecules GFP
and A
with some degradation.
<parameter name="K1" value="20" />
<program name="make" language="stochastic-reactions-intracellular"><![CDATA[
if A > K1: null > 1.505149978 > GFP;
GFP > 0.001 > null;
null < 0.5, 0.8 > A;
]]></program>
Streamlines
Module that simulate streamlines in whole scene. It using Lattice Boltzman method to calculate velocities in simulation grid. Simulation can handle static and even dynamic obstacles. Dynamic obstacles are moving objects in scene. Dynamic obstacles (i.e. objects) are affected by computed velocities.
There are some limitations that come from Lattice Boltzman method. Maximum velocity is limited by grid size, time step and scene/world size. If the velocity is higher than this limit, it’s changed to the maximum otherwise the streamlines simulation crashes.
Example:
<module name="streamlines" grid="200" inlet-velocity="300um/s" kinematic-viscosity="0.658mm2/s" />
Parameters:
Name
Type
Default
Description
grid
vector[uint]
Simulation grid size.
layout
4x string
barrier outlet barrier inlet
Defines scene layout. Four values define layout in order: top right bottom left. Possible values are: none
, barrier
, inlet
, outlet
.
inlet-velocity
unit[m/s]
0
Velocity for all inlets.
inlet-velocities
4x unit[m/s]
0 0 0 0
Specific inlet velocities for layout.
kinematic-viscosity
unit[m2/s]
0.658mm/s
Fluid kinematic viscosity.
Additional modules
store-state
Module that stores velicities from grid into streamlines
data table.
Example:
<module name="streamlines.store-state" />
This module generates a huge amount of data so use with caution.
Stored data:
-
iteration
- Iteration number.
-
totalTime
- Simulation time in seconds.
-
x
- Grid X coordinate.
-
y
- Grid Y coordinate.
-
velX
- Velocity in specified grid cell, X coordinate.
-
velY
- Velocity in specified grid cell, Y coordinate.
Additional programs
store-object-state
Module that stores object position and velicities into object-state
data table.
Example:
<object ... programs="streamlines.store-object-state" />
Stored data:
-
iteration
- Iteration number.
-
totalTime
- Simulation time in seconds.
-
id
- Object identifier.
-
x
- Object X world coordinate.
-
y
- Object Y world coordinate.
-
velX
- Object velocity, X coordinate.
-
velY
- Object velocity, Y coordinate.
Streamlines Python
Python language binding for streamlines
plugin.
Example:
This module generates in every iteration some diffusion signal inside defined circle.
<module name="python:generate"><![CDATA[
layouts = [
["barrier", "outlet", "barrier", "inlet"],
["barrier", "inlet", "barrier", "outlet"]
]
mode = 1
def update(dt, simulation):
global mode
module = simulation.useModule("streamlines")
if (simulation.iteration % 200 == 0):
module.setLayout(layouts[mode % 2])
module.initBarriers(simulation)
mode = mode + 1
]]></module>
Constants:
Name
Type
Description
LEFT
uint
Left side.
RIGHT
uint
Right side.
TOP
uint
Top side.
BOTTOM
uint
Bottom side.
Class streamlines.Module
Streamlines module wrapping class.
Methods:
Name
Return
Arguments
Description
setLayout
int
string
, string
, string
, string
Set streamlines layout. Top, right, bottom, left. Possible values barrier
, inlet
, outlet
, none
.
initBarriers
float
Initialize barriers after setLayout call.
setInletVelocity
int
, float
Change inlet velocity for specific scene side (see constants).