Headless BioUML

From BioUML platform
Revision as of 12:26, 27 December 2019 by Ilya Kiselev (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Headless BioUML (or Shell BioUML) is a version of standalone BioUML application without graphic user interface. It allows manipulation with data from repository, import files, work with models, performing numerical simulation and analysis. All of it can be done through java-script API. It also allows manipulating Java objects via org.mozilla.Rhino library. Headless BioUML may be used in two ways:

1. As a shell executing input commands. Simply run

sh ./shell.sh

(or shell.bat in Windows) from the directory in which BioUML is installed.

2. To execute script from file run

sh ./shell.sh -js.f <PATH_TO_FILE> 

from the directory in which BioUML is installed. Replace <PATH_TO_FILE> with path to file containing script you want to execute.

Examples

1. Single simulation.
Here is a simple script example to simulate SBML model and save results into the file

var model_path = ""; //Here is a path to existing SBML model
var result_path = ""; //Here is a path to output file
var diagram = sbml.load("model_path");
var span = simulationEngine.createSpan(0,100,1); //Create time span from 0 to 100 with step 1
var result = simulationEngine.simulate(diagram, span); 
simulationEngine.writeResult(result, result_path, ",", true);

Note: sbml and simulationEngine are host objects providing API for work with sbml and numerical simulations correspondingly.

To get full list of available methods simply type name of host object.

2. Repeated simulations.
In previous example, loaded diagram is compiled into java object Model during simulate step. If you run repeated simulations of the same model you may want to perform this step only once as it may be time consuming. In order to do that you need to call simulationEngine.compileModel and then use simulationEngine.simulateModel

var model_path = ""; //Here is a path to existing SBML model
var result_path = ""; //Here is a path to output file
var diagram = sbml.load("model_path");
var model = simulationEngine.compileModel(diagram) //Compile model object
var span = simulationEngine.createSpan(0,100,1); //Create time span from 0 to 100 with step 1
for (var i=0; i<10; i++)
{
  var result = simulationEngine.simulate(model, span); 
  simulationEngine.writeResult(result, result_path, ",", true); //write results into file result_path. Numeric values are separated with "," symbol
}
Personal tools
Namespaces

Variants
Actions
BioUML platform
Community
Modelling
Analysis & Workflows
Collaborative research
Development
Virtual biology
Wiki
Toolbox