SBML2Matlab

From System Biology Format Converter framework (SBFC)
Jump to: navigation, search

Conversion from SBML to Matlab

Introduction

About SBML
SBML is a machine-readable format for representing models. It is oriented towards describing systems where biological entities are involved in, and modified by, processes that occur over time. An example of this is a network of biochemical reactions. SBML framework is suitable for representing models commonly found in research on a number of topics, including cell signalling pathways, metabolic pathways, biochemical reactions, gene regulation, and many others. If you want to know more, you can read the Basic Introduction on SBML
About Matlab
Matlab is a high-level language, primarily intended for numerical computations. It provides a convenient GUI and command line interface for solving linear and nonlinear problems numerically, and for performing other numerical experiments.


Documentation

The converter is based on JSBML, so support all the levels and versions of SBML until SBML level 3 version 1 core.

Most of the mathematical parts of the SBML model are converted into a set of declarations or equations that can be executed in Octave or Matlab.

SBML elements not supported
  • delay
  • constraint
  • initialAssignment
  • stoichiometryMath
Information lost in the conversion
  • compartment
  • units
  • sboTerm
  • notes
  • most annotations


Download

Currently we do not have a specific package for sbml2matlab, but you can find this converter inside the main sbfc package: sbfc-1.3.7.zip.

End users

To run SBML2Matlab you need java 1.6 or higher.

After unpacking the zipped file, move to the folder that have been created and run:

    # Convert SBML (any *.xml files if you put a folder) to Matlab.
    # The output file(s) will be in the same folder as the SBML file(s) with an extension .m
    ./sbml2matlab.sh [file.xml | folder]

File editing for Octave

The generated m file using this converter works with Matlab. If you decide to execute it with Octave, you can either use the specific converter sbml2octave, or you can edit this generated file directly by commenting / uncommenting some lines in the source code using the Matlab/Octave comment symbol '%'. In the latter case, you have to comment the Matlab code and uncomment the Octave code for:

  • the ODE solver method; and
  • for the f function signature

as shown below.


ODE solver call:

% Depending on whether you are using Octave or Matlab,
% you should comment / uncomment one of the following blocks.
% This should also be done for the definition of the function f below.
% Start Matlab code
%	tspan=[0:0.01:100];
%	opts = odeset('AbsTol',1e-3);
%	[t,x]=ode23tb(@f,tspan,x0,opts);
% End Matlab code

% Start Octave code
	t=linspace(0,100,100);
	x=lsode('f',x0,t);
% End Octave code

f function signature:

% Depending on whether you are using Octave or Matlab,
% you should comment / uncomment one of the following blocks.
% This should also be done for the definition of the function f below.
% Start Matlab code
%function xdot=f(t,x)
% End Matlab code

% Start Octave code
function xdot=f(x,t)
% End Octave code


Developers

To compile SBML2Matlab from source, you also need Apache Ant 1.6.5 or higher.

After editing the source code you can build the jar file by just typing in the SBML2Matlab folder:

    # Generate the jar file
    ant jar

    # Generate Java documentation
    ant javadoc

Getting Help and Support

In case you discover a bug within SBFC or request new features, please let us know. There are two dedicated trackers:

For general discussions about SBFC, please use the forum:

sbfc-forum [at] googlegroups.com.

If you need further support or you wish to develop new modules in SBFC you can contact the team using the following e-mail address:

sbfc-devel [at] googlegroups.com.