The LIMPOPO SampleTab Parser

The LIMPOPO SampleTab Parser is a Java library intended as a simple one-stop solution for SampleTab parsing, validating, and programmatic object modelling.

It comes equipped with an internal, thread safe object model that represents the MSI as lists of objects and SCD as a comprehensive graph.

The LIMPOPO parser is very easy to use, requiring just a few lines of code to parse SampleTab documents. The LIMPOPO object model can also easily be populated programmatically.

The parser is readily extensible using a plug-in mechanism to provide additional parsing functionality, validation, or the ability to convert SampleTab documents into your own object model.

Installation

To use the SampleTab parser in your own code, you can either download the parser binary directly here or configure a dependency on it using maven.

There are two versions - the basic version doesn't include any of the project's dependencies, and the "assembly" version comes with dependencies pre-bundled. If you use the basic version, you will need to include the required dependencies: these are listed here.

If you use Maven, you don't need to worry about dependency management - if you want to add a LIMPOPO as a dependency of your own Maven project, you can add the following repository to your pom.xml file:

  <repositories>
    <repository>
      <id>limpopo-repo</id>
      <name>Limpopo Mini-SF Repository</name>
      <url>http://limpopo.sourceforge.net/maven/repo</url>
    </repository>
  </repositories>

Then simply add a dependency on LIMPOPO like so:

  <dependencies>
    <dependency>
      <groupId>uk.ac.ebi.arrayexpress2</groupId>
      <artifactId>limpopo-sampletab</artifactId>
      <version>1.1.2</version>
    </dependency>
  </dependencies>

Usage

Using the parser in an application is simple; import the relevant package and declare some code similar to the following:

 SampleTabParser parser = new SampleTabParser();

 File sampletabFile = new File("/path/to/sampletab");
 SampleData sampledata = parser.parse(sampletabFile);

You can then extract data from the investigation using various public fields, so for example:

 String title = sampledata.msi.submissionTitle;

Sample and group objects can be accessed by the following:

 SampleNode sample = sampledata.scd.getNode("samplename", SampleNode.class);
 GroupNode sample = sampledata.scd.getNode("groupname", GroupNode.class);
 for (SCDNodeAttribute attribute : sample.attributes){
   String key = attribute.getAttributeType();
   String value = attribute.getAttributeValue();
 }

Simple as that!