Heatmap ================================ InterMine makes use of canvasXpress `heatmap `_ to visualize gene expression data. `CanvasXpress `_ is a javascript library based on the `` tag implemented in HTML5. It is written by Isaac Neuhausi. Hierarchical and k-Means clustering algorithms and zoom in/out functionality have been implemented within the heatmap. An example in modMine ---------------------------------- A specific heatmap application can be referred in `modMine `_. It visualizes fly expression data (`example `_) generated from `modENCODE project `_. The raw data is parsed and converted to InterMine objects. In a Struts controller, the expression data will be fetched by running a InterMine path query and parsed to JSON string. The JSON string will be sent to a JSP page by a http request to feed into heatmap. Expression data source ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `FlyExpressionScoreConverter `_ is a specific data converter for modENCODE fly expression data. The class is located at `bio/sources/modmine/fly-expression-score`. Any other similar expression data conversion tasks can take the data source as a reference. Exprssion data type is an extension of InterMine core model. It is addressed in `modmine/dbmodel/resources/modencode-metadata_additions.xml` .. code-block:: xml # modmine/dbmodel/resources/modencode-metadata_additions.xml A better practice would be to add the model extension to a source specific additions.xml under a source directory. Controller ~~~~~~~~~~~~~~~~~~~ The controller class `HeatMapController `_ is a component of `Struts MVC framework `_. It holds the logic to process user requests, and seletcs a proper wabpage to user. In HeatMapController, a query is run to fetch expression scores from database (ref method `queryExpressionScore`), then the results are parsed to JSON string (ref method `getJSONString`) and set in the request (ref method `findExpression`). Struts config: .. code-block:: xml # modmine/webapp/resources/struts-config-model.xml # modmine/webapp/resources/tiles-defs-model.xml Web page ~~~~~~~~~~~~~~~~~~~ `heatMap.jsp `_ displays heatmap. canvasXpress object takes expression JSON string and other parameters in to create a heatmap (in modMine, we have two separate heatmaps for cell line and developmental stage respectively). jQuery was used to adjust page layout. Further development ---------------------------------- A modern way of creating widget like heatmap would be using InterMine webservices framework to query and generate JSON strings and embed heatmap on any web page. To `learn more... `_ An alternative library would be `D3.js `_, an example of heatmap can be found `here `_. In `ThaleMine `_ there is a D3 implementation (see any gene list report page, for example `here `_, `code `_. However canvasXpress is particular designed to display genomics data, D3 is for a broader use.