LibSBML

Last updated • 6 min readFrom Wikipedia, The Free Encyclopedia
libSBML
Developer(s) The SBML Team
Initial releaseMarch 12, 2003;21 years ago (2003-03-12)
Stable release
5.18.0 / 18 April 2019;5 years ago (2019-04-18)
Written in C++, C
Operating system Microsoft Windows, Mac OS, Unix-like
Type XML parser library
License LGPL License v2.1
Website sbml.org

LibSBML is an open-source software library that provides an application programming interface (API) for the SBML (Systems Biology Markup Language  [1] [2] [3] ) format. The libSBML library can be embedded in a software application or used in a web servlet (such as one that might be served by Apache Tomcat) as part of the application or servlet's implementation of support for reading, writing, and manipulating SBML documents and data streams. The core of libSBML is written in ISO standard C++; the library provides API for many programming languages via interfaces generated with the help of SWIG.

Contents

The libSBML library is free software released under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or any later version. LibSBML was developed thanks to funding from many agencies, particularly the National Institute of General Medical Sciences (NIGMS, USA) as well as the Defense Advanced Research Projects Agency (DARPA, USA) under the Bio-SPICE program.

Description

The Systems Biology Markup Language (SBML) is an XML-based format for encoding computational models of a sort common in systems biology. Although SBML is based upon XML, and thus software developers could support SBML using off-the-shelf XML parser libraries, libSBML offers numerous advantages that make it easier for developers to implement support for SBML in their software. The premise behind the development of libSBML is that it is more convenient and efficient for developers to start with a higher-level API tailored specifically to SBML and its distinctive features than it is to start with a plain XML parser library.

Significant features of libSBML

The following is a partial list of libSBML's features:

Manipulation of mathematical formulas

Some further explanations may be warranted concerning libSBML's support for working with mathematical formulas. In SBML Level 1, mathematical formulas are represented as text strings using a C-like syntax. This representation was chosen because of its simplicity, widespread familiarity and use in applications such as GEPASI [4] and Jarnac, [5] whose authors contributed to the initial design of SBML. In SBML Levels 2 and 3, there was a need to expand the mathematical vocabulary of Level 1 to include additional functions (both built-in and user-defined), mathematical constants, logical operators, relational operators and a special symbol to represent time. Rather than growing the simple C-like syntax into something more complicated and esoteric in order to support these features, and consequently having to manage two standards in two different formats (XML and text string formulas), SBML Levels 2 and 3 leverage an existing standard for expressing mathematical formulas, namely the content portion of MathML.

As mentioned above, LibSBML provides an abstraction for working with mathematical expressions in both text-string and MathML form: Abstract Syntax Trees (ASTs). Abstract Syntax Trees are well known in the computer science community; they are simple recursive data structures useful for representing the syntactic structure of sentences in certain kinds of languages (mathematical or otherwise). Much as libSBML allows programmers to manipulate SBML at the level of domain-specific objects, regardless of SBML Level or version, it also allows programmers to work with mathematical formula at the level of ASTs regardless of whether the original format was C-like infix or MathML. LibSBML goes one step further by allowing programmers to work exclusively with infix formula strings and instantly convert them to the appropriate MathML whenever needed.

Dependencies

LibSBML requires a separate library to do low-level read/write operations on XML. It can use any one of three XML parser libraries: Xerces, expat or libxml2. Users can specify which library they wish to use at libSBML compilation time. LibSBML hides the differences between these parser libraries behind an abstraction layer; it seamlessly uses whichever library against which a given instance of libSBML has been compiled. (However, released binary distributions of libSBML all make use of the libxml2 library.)

Usage

LibSBML uses software objects (i.e., instances of classes) that correspond to SBML components, with member variables representing the attributes of the corresponding SBML objects. The libSBML API is constructed to provide an intuitive way of relating SBML and the code needed to create or manipulate it with a class hierarchy that mimics the SBML structure. More information about the libSBML objects is available in the libSBML API documentation.

Reading and writing SBML

LibSBML enables reading from and writing to either files or strings. Once an SBML document is read, libSBML stores the SBML content in an SBMLDocument object. This object can be written out again later. The following is an example written in Python:

>>> importlibsbml>>>>>> # read a document >>> doc=libsbml.readSBMLFromFile(filename)>>> doc=libsbml.readSBMLFromString(string)>>>>>> # helper function that takes either a string >>> # or filename as argument>>> doc=libsbml.readSBML(filename)>>> doc=libsbml.readSBML(string)>>>>>> # write a document>>> libsbml.writeSBMLToFile(doc,filename)True>>>>>> libsbml.writeSBMLToString(doc)'<?xml version="1.0" encoding="UTF-8"?>\n<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core"       level="3" version="1">\n    <model/>\n</sbml>\n'

Creating and manipulating SBML

The libSBML API allows easy creation of objects and subobjects representing SBML elements and the subelements contained within them. The following is an example written in C++:

voidcreateSBML(){// create an SBML Level 3 Version 1 documentSBMLDocument*doc=newSBMLDocument(3,1);// create the model as a sub element of the documentModel*model=doc->createModel();// create a compartment as a sub element of the modelCompartment*compartment1=model->createCompartment();// create an independent compartment and then add it to the modelCompartment*compartment2=newCompartment(3,1);model->addCompartment(compartment2);}

Accessing attributes

Each component in SBML has a number of attributes associated with it. These are stored as member variables of a given class, and libSBML provides functions to retrieve and query these values. The syntax of these functions is consistent throughout libSBML. The following is an example written in Python:

>>> importlibsbml>>>>>> # create an SBML Level 3 Version 1 document>>> sbmlns=libsbml.SBMLNamespaces(3,1)>>> doc=libsbml.SBMLDocument(sbmlns)>>>>>> #create the model as a sub element of the document>>> model=doc.createModel()>>>>>> #create a compartment as a sub element of the model>>> compartment=model.createCompartment()>>>>>> # set the attributes on the compartment>>> # note a return value of 0 indicates success>>> compartment.setId("cell")0>>> compartment.setSize(2.3)0>>> compartment.setSpatialDimensions(3)0>>> compartment.setUnits("litre")0>>> compartment.setConstant(True)0>>>>>> # get the attribute values>>> compartment.getId()'cell'>>> compartment.getSpatialDimensions()3>>>>>> # examine the status of the attribute>>> compartment.isSetSize()True>>> compartment.getSize()2.3>>>>>> #unset an attribute value>>> compartment.unsetSize()0>>> compartment.isSetSize()False>>> compartment.getSize()nan

See also

Related Research Articles

<span class="mw-page-title-main">Standard Generalized Markup Language</span> Markup language

The Standard Generalized Markup Language is a standard for defining generalized markup languages for documents. ISO 8879 Annex A.1 states that generalized markup is "based on two postulates":

<span class="mw-page-title-main">XML</span> Markup language by the W3C for encoding of data

Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. The World Wide Web Consortium's XML 1.0 Specification of 1998 and several other related specifications—all of them free open standards—define XML.

Mathematical Markup Language (MathML) is a mathematical markup language, an application of XML for describing mathematical notations and capturing both its structure and content, and is one of a number of mathematical markup languages. Its aim is to natively integrate mathematical formulae into World Wide Web pages and other documents. It is part of HTML5 and standardised by ISO/IEC since 2015.

YAML is a human-readable data serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted. YAML targets many of the same communications applications as Extensible Markup Language (XML) but has a minimal syntax that intentionally differs from Standard Generalized Markup Language (SGML). It uses Python-style indentation to indicate nesting and does not require quotes around most string values.

Extensible Application Markup Language is a declarative XML-based language developed by Microsoft for initializing structured values and objects. It is available under Microsoft's Open Specification Promise.

<span class="mw-page-title-main">CellML</span>

CellML is an XML based markup language for describing mathematical models. Although it could theoretically describe any mathematical model, it was originally created with the Physiome Project in mind, and hence used primarily to describe models relevant to the field of biology. This is reflected in its name CellML, although this is simply a name, not an abbreviation. CellML is growing in popularity as a portable description format for computational models, and groups throughout the world are using CellML for modelling or developing software tools based on CellML. CellML is similar to Systems Biology Markup Language SBML but provides greater scope for model modularity and reuse, and is not specific to descriptions of biochemistry.

JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of name–value pairs and arrays. It is a commonly used data format with diverse uses in electronic data interchange, including that of web applications with servers.

An INI file is a configuration file for computer software that consists of plain text with a structure and syntax comprising key–value pairs organized in sections. The name of these configuration files comes from the filename extension INI, short for initialization, used in the MS-DOS operating system which popularized this method of software configuration. The format has become an informal standard in many contexts of configuration, but many applications on other operating systems use different file name extensions, such as conf and cfg.

The Systems Biology Markup Language (SBML) is a representation format, based on XML, for communicating and storing computational models of biological processes. It is a free and open standard with widespread software support and a community of users and developers. SBML can represent many different classes of biological phenomena, including metabolic networks, cell signaling pathways, regulatory networks, infectious diseases, and many others. It has been proposed as a standard for representing computational models in systems biology today.

<span class="mw-page-title-main">BioModels</span> Database of biological reactions

BioModels is a free and open-source repository for storing, exchanging and retrieving quantitative models of biological interest created in 2006. All the models in the curated section of BioModels Database have been described in peer-reviewed scientific literature.

<span class="mw-page-title-main">Systems Biology Ontology</span>

The Systems Biology Ontology (SBO) is a set of controlled, relational vocabularies of terms commonly used in systems biology, and in particular in computational modeling.

A mathematical markup language is a computer notation for representing mathematical formulae, based on mathematical notation. Specialized markup languages are necessary because computers normally deal with linear text and more limited character sets. A formally standardized syntax also allows a computer to interpret otherwise ambiguous content, for rendering or even evaluating. For computer-interpretable syntaxes, the most popular are TeX/LaTeX, MathML, OpenMath and OMDoc.

XPath is an expression language designed to support the query or transformation of XML documents. It was defined by the World Wide Web Consortium (W3C) in 1999, and can be used to compute values from the content of an XML document. Support for XPath exists in applications that support XML, such as web browsers, and many programming languages.

NeuroML is an XML based model description language that aims to provide a common data format for defining and exchanging models in computational neuroscience. The focus of NeuroML is on models which are based on the biophysical and anatomical properties of real neurons.

<span class="mw-page-title-main">JSBML</span>

JSBML is an open-source Java (API) for the SBML format. Its API strives to attain a strong similarity to the Java binding of the corresponding library libSBML, but is entirely implemented in Java and therefore platform independent. JSBML provides an elaborated abstract type hierarchy, whose data types implement or extend many interfaces and abstract classes from the standard Java library. In this way, JSBML integrates smoothly into existing Java projects, and provides methods to read, write, evaluate, and manipulate the content of SBML documents.

LaTeXML is a free public domain software package which converts LaTeX documents to XML, HTML, EPUB, JATS and TEI.

<span class="mw-page-title-main">SED-ML</span>

The Simulation Experiment Description Markup Language (SED-ML) is a representation format, based on XML, for the encoding and exchange of simulation descriptions on computational models of biological systems. It is a free and open community development project.

References

  1. Hucka, M.; Finney, A.; Sauro, H. M.; Bolouri, H.; Doyle, J. C.; Kitano, H.; Arkin, A. P.; Bornstein, A. P.; Bray, B. J.; Cornish-Bowden, D.; Cuellar, A.; Dronov, A. A.; Gilles, S.; Ginkel, E. D.; Gor, M.; Goryanin, V.; Hedley, I. I.; Hodgman, W. J.; Hofmeyr, T. C.; Hunter, J. -H.; Juty, P. J.; Kasberger, N. S.; Kremling, J. L.; Kummer, A.; Le Novère, U.; Loew, N.; Lucio, L. M.; Mendes, P.; Minch, P.; Mjolsness, E. (2003). "The systems biology markup language (SBML): A medium for representation and exchange of biochemical network models". Bioinformatics. 19 (4): 524–531. doi: 10.1093/bioinformatics/btg015 . PMID   12611808.
  2. Finney, A.; Hucka, M. (2003). "Systems biology markup language: Level 2 and beyond". Biochemical Society Transactions. 31 (Pt 6): 1472–1473. CiteSeerX   10.1.1.466.8001 . doi:10.1042/bst0311472. PMID   14641091.
  3. Hucka, M.; Finney, A.; Bornstein, B. J.; Keating, S. M.; Shapiro, B. E.; Matthews, J.; Kovitz, B. L.; Schilstra, M. J.; Funahashi, A.; Doyle, S. M.; Kitano, M. J. (2004). "Evolving a lingua franca and associated software infrastructure for computational systems biology: The Systems Biology Markup Language (SBML) project" (PDF). Systems Biology. 1 (1): 41–53. doi:10.1049/sb:20045008 (inactive 7 December 2024). PMID   17052114.{{cite journal}}: CS1 maint: DOI inactive as of December 2024 (link)
  4. Mendes, P. (1993). "GEPASI: A software package for modelling the dynamics, steady states and control of biochemical and other systems". Computer Applications in the Biosciences. 9 (5): 563–571. doi:10.1093/bioinformatics/9.5.563. PMID   8293329.
  5. Jarnac, Sauro H. "A system for interactive metabolic analysis". In: Hofmeyr, J-HS, et al., eds. Animating the Cellular Map: Proceedings of the 9th International Meeting on BioThermoKinetics. Stellenbosch, South Africa: Stellenbosch University Press; 2000. pp. 221228.