Monday, July 28, 2014

Synchronizing CellDesigner and JSBML, Contact with Akira and Checklist

Just a quick update since it is late here, but over the past week, I have been continuing with my synchronization of the JSBML/CellDesigner(CD) model representations. I have added a Map<PluginSBase, Set<SBase>>. The key is the CD object and all JSBML objects associated with the CD object.

Since establishing contact with the main developer of CellDesigner (Dr. Akira Funahashi), I have sent him an email detailing some questions I had regarding CellDesigner.

My questions to him:

1.  Is there is an accurate way to determine the reaction direction, be it North-South, East-West, etc? This answer will be very useful in determining the position of the Reaction text element, as it is calculated dynamically behind the scenes in CellDesigner.

2.According to the image below, when the CD user moves only a Reaction, nothing happens. One has to move a Species to send a Reaction SBaseChange event. This is unexpected and I would like some clarification on this if possible.

3. Some CellDesigner model files force CellDesigner to send SBaseChanged events every time one part of the model is changed. This is odd behavior, as if the whole model is changed when one small part is changed. It is even more odd considering as other models only send SBaseChanged events for PluginSBases that are edited by the user rather than an event for every PluginSBase in the model. 

Current checklist for myself:

1. Add Render information
2. setCharge()/ FBC. 
3. add reactiontext info, fix bugs
4. find species reference sbases in CellDesigner

Friday, July 18, 2014

Aftermath of 17/7 Meeting

I presented the slideshow below to Professor Funahashi (Akira), the main developer of CellDesigner, and my mentors at 15:00 UTC on 17/7/2014.

The presentation was a success because Akira was able to provide me with inside information and clarity to my work with CellDesigner. I asked questions at the end of the presentation which I will share answers with now:

Reaction text is calculated dynamically and hopefully, the algorithm will be provided to the team so we can also calculate reaction text in an identical way in JSBML. 

PluginModel objects are not constant. As such, using PluginModels as a key in a Hashmap is impossible. Therefore, we need to remove our HashMap in AbstractCellDesignerPlugin and simply convert one model at a time.

I am pleased by the progress at this meeting and have high morale. I expect a lot of progress in the next few days. 

Saturday, July 12, 2014

CellDesigner Reaction positioning and CellDesigner/JSBML synchronization

Over the past week, I have been working on two separate topics:

1. Complete algorithm that use the CellDesigner Plugin API to calculate positioning for ReactionGlyphs and SpeciesReferenceGlyphs.
2. Establish way to synchronize CellDesigner's plugin datastructure and JSBML (so that CellDesigner models will be immediately and accurately represented in JSBML)

The first point has been completed. ReactionGlyphs and SpeciesReferenceGlyph positioning has been accurately implemented. I still have loose ends to tie up, but I am proud that my algorithms do the "right thing" in a variety of situations.

On the second point, I have created a plugin that receives events from CellDesigner and displays them in a console. As you can see, when the position of a species or reaction changes, CellDesigner informs the console.

The next step is to update the currently selected model in JSBML automatically when it is edited by the user.

I did run into problems in the plugin implementation and I had a few small hang-ups in regards to getting consistent reaction coordinates, but things are progressing very well :)


Wednesday, July 2, 2014

Calculating ReactionGlyph position in CellDesigner and new Plugin

CellDesigner does not make its Reaction position data available for developers to access. Therefore, we need to figure out how to determine Reaction size and position using our own algorithms.

We have two choices:

1. Create a BoundingBox with x,y, height and width. 
2. Create a Curve for both the ReactionGlyph and the SpeciesReferenceGlyphs. 
     -ReactionGlyph curve segment will be in the middle of the Reaction.
     -SpeciesReferenceGlyph curve segments will be coming off the center curve segment and pointing to SpeciesGlyphs, be it product, reactant, or modifier. 

The image above shows the difference between a ReactionGlyph and a SpeciesReferenceGlyph. The ReactionGlyph is the entire Reaction shape, while there are three SpeciesReferenceGlyphs which are separated by the small black circle, each leading to a SpeciesGlyph.

Reaction position would be trivial if all reactions looked like the one above. However, reactions that make up a CellDesigner model can come in any and all orientations and positions, like the image below.

As one can see, reactants, products, and modifiers are in all orientations respective to one another, which makes it very difficult to produce accurate position measurements. I have been working on this problem for a few days and still working on it.

While doing this, I have also started on writing a plugin that prints out CellDesigner information(PropertyChangeEvents). This also does not work as of now. However, I have my weekly group meeting tomorrow at 15:00 UTC which will hopefully put me on the right track regarding these issues.