Skip to content

EscherConverter Understanding current code base

Devesh Khandelwal edited this page May 27, 2016 · 4 revisions

To be able to complete this project, we must first understand the current codebase of [EscherConverter]. As we are basically doing the reverse of the conversion process which EscherConverter currently supports, a clear understanding and mental model of how the conversion between Escher's format and SBML/SBGN takes place is necessary.

For that we will be going through the whole project, visiting and focussing on the important points, pondering on why is it important, what can be improved, what features will be added, what should be removed/replaced/updated, and most importantly, how it ties up to the larger process of the conversion. Let's get started then.

LICENSE

Let's get this cleared out first. Escher and inherently EscherConverter are open source, licensed under the MIT License. It is a highly permissive license, and we don't want to stall research in systems biology just because of a license.

pom.xml

This is the build file for configuring the build of EscherConverter. Every Maven based project have one of these. While most of it is pretty trivial, I'll just point the things which are important.

  • Dependencies

    • junit - We will be using JUnit for unit testing. It is arguably the most popular testing framework for Java out there.
    • JSBML - The de facto library for handling and manipulating SBML files in Java and possibly most languages. Also, this is already used, so we would like to reuse code as much as possible.
    • libSBGN - Again, the de facto for SBGN files. There are also not many options here.
    • JSON - There a few options available for JSON handling. Currently, EscherConverter uses json-simple but we may look into other popular options such as Jackson and Gson.
    • SysBio
  • Build output

    <packaging>jar</packaging>

    The build file is configured to produce an executable jar with EscherConverter as the main class which contains the main method. So, all calls from the command line go to this class.

We would also like to structure this project so that it can also be used as a library for other programmers to use.

Model classes

There are many (infact, most) of the classes which represent the objects present in an SBML/SBGN file, e.g. Gene.java, Node.java, Segment.java, etc.

Also, object classes native to Escher exists such as EscherReaction.java, EscherMap, etc. There are abstract classes (AbstractEscherBase.java, etc.) also which are extended by concrete Escher classes.

An important point here is that, right now, all of these classes live in a single package, there is not a hierarchy or logical arrangement of files. One of the goals of this project will be to also organize this project so that someone else is also able to contribute to it. We can have a separate package e.g. a model for files which represents objects in I/O files. In this, we can have separate packages for Escher, SBGN, SBML, etc.

Other classes

EscherParser

This simply converts a JSON file containing an Escher map to an EscherMap object. The JSON library used doesn't support auto (de)serialization, so JSON files needed to be parsed manually and also allocating objects.

EscherOptions and EscherIOOptions

The options for conversion, e.g. default dimensions and names for boxes, compartments, canvas, etc are configured by these files. Right now, they are also based on the SysBio library.

Converter classes - Escher2[SBGN|SBML|Standard]

Escher2Standard is an abstract generic base class. It contains an abstract convert method which needs to be implemented by deriving classes. Right now, Escher2SBGN and Escher2SBML provides their respective types (SBMLDocument and Sbgn) as the template parameter to the generic class and define their own concrete methods for conversion.

EscherConverter.java

This is the entry point to the jar executable. To get a better understanding, we will first run the project and try to understand what it does. As now I've tried to build and run the project, I'd like to clear a few things here.

The original codebase of EscherConverter was actually built using the SysBio library, which unfortunately neither is open source nor well documented, but it was used by the original author of this software i.e. Andreas Draeger. It was used as he was well versed with it and under time constraints. But in respect of this project, the whole code-base cannot be open sourced due to the license limitations of SysBio.

Since, the code-base we are working in currently is a subset of the original one, with all (most) of the GUI related code being stripped out, it doesn't currently work as expected as there are a few places which need patching or some code needs to be altered in order to get it running again. More topics related to this will be discussed in the next blog post.

For now, we can't run it, so, sorry. 😢

==========

Conclusion

I hope the above was helpful in understanding the current codebase. To know what will happen next, please read What's Next which discusses the plans for EscherConverter.

  1. one
  2. two
  • 2.2
  1. three

Clone this wiki locally