Commit 8921b509 authored by Marek Ostaszewski's avatar Marek Ostaszewski
Browse files

Merge branch 'minerva-v14' into 'master'

Minerva v14

See merge request !5
parents 887804e9 cccd46cb
Pipeline #13095 passed with stages
in 2 minutes and 2 seconds
......@@ -30,3 +30,4 @@ deploy:
- echo "put dist/plugin.js plugins-www/gsea/"|sftp -P 8022 gitlab-ci@
# Minerva GSEA plugin
# Minerva plugin creation with starter-kit
A plugin allowing to calculate the gene set enrichment based on the data overlays highlighted by the user.
......@@ -16,6 +16,8 @@ The starter-kit example uses NPM (node package manager) and Browserify (and few
* Download and install [NPM]( if it is not yet installed on your system (try running `npm` from command line to find out)
* run `npm install` (this will create the *node_modules* directory with the required NPM modules)
* run `npm run build` to build the plugin which will be available in the *dist* directory
* run `npm run build-debug` if you want to obtained non-minified version of the compiled plugin, which can be used for
debugging the plugin in, e.g., Google Chrome DevTools
* publish the resulting *plugin.js* file somewhere where it can be accessed by Minerva (please beware that if the instance is running on HTTPS, the plugin must be also accessible through HTTPS)
For the development process you might want to have your local instance of Minerva running, so that you do not have to publish the plugin file every time you do a change. However, if you do not have a local Minerva instance, you can use command line to commit and push your plugin to, e.g., GitHub and provide Minerva address of the raw file. So for example if your GitHub repository with the plugin is []( you can run
......@@ -54,6 +56,18 @@ All the interaction with Minerva should happen through the minerva proxy object
* beware that most of these functions are asynchronous so they actually return a promise not the actual objects
* map: functions to interact with the visual aspect of the map, mainly `showBioEntity` (highlights a bioentity), `hideBioEntity`, `fitBounds` (zooms to provided coordinates) and `addListener` (enables listening to events such as selection of entities) - see examples of using these functions in the starter-kit and the Minerva's [JavaScript API documntation](
An example of interaction with Minerva (see the `index.html` for more examples):
let be = bes[0];
//the following line is valid only if the first bioineity is of type ALIAS and not REACTION{id:be.getId(), modelId:bw.getModelId(), type:'ALIAS'}).then( function(be1) {
Some of the functions are also described in the [JavaScript API documntation](
###### ServerConnector object
......@@ -62,8 +76,4 @@ Minerva also exposes variable called `ServerConnector` to the global scope (ther
###### Minerva's API
It can happen that there exists a (mainly data-related) functionality which is not available in the proxy object but is available through [Minerva's REST API]( In such case you can use Ajax to retrieve the data (the easiest way is probably to use jQuery's [getJSON]( function).
It can happen that there exists a (mainly data-related) functionality which is not available in the proxy object but is available through [Minerva's REST API]( In such case you can use Ajax to retrieve the data (the easiest way is probably to use jQuery's [getJSON]( function).
\ No newline at end of file
......@@ -3,8 +3,6 @@ require('../css/styles.css');
const pluginName = 'GSEA';
const pluginVersion = '0.9.0';
const minervaProxyServer = '';
const globals = {
models: {},
selected: [],
......@@ -23,6 +21,12 @@ const globals = {
let minervaProxy;
let pluginContainer;
let pluginContainerId;
let minervaVersion;
let $ = window.$;
if ($ === undefined) {
$ = minerva.$;
const register = function (_minerva) {
......@@ -46,12 +50,14 @@ const register = function (_minerva) { => globals.models[m.modelId] = m);
const container = initMainContainer();
return minerva.ServerConnector.getConfiguration().then( function(conf) {
minervaVersion = parseFloat(conf.getVersion().split('.').slice(0, 2).join('.'));
const container = initMainContainer();
const unregister = function () {
......@@ -117,8 +123,8 @@ function initMainContainer(){
<div class="modal-content"></div>
<div class="panel panel-default gsea-pw-loading">
<div class="panel-body">
<div class="panel card panel-default gsea-pw-loading">
<div class="panel-body card-body">
<i class="fa fa-circle-o-notch fa-spin"></i> Obtaining pathway-gene mapping from the map
......@@ -131,9 +137,9 @@ function initMainPageStructure() {
const container = $('<div class="' + pluginName + '-container"></div>').appendTo(pluginContainer);
<div class="panel panel-primary panel-events">
<div class="panel-heading">Gene Set Enrichment Analysis</div>
<div class="panel-body gsea-main-panel">
<div class="panel card panel-primary border-primary panel-events">
<div class="panel-heading card-header bg-primary text-light">Gene Set Enrichment Analysis</div>
<div class="panel-body card-body gsea-main-panel">
<div class="gsea-buttons">
<div class="row">
<div class="col-sm-9">
......@@ -149,12 +155,12 @@ function initMainPageStructure() {
<div class="panel panel-info gsea-instructions">
<div class="panel-heading" data-toggle="collapse" data-target="#instructions_panel_${pluginContainerId}">
<div class="panel card panel-info border-info gsea-instructions">
<div class="panel-heading card-header bg-info text-light" data-toggle="collapse" data-target="#instructions_panel_${pluginContainerId}">
<span class="pull-right glyphicon glyphicon-chevron-down">
<span class="pull-right fa fa-chevron-down">
<div id="instructions_panel_${pluginContainerId}" class="panel-body panel-default panel-collapse collapse">
<div id="instructions_panel_${pluginContainerId}" class="panel-body card-body panel-default panel-collapse collapse">
This is a basic Gene Set Enrichment plugin. It calculates enrichment of elements from selected overlay(s) in the pathways of the map (grey areas).<br><br>
<u>Show enriched pathways</u> button calculates the enrichment scores (Bonferroni-adjusted p-value), lists the significantly enriched pathways in the window "Gene Set Enrichment Analysis" window, and highlights them.<br><br>
<u>Reset</u> button removes the results and the enrichment.<br><br>
......@@ -257,6 +263,11 @@ function calculateGSEA() {
}).then(function (overlays) {
if (overlays.length == 0) {
alert("No overlay selected");
let ovHgncNames = new Set();
overlays.forEach(e => {
// e is a LayoutAlias, needs to be mapped back to map aliases, to retrieve HGNC; defined as set, .has() function looks better in filtering
......@@ -330,12 +341,19 @@ function calculateGSEA() {
let mapName = globals.models[modelId].name;
if (!mapName) mapName = "Main map";
let panelTitle;
if (minervaVersion < 14) {
panelTitle = `<h3 class="panel-title">${mapName}</h3>`;
} else {
panelTitle = `<span class="panel-title">${mapName}</span>`;
const $mapResultsPanel = $(`
<div class="panel panel-primary gsea-pw-results-panel">
<div class="panel-heading map-results">
<h3 class="panel-title">${mapName}</h3>
<div class="panel card panel-primary border-primary gsea-pw-results-panel">
<div class="panel-heading card-header bg-primary text-light map-results">
<div class="panel-body">
<div class="panel-body card-body">
<table class="gsea-results-table">
<tr><th class="first-column" title="Bonferroni-adjusted p-value ">p-val (adj)</th><th>Enriched area</th>
......@@ -541,8 +559,8 @@ function openModal(params) {
modalContent.attr("class", modalContentClass);
if ("header" in params) {
let header = pluginContainer.find('<div class="modal-header panel-heading"></div>').appendTo(modalContent);
header.append('<button type="button" class="close">&times;</button>');
header.append('<h4>' + params.header + '</h4>');
header.append('<button type="button" class="close">&times;</button>');
if ("body" in params) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment