SBML.org — the global portal for all things SBML

Getting started with JSBML

Contents

The following are quick-start instructions for getting started with JSBML. Before doing any of the steps below, you will need to obtain a copy of JSBML either via the GitHub download page, SourceForge download page or using maven or git as described below.

Apart from this brief page, JSBML provides as well a nice User Guide with a chapter on getting started with JSBML. This chapter will be more up-to-date and detailed than the current page and will contain additional information to go beyond the 'getting started' phase.

Introduction

JSBML is a library that will help you to manipulate SBML files. If you are not familiar with SBML, a good starting point would be to read the SBML specification. If you have some other questions about SBML, you may found the answer in the SBML FAQ.

JSBML is written in Java and to use it, you will need a Java Runtime Environment(JRE) 1.7 or higher. See for example the Java SE download page.

Using the JSBML JAR file distribution

Before starting to use JSBML, you will need to configure your CLASSPATH. JSBML provides you with two options :

  • using the JSBML jar file with dependencies, then you just need to include this file in your CLASSPATH.
  • using the JSBML jar file without dependencies, then you need to add all the needed dependencies of JSBML.

Using the JSBML JAR with dependencies

The version of the archive that includes dependencies is a merged JAR file that contains all of JSBML’s required third-party libraries. You can download it from the JSBML download area. Once you have installed the JAR file on your computer, it is sufficient to add it to your Java build and/or class path in order to use JSBML.

Using the JSBML JAR without dependencies

List of needed dependencies :

  • biojava-ontology-4.0.0.jar
  • junit-4.8.jar
  • woodstox-core-5.0.1.jar
  • stax2-api-3.1.4.jar
  • staxmate-2.3.0.jar
  • xstream-1.3.1.jar
  • jigsaw-dateParser.jar : this is a stripped version of the jigsaw library (from Dec 2010) containing one class to manipulate date.
  • log4j-1.2-api-2.3.jar
  • log4j-api-2.3.jar
  • log4j-core-2.3.jar
  • log4j-slf4j-impl-2.3.jar
  • slf4j-api-1.7.21.jar


These are the versions JSBML was developed and tested with, some more recent versions might work.

When you have all of these dependencies in your CLASSPATH alongside the jsbml jar file, you are ready to work with jsbml.

Using Maven

You can manage the dependencies to JSBML using Maven, if you want to know more, please go to the dedicated maven page.

Using the source distribution

As an alternative to using the JAR files, you can check out the source tree from github, using GIT or subversion, and compile JSBML yourself. To do that, you will need to have a Java JDK installed, the Apache Ant build system, and git or subversion (version control system).

# to get the source
git clone https://github.com/sbmlteam/jsbml.git jsbml
cd jsbml
# or using svn
svn co https://github.com/sbmlteam/jsbml.git/trunk jsbml
cd jsbml

With the command above, you'll obtain the complete current source distribution of the JSBML project. If you are only interested in working with the SBML core, i.e., neither SBML extensions, nor JSBML modules, you may want

# to get the source of the JSBML core only
svn co https://github.com/sbmlteam/jsbml.git/trunk/core jsbml-core
cd jsbml-core
# to compile and create the library jar file
ant jar
# to run the tests
ant test

(There are no easy ways to do a partial clone with git. Although if you really want to use git and really want to do a partial checkout with it, see this stack overflow entry: git sparse checkout)

Setting up Eclipse

To setup eclipse, in general, you have to add the src, test and resources folder to your eclipse build path. As well as any jar files included in the lib folder.

Then, you need to do an extra step to configure the annotation processor, as the different parsers in JSBML are registered automatically using java annotation.

To configure the annotation processor, follow the instructions in the page https://github.com/niko-rodrigue/spi/blob/wiki/EclipseSettings.md The jar file of the annotation processor is located in the jsbml source tree at “jsbml”/core/lib/spi-full-0.2.4.jar.

You can run the ParserManager class to check that the list of parsers are not empty and that they contain the parsers you need.

Using JSBML extensions

SBML Level 3 is a modular format, with optional Level 3 packages that add additional format features. To work with SBML packages using JSBML, you need to add the JSBML extensions that implement the desired packages. You can check out all extensions at once using this method:

# Check out all JSBML extension packages as one repository:
svn co https://github.com/sbmlteam/jsbml.git/trunk/extensions JSBMLext

Or you can create a separate repository for each package you are interested in

# Download an individual extension package, for example the layout package:
svn co https://github.com/sbmlteam/jsbml.git/trunk/extensions/extensions/layout Layout

Here you can see all currently available SBML packages for JSBML.

Using JSBML modules

You can check out the modules of JSBML as follows:

# The module for using JSBML-based applications on Android OS can be obtained here:
svn co https://github.com/sbmlteam/jsbml.git/trunk/modules/android jsbml-android

# Obtain the CellDesigner bridge here:
svn co https://github.com/sbmlteam/jsbml.git/trunk/modules/celldesigner celldesigner

# The JSBML/libSBML compare module contains test functions for comparion of both:
svn co https://github.com/sbmlteam/jsbml.git/trunk/modules/compare compare

# And the libSBML compatibility module is available from this resource:
svn co https://github.com/sbmlteam/jsbml.git/trunk/modules/libSBMLcompat libSBMLcomp

# The libSBML communication layer can be found here:
svn co https://github.com/sbmlteam/jsbml.git/trunk/modules/libSBMLio/ libSBMLio

Retrieved from "http://sbml.org/Software/JSBML/Getting_started_with_JSBML"

This page was last modified 15:23, 15 December 2016.



Please use our issue tracking system for any questions or suggestions about this website. This page was last modified 15:23, 15 December 2016.