The SBML community has created a software library called libsbml[70] which provides developers of software tools with an easy way to read and write SBML model files and check those models for consistency and conformance to the SBML specification.
Since the SBML specification is fairly complex and checking for syntactic as well as semantic error within an SBML model is no trivial task, having this library greatly reduces the work necessary for implementing support for the SBML standard in software tools. And while in the beginning many tools were creating invalid SBML due to missing possibilities to check the models that were created, there now is a mature infrastructure based on libsbml which can be used for testing and therefore finding and eliminating incorrect SBML files.
A lot of developers have recognized the advantages of using such a stable and feature rich library to facilitate their work and many software projects therefore use libsbml for the implementation of SBML support.
Libsbml Implementation
The success of SBML has demonstrated that it is important to have a stan- dard, but even better to have a library that helps developers in implementing that standard. To provide the same level of support for the SBML layout extension, an implementation of the layout extension as part of libsbml has been written. This way developers already using libsbml are provided with an easy way to read layout information stored as SBML layout extension data in SBML files.
The first implementation was finished in April of 2004 and released as a patch against the sources of libsbml version 2.0.3.
To use it, developers need to download the patch as well as the source code for libsbml, apply the patch and compile the patched source code. Just as the specification of the SBML layout extension followed the SBML specification in style, the implementation of the layout extension closely followed the rules and standards set by libsbml. This way developers already familiar with using libsbml could apply their knowledge directly to the implementation of the layout extension. Figure 3.10 shows the inheritance tree of the SBML layout classes and how the individual classes of the layout implementation extension are used by other classes.
The implementation provides language bindings for the C, C++, Python and Java programming languages allowing programmers who are using any of those languages to read and write layout information according to the SBML layout extension.
Documentation was provided in the form of application programming in- terface (API) documentation as well as examples for the different program- ming languages.
The layout extension continued to be developed as a patch against the different version of libsbml and new versions of the patch were released on a regular basis, following changes and developments in libsbml.
Starting with libsbml 2.3.0 the code for the support of the layout extension was integrated into the main libsbml code and is now included in each release of libsbml. In the beginning the extension was marked as experimental and the developer had to enable the feature explicitly if they wanted to use it. Later releases of libsbml marked it as stable and enabled it per default. By now all precompiled versions of libsbml are distributed with layout extension support enabled.
The libsbml code is very stable and mature and to ensure the quality of the code most features are tested with a comprehensive set of unit tests. The unit testing framework that is used in libsbml is called check[135].
IMPLEMENTATION OF THE LAYOUT EXTENSION 59
extension a set of 254 unit tests covering all aspects of the layout extension have been written. These tests can now be run prior to a release to make sure that neither changes to the code of the core of libsbml nor changes to the code for the extension did break existing functionality.
Implementation Of Layout Rendering
Since one of the goal of the layout and render extension is to provide the user with the possibility to store high quality diagrams in SBML models, e.g. for publications, reading and writing the layout information is not enough. In addition to an implementation for reading and writing SBML layout exten- sion data in libsbml there are several implementations for creating images from this layout information.
The first implementation that I created is based on XSL Transforma- tions (XSLT)[136]. In XSLT a set of transformation rules, a so called XSLT stylesheet, is defined that specifies how a program, called XSLT processor, transforms input in XML format to textual output. The output data itself can also be in XML format, but it doesn’t have to be. In this case the XSLT stylesheet defines a set of transformations that specify how an SBML file with layout information according to the SBML layout extension is converted to a Scalable Vector Graphics (SVG) diagram[133].
The identifier of the layout and some additional parameters that define the style of the final rendering can be given as arguments to the XSLT pro- cessor. In a second step the resulting SVG diagram can be converted to a bitmap image of arbitrary size. This procedure is ideally suited for making high quality images for publications.
When this implementation was first completed in 2005 there was no full implementation of the SVG standard and consequently it was difficult to convert the SVG file to the corresponding bitmap image. The results would usually depend on the program that was used to do the conversion. To- day support for SVG has improved and there are a number of reliable im- plementations for rendering bitmap images from SVG diagrams including librsvg[122], cairo[137] or batik[121]. In addition to those software libraries, most browsers[119, 118, 120] can render SVG files as well as some image ma- nipulation programs like gimp[124]. The quality and consistency of bitmaps rendered by any of these programs is usually very high.
In order to test this implementation, a set of SBML files with layout information has been created which tries to cover as many aspects of the conversion and rendering process as possible. These test files were especially important when I later extended the XSLT stylesheet with new features (see 3.6) because they could be used to assure that the new functionality did not
THE SBML RENDER EXTENSION 61
interfere with the existing functionality.
SBML Level 3 & Standardization
SBML was intentionally limited to a feature set that provide the means to exchange models of reaction networks between programs with an emphasis of using differential equations to describe the models. This can be seen as a least common denominator that can be understood by most programs in that field. However, more and more programs start to be limited by the narrow scope of SBML. For example the information needed to describe spatial models can not be stored using the core SBML functionality which makes it unsuitable for these types of models.
Due to this a number of extension to SBML have been proposed[138], sim- ilarly to what the described layout extension does but for different purposes, e.g. extensions for spatial simulation[139] or for model composition[140]. Since the number of proposals is growing continuously, the SBML commu- nity has come up with a set of procedures that has to be followed before an extension proposal can become a recommended SBML extension or an SBML package which is the term for SBML extensions to SBML Level 3.
In order to become a recommended SBML extension there has to be an official proposal that can be reviewed. This proposal has to be implemented at least twice independently and finally there has to be a vote by the members of the SBML community on whether a proposal will become an officially recommended extension or not[141].
This is a very lengthy process and until today the layout extension pro- posal is the only proposal that has made it through the first of the two stages.[142]