Client for embedding InterMine widgets (ws_widgets branch only!).
- Google API (included)
- jQuery (included)
- underscore.js (included)
- backbone.js (included)
You can install all the following dependencies by running npm install -d
:
- CoffeeScript & eco templating.
- uglify-js to compress templates.
Create a new Widgets instance in index.html
pointing to a service:
var widgets = new Widgets("http://aragorn.flymine.org:8080/flymine/service/");
Choose which widgets you want to load:
// Load all Widgets:
widgets.all('Gene', 'myList', '#all-widgets');
// Load a specific Chart Widget:
widgets.chart('flyfish', 'myList', '#widget-1');
// Load a specific Enrichment Widget:
widgets.enrichment('pathway_enrichment', 'myList', '#widget-2');
- Start a simple HTTP server using
.webserver.sh
. - Visit http://0.0.0.0:1111/
Run cake compile:main
to compile widgets and templates into one target. Check optional parameters by running cake
.
- Run
cake compile:tests
to compile tests. - Visit http://0.0.0.0:1111/test to run the tests using Mocha and Chai.
The tests are automatically loaded from available tests in the test/src
directory. Libraries needed to run the tests are loaded automatically too. You can speed up their execution by including the files the <head>
section of the test/index.html
file.
Configure the Cakefile
with paths to your own InterMine SVN:
# Path to InterMine SVN output.
INTERMINE =
ROOT: "/home/rs676/svn/ws_widgets"
OUTPUT: "intermine/webapp/main/resources/webapp/js/widget.js"
Execute the release task by running cake --commit "message" release
; this will commit the widget.js
file with your custom message.
Commented source code is in the /docs
directory: http://0.0.0.0:1111/docs/widgets.html.
Will run a PathQuery against a mine and display its results in HTML.
var options = {
selectCb: function(pq) {
window.open(mineURL + "/service/query/results?query=" + encodeURIComponent(pq) + "&format=html");
}
};
widgets.chart('flyfish', 'myList', '#widget', options);
Will open a Report page on a given mine for the match selected.
var options = {
matchCb: function(id, type) {
window.open(mineURL + "/portal.do?class=" + type + "&externalids=" + id);
}
};
widgets.enrichment('pathway_enrichment', 'myList', '#widget', options);
var options = {
"title": false,
"description": false
};
widgets.enrichment('pathway_enrichment', 'myList', '#widget', options);