Difference between revisions of "Headless BioUML"
Ilya Kiselev (Talk | contribs) (→Examples) |
Ilya Kiselev (Talk | contribs) (→Examples) |
||
Line 17: | Line 17: | ||
==Examples== | ==Examples== | ||
− | Here is a simple script example to simulate SBML model and save results into the file | + | 1. 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 model_path = ""; //Here is a path to existing SBML model | ||
Line 23: | Line 23: | ||
var diagram = sbml.load("model_path"); | var diagram = sbml.load("model_path"); | ||
var span = simulationEngine.createSpan(0,100,1); //Create time span from 0 to 100 with step 1 | var span = simulationEngine.createSpan(0,100,1); //Create time span from 0 to 100 with step 1 | ||
− | var result = simulationEngine.simulate(diagram, span | + | var result = simulationEngine.simulate(diagram, span); |
− | simulationEngine.writeResult(result, | + | simulationEngine.writeResult(result, result_path, ",", true); |
Note: | Note: | ||
Line 30: | Line 30: | ||
To get full list of available methods simply type name of host object. | To get full list of available methods simply type name of host object. | ||
+ | |||
+ | 2. Repeated simulation. In previous example, loaded diagram is compiled into java object Model during <b>simulate</b> 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 | ||
+ | var result = simulationEngine.simulate(model, span); | ||
+ | simulationEngine.writeResult(result, result_path, ",", true); //write results into file result_path. Numeric values are separated with "," symbol |
Revision as of 12:23, 27 December 2019
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. 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 simulation. 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 var result = simulationEngine.simulate(model, span); simulationEngine.writeResult(result, result_path, ",", true); //write results into file result_path. Numeric values are separated with "," symbol