Monday, June 18, 2012

bui integration

After completing work on libscopes I moved on to bui integration. The task was to make the simulator use bui to draw the boolean network graph. I learnt from Matthias that the bui simulator code would be quite similar to graphviz and there would be no need to rewrite from scratch. That turned out to be true and there are hardly 4-5 lines added in simulator.js to draw the SVG using bui and manipulate the color of the nodes.

The Graph is imported into bui using the graph.importFromJSON, this function is really helpful as all the import code had been written to convert the boolean network formats to jSBGN objects. The importFromJSON directly imports a jSBGN object into the bui graph.

For changing the color of the nodes I obtained the SVG node element by accessing the drawables method of the graph. This gave the list of nodes each of whose SVG group element can be extracted using the nodeGroup method.

Initially I expected the color change code to work out of the box(without modifying any part of the graphviz code), but for some reason it didn't work. After debugging the conclusion was that the setAttribute method wasn't working for 'fill'. So I used element.style.fill instead.

The initial states can also be modified by clicking on the nodes. I've added a start simulation button so that the user can first set the seed and then start the simulation. The code is in the 'bui-devel' branch of the simulator repo.

The bui code isn't entirely function due a missing js layout library. I've asked Falko for including the lib in bui. Once that's done it won't take much time for the simulator to become functional.

Server:

http://goo.gl/X7Xlr

No comments: