Skip to content

funasoul/celldesigner-parser

Repository files navigation

CellDesigner-Parser

CellDesigner-Parser will parse CellDesigner annotations from SBML. The parser API will automatically generated from schema (*.xsd) files by using JAXB.

Schema files

How to generate the parser API

Just execute build.sh from the commandline, then it will generates the Java code under src directory. The generated code is also included in this git repository.

% sh build.sh
parsing a schema...
compiling a schema...
org/sbml/sbml/level2/version4/AlgebraicRule.java
org/sbml/sbml/level2/version4/AssignmentRule.java
org/sbml/sbml/level2/version4/Compartment.java
org/sbml/sbml/level2/version4/Event.java
...

How to use the parser API

Requirements

We have tested our API on Java 8 (1.8.0_40). To use this API, it is recommended to use Maven so that you can easily install dependent libraries.

Download and setup

Clone this project

cd ~/git/
git clone https://github.com/funasoul/celldesigner-parser.git

Launch Eclipse and import as Maven project.

  1. [File] -> [Import] -> [Maven] -> [Existing Maven Project] -> [Next]
  2. Navigate to ~/git/celldesigner-parser -> [Next]
  3. Select /pom.xml which you will see in the dialog.
  4. Press [Next], then Eclipse will create a new project. That's it!

Example code

The sample code is placed under src/sample directory, but just for a quick look, here is an example code which will read an SBML file (w/ CellDesigner-Extensions and obtain CellDesigner specific information from its annotation).

package sample;

import java.util.List;
import javax.xml.bind.JAXBException;
import org.sbml._2001.ns.celldesigner.ConnectScheme;
import org.sbml._2001.ns.celldesigner.SpeciesAlias;
import org.sbml.wrapper.ModelWrapper;
import org.sbml.wrapper.ObjectFactory;
import org.sbml.wrapper.ReactionWrapper;

/**
 * @author Kaito Ii
 * @author Akira Funahashi
 *
 * Date Created: May 20, 2016
 * Date Modified: May 30, 2016
 */

public class APITest {
  /**
   * @param args
   */
  public static void main(String[] args) {
    ModelWrapper model = null;
    try {
      model = ObjectFactory.unmarshalSBML("sample/sample.xml");
    } catch (JAXBException e) {
      e.printStackTrace();
    }
    // ListOfSpeciesAlias
    List<SpeciesAlias> saList = model.getListOfSpeciesAliases();
    for (SpeciesAlias sa : saList) {
      String str = sa.getId() + ":" + sa.getSpecies() + ":";
      str += "(" + sa.getBounds().getX() + "," + sa.getBounds().getY() + ") [";
      str += sa.getBounds().getW() + " x " + sa.getBounds().getH() + "]";
      System.out.println(str);
    }
    // ListOfReactions
    List<ReactionWrapper> rList = model.getListOfReactionWrapper();
    for(ReactionWrapper r : rList){
    	System.out.println(r.getId() + ": " + r.getReactionType());
    	ConnectScheme cs = r.getConnectScheme();
    	System.out.println("connect policy: " + cs.getConnectPolicy());
    }
  }
}

Interconvertable Layout Software for CellDesigner

Interconvertable Layout Software for CellDesigner provides the way to convert from CellDesigner Annotation into SBML Layout package and vice versa.

Create runnable

mvn install

How to convert file

java -jar layoutconverter-1.0.0-jar-with-dependencies.jar /path/to/input.xml /path/to/output.xml

Command Line Options

-h, --help

Display help message

-d, --defaultCompartment

Convert default compartment. By default, the conversion excludes the compartment named "default"

-c, --CD2Layout

Convert CellDesigner Annotation to SBML Layout package

-l, --Layout2CD

Convert SBML Layout package to CellDesigner Annotation

So, what's next?

CellDesigner annotation to SBML Layout package

  • Alter schema to add editPoints into reactant links and product links
  • Convert complex species and included species to SBML Multi package
  • Convert Layers in CellDesigner Annotation
  • Convert boolean logic edit points

SBML Layout package to CellDesigner annotation

  • Convert reaction without reactant/product
  • Convert position to compartment

License

This content is licensed under the Apache License .