The goal of my project is to build interactive visualization, and still allows fast prototyping, customizability, and integration to other SciRuby components. I think we can complete this goal with the client-server model shown below: server provides JSON data throgh REST API, and client get it with Ajax and generate plots based on it. Server-side gem will be build with SciRuby components like NMatrix, and client-side will use D3.js for plotting. This model is inspired by Prof. Karl Broman's work. (http://www.biostat.wisc.edu/~kbroman/D3/)
- This gem is tentatively named SciPlot.
- SciPlot provides low level API for plotting like 'line,' 'rect,' and 'dot.'
- This can generate plots that imports data from Ajax data source. D3.js already has asynchronous loading API like d3.json, and we can add this feature easier.
- We will create 3 new gems for plotting - Plotting for general use, Biology, and 3D plotting.
- 3D plotting library will not depend on SciPlot because it do not use 2D API. I will implement it only for practice of Ajax loading and implementation of Ruby wrapper for JavaScript.
- 10 charts for SciPlot STL (general use charts)
- Scatter
- Bar
- Box
- Line
- and 6 more
- BioPlot
- HeatMap
- Network
- Matrix
- and more
- 3D Plots
- see here
require 'sciplot'
scatter = SciPlot::Scatter.new([1,2,3])
scatter.show() #-> show charts on IRuby notebook
require 'bioplot'
genomemap = BioPlot::GenomeMap.new(some_data) # internally using SciPlot's DSL
genomemap.show() #-> IRuby
- SciRuby-Server consists of 4 parts, Server, REST API, Web interface and DataBase.
- We can deploy it into www server, or publish to closed network, or use in local environment.
- SciRuby::Dataframe internally use REST API and push or pull data through it.
- Users need not to be aware of where they store their data.
- I will implement it with Sinatra and non-SQL Database. I will also use Thin for testing server in local environment.
require 'sciruby'
require 'sciplot'
db = SciRuby::DataFrame.new(column = some_data, ...)
db.connect(url) # do configuration when connecting to SciRuby-Server on Web.
SciPlot::Scatter.new(db) # generates plots from web source.
- After publishing SciRuby-Server, you can also update data through REST API, using Dataframe of other wrapper.
- REST-API also enables us to automatically update data. (like sensor and another server)
- Some plots generated with our Client-side gem dinamically import data from SciRuby-Server.
- implementation of client-side libraries (2-3 weeks)
- First I will implement general plots for SciPlot STL, and implement reusable API based on that work.
- implementation of wrapper gems for JS library (at the same time as previous step)
- implementation of more advanced library ( 1-2 weeks)
- BioPlot and 3D plot.
- implementation of SciRuby-Server and SciRuby::Dataframe (2 weeks)
- experimental implementation of SciRuby DB based on Dataframe (1 week)
- Thin + Sinatra App + some DB