Commit d00c4bbc authored by David Hoksza's avatar David Hoksza
Browse files

upgraded to work with minerva v14

parent 887804e9
Pipeline #12991 passed with stage
in 51 seconds
......@@ -3,8 +3,6 @@ require('../css/styles.css');
const pluginName = 'GSEA';
const pluginVersion = '0.9.0';
const minervaProxyServer = 'https://minerva-dev.lcsb.uni.lu/minerva-proxy/';
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) {
minervaProxy.project.data.getModels().forEach(m => globals.models[m.modelId] = m);
const container = initMainContainer();
calculatePathways().then(function(){
container.find('.gsea-pw-loading').hide();
initMainPageStructure(container);
return minerva.ServerConnector.getConfiguration().then( function(conf) {
minervaVersion = parseFloat(conf.getVersion().split('.').slice(0, 2).join('.'));
const container = initMainContainer();
calculatePathways().then(function(){
container.find('.gsea-pw-loading').hide();
initMainPageStructure(container);
});
});
};
const unregister = function () {
......@@ -117,8 +123,8 @@ function initMainContainer(){
<div class="modal-content"></div>
</div>
</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
</div>
</div>`);
......@@ -131,9 +137,9 @@ function initMainPageStructure() {
const container = $('<div class="' + pluginName + '-container"></div>').appendTo(pluginContainer);
container.append(`
<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>
</div>
<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}">
Instructions
<span class="pull-right glyphicon glyphicon-chevron-down">
<span class="pull-right fa fa-chevron-down">
</div>
<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() {
return minervaProxy.project.map.getVisibleDataOverlays()
}).then(function (overlays) {
if (overlays.length == 0) {
alert("No overlay selected");
return;
}
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">
${panelTitle}
</div>
<div class="panel-body">
<div class="panel-body card-body">
<table class="gsea-results-table">
<thead>
<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