Thursday, August 18, 2016


It's almost over

Finally after 4 months GSoC the end is near. It was a awesome experience to work with SBML and JSBML team and how much work and efforts they put in this project and what is to work in a collaboration. If it is possible I would like to continue my work after GSoC.

Repository Information

Here is the repository information:
GitHub Commits:
GitHub Fork Page:


Because there have been of a lot of changes since the first post, I would like to introduce Deviser's code generator to produce Java code once again.

SBML Packages

Computation modeling has become a crucial aspect of biological research, and SBML (the Systems Biology Markup Language) has become the de facto standard open format for exchanging models between software tools in systems biology.
Since SBML Level 3 is being developed as a modular format with optional SBML Level 3 packages are available to extend the focus of the core SBML representation. Deviser is a new code generation system developed to facilitate the development of SBML L3 packages by helping to automate the generation of specifications, UML diagrams and library code.
The current fork extends Deviser's code generator to produce Java code that can be integrated into JSBML, the pure Java API library for SBML. This allows Deviser to target both libSBML and JSBML. At the current stage it generates the foundation of the packages, which facilitates their implementation. 

Using Deviser for Java Code Generation

There is command line version of the function that can be used to invoke the deviser functionality for generating Java/JSBML code from the XML file. This is the file found in the generator directory. [--generatejsbml][--latex] input-file.xml  

Requirements for the fork

Deviser requires javap for the java code generation at the current phase. Javap is available with the JDK and the following is required for Devisers' java code functionality.

  1. Java JDK is required for javap
Also set up JAVA_HOME environment variable for your operating system, if you are working under Windows, here is a good tutorial on how to set up. And for Linux: Ubuntu/Debian.

Current State

At the current state Deviser generates compilable templates, which serve as a foundation and facilitate the implementation of the following packages :
  1. Qualitative Models package (qual, for short) allows species in a model to have non-quantitative or non-continuous levels. (Chaouiya et al., 2013)
  2. Groups (groups, Hucka and Smith, 2013) agglomerates SBML model elements and can be linked to annotations and SBO terms (Courtot et al., 2011) to contextualize sets of objects for other programmers and modelers.
  3. Distributions (distrib, Moodie and Smith, 2013) encodes statistical distributions and their sampling.
  4. Dynamic Structures (dyn, Gomez et al., 2014), which supports the definition of dynamical behaviors for model entities.

What is left to be implemented

Specific parts of the packages are left to be implemented.
  1. Flux Balance Constraints (fbc, Olivier and Bergmann, 2013) encodes components for constraints based modeling (Lewis et al., 2012), which employs a class of models in which the canonical stoichiometric relations between reactions and metabolites are specified as constraints for mathematical optimization.
  2. Spatial Processes (spatial, Schaff et al., 2014) specifies geometric descriptions of biochemical models’ components using a cellular coordinate system that can describe non-uniform molecular distributions, diffusive transport and spatially localized reactions.
I would also like to optimize 'imports' parts, as well as to find an alternative to javap, which is used extensively, so deviser does not have any dependency for Java/JSBML code generation.

Java Tests

For running Java code generation tests, please head to generator/tests/test_java_code and run
If there are any errors, it will also show the code differences.

Final Notes

So,this is the end. As I said, it was a great summer and I had a lot of fun working on this project. I could recommend everyone who wants to improve the coding skills to apply for the Google Summer of Code. There's nothing to lose, but you will gain a lot, specially invaluable knowledge and experience. And even if you are not a system biologist, it is a promising field, so checkout the projects of the SBML and JSBML team. 


I am very grateful to my mentors Dr. Bergmann, Dr. Keating, Dr. Dräger and Dr. Rodriguez for the invaluable help and patience.

Tuesday, August 16, 2016

Week 17

Hi everyone,

Only one week left. Can't believe that GSoC is almost over.

So what was done during this week:

  1. Important bugs were fixed in readAttributes and toString method generators.
  2. The constructor generator was updated as well as the hashCode generator.
  3. Tests were set up  and run fine both on Windows and Linux.
  4. A prototype version was created.
  5. Updated some parts of the code comments, but still there is work to be done.

The good news is that the parser generator was finalized and that generated code by deviser for qual, dyn,distrib and groups packages  are compilable.

The plan is to spend the next 2-3 days cleaning up the code and updating the comments, since deviser is quite complicated and there are tricky moments. They are available at WIP branch  of the fork repository.

Tuesday, August 9, 2016

Week 16

Hi everyone,

This week the following things were done:

  1. Implemented writer
  2. Implemented skeleton for jsbml parser generation.
  3. Updated expand attributes for parser
  4. Added getNamespaceURI() generator
  5. Added getShortLabel() generator
  6. Added isRequired() generator
  7. getPackageName() generator
  8. getPackageNamespaces()
  9. getNamespaces()
  10. getNamespaceFor(int level, int version, int packageVersion)
  11. createPluginFor() method generator.
  12. getListOfSBMLElementsToWrite(Object sbase)
  13. processAttribute() generator
  14. processEndElement() generator
And the good news are that the codes  are generated both under Windows and Linux(430d214).

The only thing left for the parser generation is to finalize processStartElement and writeElement methods.
The unusual order of the "else if" statements generation for processStartElement turned out a little problematic.
The only thing that is challenging is that  package specific features are treated differently in JSBML from libSBML, such is the case for FBCs'     "And" and "Or" treatment.

Wednesday, August 3, 2016

Week 15

Hi everyone,

This week the following things were done:

  1. Implemented enum writer
  2. Devised the JSBML constants writer
  3. Devised the plugins writer
One addition to the tests was creating a new function for comparing the generated files with the test units, the new function uses difflib from python and now it is possible to see the differences and the lines if there are errors.
And the good news are that the codes generated for qual, fbc, dyn, distrib and groups packages are compilable(53dd6b7).

So far from the packages only 'spatial' is left to be adapted, that means the necessary functions need to be adapted for the code generation. And there is also the question for the generation of the parser.

Tuesday, July 19, 2016

Week 13

Still Work in Progress....


Last week a compilable class goal was achieved.So this week was about setting up tests.
Since deviser generates and select random UUID and prime number, the two methods were adapted for running tests. In the case of prime number, random.seed was set to 0 as for the UUID to a fixed number,as random seed would not affect it.
The foundation of java tests served test_cpp_code files, which were adapted for the java files generation. The path separator was changed to os.sep, so it uses OS specific separator.

javap parser 

jsbml jar was put inside deviser package and javap works under Windows as well.

List of modifications

  1. added lo_element writer
  2. fixed problem with brackets for equals and copy constructor.

Tuesday, July 12, 2016

Week 12

Hello all,

Here's the summary:

Compilable Class

Deviser generates a compilable The class also worked as a replacement in the official jsbml code, but since deviser does not generate not generate   QualitativeSpecies(species) constructor, that part of the code had to be commented in the official jsbml code, after that the compilation was successful(

Fig.1 Compilable

UUID generator

Dr. Bergmann gave valuable help and recommendation for the generation of UUIDs.
Python includes uuid module, that can be used for the generation of uuids, but since Java uses long 64 bit, while python generates 128 bit, the generated uuid had to be masked.
After changing to 56 bit, java compiler would not give more errors for being too long.

hashCode method changes

Generated prime numbers were changed to a global variable, so that the numbers are only generated once.

Implemented Methods

Here's the list of the methods, that were implemented during this week:
  1. prototype writeXMLAttributes
  2. fixed functions with same name generator
  3. prototype toString
  4. prototype readAttribute