#5 GSoC’18 – Plot support in SBSCL

This week I implemented a simple interface for output data-plotting. SBSCL has historically been a command-line only library and therefore it never had any data-plot feature.

To implement plot support, I used existing Java library JFreeChart. As of now, there is an extra class PlotMultiTable that takes in a MultiTable data structure as input and plots all the columns of MultiTable. MultiTable is custom AbstractTableModel like data structure which is used in SBSCL to store and transport information.

To plot output generated from your biological model simply write the following:

 // plot all the reactions species
 PlotMultiTable p = new PlotMultiTable(solution, "Output plot");
 p.pack();
 RefineryUtilities.centerFrameOnScreen(p);
 p.setVisible( true );

PlotMultiTable class takes a MultiTable as input and generates an output plot with the title “Output plot”. If you are interested in plotting a subset of all the species then you can filter MultiTable before passing it to PlotMultiTable.

 // plot all the reactions species
 PlotMultiTable p = new PlotMultiTable(solution.getBlock(1), "Output plot");
 p.pack();
 RefineryUtilities.centerFrameOnScreen(p);
 p.setVisible( true );

This code will only plot the second column from the MultiTable.

You can also filter which timepoints to display by applying this filter:

solution.filter(new double[]{t1, t2, ... tN})

Let me know if you have any questions.

Advertisements

One thought on “#5 GSoC’18 – Plot support in SBSCL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s