From fac4cabb7a88d1db1858986a553a6d0ce1fed3c7 Mon Sep 17 00:00:00 2001 From: Sascha Herzinger Date: Wed, 27 Apr 2016 10:39:07 +0200 Subject: [PATCH 01/11] eye candy for correlation workflow --- grails-app/views/layouts/_correlation.gsp | 46 +++++++++++-------- .../_angular/controllers/correlation.js | 44 +++++++++++++++--- .../smartR/_angular/templates/conceptBox.html | 2 +- 3 files changed, 66 insertions(+), 26 deletions(-) diff --git a/grails-app/views/layouts/_correlation.gsp b/grails-app/views/layouts/_correlation.gsp index 13b7cbe..12fb676 100644 --- a/grails-app/views/layouts/_correlation.gsp +++ b/grails-app/views/layouts/_correlation.gsp @@ -5,9 +5,9 @@ - +

- +
- - - + +
+

Correlation computation method:

+
+ + + +
+


+ arguments-to-use="runAnalysis.params" + running="runAnalysis.running">

- +
diff --git a/web-app/js/smartR/_angular/controllers/correlation.js b/web-app/js/smartR/_angular/controllers/correlation.js index 6fa7753..8658a56 100644 --- a/web-app/js/smartR/_angular/controllers/correlation.js +++ b/web-app/js/smartR/_angular/controllers/correlation.js @@ -1,16 +1,46 @@ +//# sourceURL=correlation.js + +'use strict'; window.smartRApp.controller('CorrelationController', ['$scope', 'smartRUtils', 'commonWorkflowService', function($scope, smartRUtils, commonWorkflowService) { commonWorkflowService.initializeWorkflow('correlation', $scope); - // model - $scope.conceptBoxes = { - datapoints: [], - annotations: [] + $scope.fetch = { + disabled: false, + running: false, + loaded: false, + conceptBoxes: { + datapoints: [], + annotations: [] + } }; - $scope.scriptResults = {}; - $scope.params = { - method: 'pearson' + + $scope.runAnalysis = { + disabled: true, + running: false, + scriptResults: {}, + params: { + method: 'pearson' + } }; + + $scope.$watchGroup(['fetch.running', 'runAnalysis.running'], + function(newValues) { + var fetchRunning = newValues[0], + runAnalysisRunning = newValues[1]; + + // clear old results + if (fetchRunning) { + $scope.runAnalysis.scriptResults = {}; + } + + // disable tabs when certain criteria are not met + $scope.fetch.disabled = runAnalysisRunning; + $scope.runAnalysis.disabled = fetchRunning || !$scope.fetch.loaded; + } + ); + }]); + diff --git a/web-app/js/smartR/_angular/templates/conceptBox.html b/web-app/js/smartR/_angular/templates/conceptBox.html index c3c8165..38bb585 100644 --- a/web-app/js/smartR/_angular/templates/conceptBox.html +++ b/web-app/js/smartR/_angular/templates/conceptBox.html @@ -1,5 +1,5 @@
- +

Drag at least {{min}} node(s) into the box
Select at most {{max}} node(s)
From 657894dc5deaaff7ed24b5e623e97f7015d78b14 Mon Sep 17 00:00:00 2001 From: Sascha Herzinger Date: Wed, 27 Apr 2016 11:08:19 +0200 Subject: [PATCH 02/11] eye candy for boxplot workflow --- grails-app/views/layouts/_boxplot.gsp | 22 ++++++----- .../js/smartR/_angular/controllers/boxplot.js | 37 ++++++++++++++++--- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/grails-app/views/layouts/_boxplot.gsp b/grails-app/views/layouts/_boxplot.gsp index 9d2b110..02cfa9a 100644 --- a/grails-app/views/layouts/_boxplot.gsp +++ b/grails-app/views/layouts/_boxplot.gsp @@ -5,9 +5,9 @@ - + --}%

- + +
- +

+ arguments-to-use="runAnalysis.params" + running="runAnalysis.running">

- +
diff --git a/web-app/js/smartR/_angular/controllers/boxplot.js b/web-app/js/smartR/_angular/controllers/boxplot.js index 608646d..1fb7fc1 100644 --- a/web-app/js/smartR/_angular/controllers/boxplot.js +++ b/web-app/js/smartR/_angular/controllers/boxplot.js @@ -9,12 +9,37 @@ window.smartRApp.controller('BoxplotController', [ commonWorkflowService.initializeWorkflow('boxplot', $scope); - // model - $scope.conceptBoxes = { - datapoints: [] + $scope.fetch = { + running: false, + disabled: false, + loaded: false, + conceptBoxes: { + datapoints: [] + } }; - $scope.scriptResults = {}; - $scope.params = {}; - }]); + $scope.runAnalysis = { + running: false, + disabled: true, + scriptResults: {}, + params: {} + }; + + $scope.$watchGroup(['fetch.running', 'runAnalysis.running'], + function(newValues) { + var fetchRunning = newValues[0], + runAnalysisRunning = newValues[1]; + + // clear old results + if (fetchRunning) { + $scope.runAnalysis.scriptResults = {}; + } + + // disable tabs when certain criteria are not met + $scope.fetch.disabled = runAnalysisRunning; + $scope.runAnalysis.disabled = fetchRunning || !$scope.fetch.loaded; + } + ); + + }]); From bf52da5383b056425ffc6ca8527c5183baa24498 Mon Sep 17 00:00:00 2001 From: Sascha Herzinger Date: Wed, 27 Apr 2016 11:10:09 +0200 Subject: [PATCH 03/11] handy function to detect main frame scrolling --- web-app/js/smartR/_angular/services/smartRUtils.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web-app/js/smartR/_angular/services/smartRUtils.js b/web-app/js/smartR/_angular/services/smartRUtils.js index 61f1d53..df61967 100644 --- a/web-app/js/smartR/_angular/services/smartRUtils.js +++ b/web-app/js/smartR/_angular/services/smartRUtils.js @@ -49,6 +49,17 @@ window.smartRApp.factory('smartRUtils', ['$q', function($q) { }).max(); }; + /** + * Executes callback with scroll position when SmartR mainframe is scrolled + * @param function + */ + service.callOnScroll = function(callback) { + $('#sr-index').parent().scroll(function() { + var scrollPos = $(this).scrollTop(); + callback(scrollPos); + }); + }; + service.countCohorts = function() { return !window.isSubsetEmpty(1) + !window.isSubsetEmpty(2); }; From 460674a1f91e52de090b36740e06e8b3e3e17579 Mon Sep 17 00:00:00 2001 From: Sascha Herzinger Date: Wed, 27 Apr 2016 11:24:02 +0200 Subject: [PATCH 04/11] make jshint happy --- .../js/smartR/_angular/directives/capturePlotButton.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web-app/js/smartR/_angular/directives/capturePlotButton.js b/web-app/js/smartR/_angular/directives/capturePlotButton.js index 081c174..dffc63e 100644 --- a/web-app/js/smartR/_angular/directives/capturePlotButton.js +++ b/web-app/js/smartR/_angular/directives/capturePlotButton.js @@ -1,5 +1,7 @@ //# sourceURL=capturePlotButton.js +'use strict'; + window.smartRApp.directive('capturePlotButton', [function() { // aux for downloadSVG @@ -35,10 +37,10 @@ window.smartRApp.directive('capturePlotButton', [function() { var effectiveStyle = computedStyle.getPropertyValue(property); var defaultStyle = getDefaultsForElement(jqElem).getPropertyValue(property); - if (effectiveStyle != defaultStyle) { + if (effectiveStyle !== defaultStyle) { jqElem.attr(property, effectiveStyle); } - }) + }); }); scratchSvg.remove(); @@ -88,7 +90,7 @@ window.smartRApp.directive('capturePlotButton', [function() { scope.capture = function() { var svgElement = jQuery('svg.visualization')[0]; downloadSVG(svgElement, scope.filename); - } + }; } }; From 9d59560cf3ae40b7ac584e6d435929115c3b0036 Mon Sep 17 00:00:00 2001 From: Sascha Herzinger Date: Wed, 27 Apr 2016 11:32:13 +0200 Subject: [PATCH 05/11] correlation method correctly selected now --- grails-app/views/layouts/_correlation.gsp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/grails-app/views/layouts/_correlation.gsp b/grails-app/views/layouts/_correlation.gsp index 12fb676..c9f7a02 100644 --- a/grails-app/views/layouts/_correlation.gsp +++ b/grails-app/views/layouts/_correlation.gsp @@ -35,16 +35,13 @@

Correlation computation method:

From 6222a0a50926f4df12637188b0d6dfc63dbe153e Mon Sep 17 00:00:00 2001 From: Sascha Herzinger Date: Wed, 27 Apr 2016 14:05:24 +0200 Subject: [PATCH 06/11] make jshint happy --- web-app/js/smartR/_angular/directives/conceptBox.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web-app/js/smartR/_angular/directives/conceptBox.js b/web-app/js/smartR/_angular/directives/conceptBox.js index c169b7b..bce052d 100644 --- a/web-app/js/smartR/_angular/directives/conceptBox.js +++ b/web-app/js/smartR/_angular/directives/conceptBox.js @@ -25,7 +25,7 @@ window.smartRApp.directive('conceptBox', ['$rootScope', function($rootScope) { $(template_tooltip).tooltip({track: true, tooltipClass:"sr-ui-tooltip"}); var _clearWindow = function() { - $(template_box).children().remove() + $(template_box).children().remove(); }; var _getConcepts = function() { @@ -37,7 +37,7 @@ window.smartRApp.directive('conceptBox', ['$rootScope', function($rootScope) { var _activateDragAndDrop = function() { var extObj = Ext.get(template_box); var dtgI = new Ext.dd.DropTarget(extObj, {ddGroup: 'makeQuery'}); - dtgI.notifyDrop = dropOntoCategorySelection; + dtgI.notifyDrop = dropOntoCategorySelection; // jshint ignore:line }; var typeMap = { @@ -71,10 +71,10 @@ window.smartRApp.directive('conceptBox', ['$rootScope', function($rootScope) { scope.validate = function() { scope.instructionMinNodes = scope.conceptGroup.length < scope.min; - scope.instructionMaxNodes = ~scope.max && scope.conceptGroup.length > scope.max; + scope.instructionMaxNodes = scope.max !== -1 && scope.conceptGroup.length > scope.max; scope.instructionNodeType = !_containsOnly(); return !(scope.instructionMinNodes || scope.instructionMaxNodes || scope.instructionNodeType); - } + }; } }; }]); From f2a53033437e68e8051d5b843d617b5fe630b821 Mon Sep 17 00:00:00 2001 From: Sascha Herzinger Date: Wed, 27 Apr 2016 14:21:48 +0200 Subject: [PATCH 07/11] make sure that max and min are not strings --- web-app/js/smartR/_angular/directives/conceptBox.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web-app/js/smartR/_angular/directives/conceptBox.js b/web-app/js/smartR/_angular/directives/conceptBox.js index bce052d..e863406 100644 --- a/web-app/js/smartR/_angular/directives/conceptBox.js +++ b/web-app/js/smartR/_angular/directives/conceptBox.js @@ -16,6 +16,8 @@ window.smartRApp.directive('conceptBox', ['$rootScope', function($rootScope) { }, templateUrl: $rootScope.smartRPath + '/js/smartR/_angular/templates/conceptBox.html', link: function(scope, element) { + var max = parseInt(scope.max); + var min = parseInt(scope.min); var template_box = element[0].querySelector('.sr-drop-input'), template_btn = element[0].querySelector('.sr-drop-btn'), @@ -70,8 +72,8 @@ window.smartRApp.directive('conceptBox', ['$rootScope', function($rootScope) { scope.$watch('conceptGroup', scope.validate); scope.validate = function() { - scope.instructionMinNodes = scope.conceptGroup.length < scope.min; - scope.instructionMaxNodes = scope.max !== -1 && scope.conceptGroup.length > scope.max; + scope.instructionMinNodes = scope.conceptGroup.length < min; + scope.instructionMaxNodes = max !== -1 && scope.conceptGroup.length > max; scope.instructionNodeType = !_containsOnly(); return !(scope.instructionMinNodes || scope.instructionMaxNodes || scope.instructionNodeType); }; From 6f198b4906273106b0cf5152b12dd3417fff8833 Mon Sep 17 00:00:00 2001 From: Sascha Herzinger Date: Wed, 27 Apr 2016 15:19:40 +0200 Subject: [PATCH 08/11] Fetch is aborted when invalid input --- web-app/js/smartR/_angular/controllers/boxplot.js | 2 +- web-app/js/smartR/_angular/controllers/correlation.js | 5 +++-- web-app/js/smartR/_angular/controllers/heatmap.js | 6 +++--- web-app/js/smartR/_angular/directives/conceptBox.js | 10 ++++++---- web-app/js/smartR/_angular/directives/fetchButton.js | 7 +++++++ web-app/js/smartR/_angular/services/smartRUtils.js | 4 ++-- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/web-app/js/smartR/_angular/controllers/boxplot.js b/web-app/js/smartR/_angular/controllers/boxplot.js index 1fb7fc1..0bc72fb 100644 --- a/web-app/js/smartR/_angular/controllers/boxplot.js +++ b/web-app/js/smartR/_angular/controllers/boxplot.js @@ -14,7 +14,7 @@ window.smartRApp.controller('BoxplotController', [ disabled: false, loaded: false, conceptBoxes: { - datapoints: [] + datapoints: {concepts: [], valid: false} } }; diff --git a/web-app/js/smartR/_angular/controllers/correlation.js b/web-app/js/smartR/_angular/controllers/correlation.js index 8658a56..9173c08 100644 --- a/web-app/js/smartR/_angular/controllers/correlation.js +++ b/web-app/js/smartR/_angular/controllers/correlation.js @@ -8,12 +8,13 @@ window.smartRApp.controller('CorrelationController', commonWorkflowService.initializeWorkflow('correlation', $scope); $scope.fetch = { + valid: false, disabled: false, running: false, loaded: false, conceptBoxes: { - datapoints: [], - annotations: [] + datapoints: {concepts: [], valid: false}, + annotations: {concepts: [], valid: true} } }; diff --git a/web-app/js/smartR/_angular/controllers/heatmap.js b/web-app/js/smartR/_angular/controllers/heatmap.js index a31ffcd..85ae9d4 100644 --- a/web-app/js/smartR/_angular/controllers/heatmap.js +++ b/web-app/js/smartR/_angular/controllers/heatmap.js @@ -17,9 +17,9 @@ window.smartRApp.controller('HeatmapController', [ running: false, loaded: false, conceptBoxes: { - highDimensional: [], - numerical: [], - categorical: [] + highDimensional: {concepts: [], valid: false}, + numerical: {concepts: [], valid: true}, + categorical: {concepts: [], valid: true} }, selectedBiomarkers: [], scriptResults: {} diff --git a/web-app/js/smartR/_angular/directives/conceptBox.js b/web-app/js/smartR/_angular/directives/conceptBox.js index e863406..3062294 100644 --- a/web-app/js/smartR/_angular/directives/conceptBox.js +++ b/web-app/js/smartR/_angular/directives/conceptBox.js @@ -65,17 +65,19 @@ window.smartRApp.directive('conceptBox', ['$rootScope', function($rootScope) { // this watches the childNodes of the conceptBox and updates the model on change new MutationObserver(function() { - scope.conceptGroup = _getConcepts(); // update the model + scope.conceptGroup.concepts = _getConcepts(); // update the model scope.$apply(); }).observe(template_box, { childList: true }); scope.$watch('conceptGroup', scope.validate); scope.validate = function() { - scope.instructionMinNodes = scope.conceptGroup.length < min; - scope.instructionMaxNodes = max !== -1 && scope.conceptGroup.length > max; + scope.instructionMinNodes = scope.conceptGroup.concepts.length < min; + scope.instructionMaxNodes = max !== -1 && scope.conceptGroup.concepts.length > max; scope.instructionNodeType = !_containsOnly(); - return !(scope.instructionMinNodes || scope.instructionMaxNodes || scope.instructionNodeType); + var valid = !(scope.instructionMinNodes || scope.instructionMaxNodes || scope.instructionNodeType); + scope.conceptGroup.valid = valid; + return valid; }; } }; diff --git a/web-app/js/smartR/_angular/directives/fetchButton.js b/web-app/js/smartR/_angular/directives/fetchButton.js index fdaeb6c..f7dc173 100644 --- a/web-app/js/smartR/_angular/directives/fetchButton.js +++ b/web-app/js/smartR/_angular/directives/fetchButton.js @@ -91,6 +91,13 @@ window.smartRApp.directive('fetchButton', [ return; } + for (var conceptGroup in scope.conceptMap) { + if (scope.conceptMap.hasOwnProperty(conceptGroup) && !scope.conceptMap[conceptGroup].valid) { + _onFailure('Your data do not match the requirements! All fields must be green.'); + return; + } + } + var conceptKeys = smartRUtils.conceptBoxMapToConceptKeys(scope.conceptMap); if ($.isEmptyObject(conceptKeys)) { _onFailure('No concepts selected!'); diff --git a/web-app/js/smartR/_angular/services/smartRUtils.js b/web-app/js/smartR/_angular/services/smartRUtils.js index df61967..97a8bbd 100644 --- a/web-app/js/smartR/_angular/services/smartRUtils.js +++ b/web-app/js/smartR/_angular/services/smartRUtils.js @@ -9,7 +9,7 @@ window.smartRApp.factory('smartRUtils', ['$q', function($q) { service.conceptBoxMapToConceptKeys = function smartRUtils_conceptBoxMapToConceptKeys(conceptBoxMap) { var allConcepts = {}; Object.keys(conceptBoxMap).forEach(function(group) { - var concepts = conceptBoxMap[group]; + var concepts = conceptBoxMap[group].concepts; concepts.forEach(function(concept, idx) { allConcepts[group + '_' + 'n' + idx] = concept; }); @@ -54,7 +54,7 @@ window.smartRApp.factory('smartRUtils', ['$q', function($q) { * @param function */ service.callOnScroll = function(callback) { - $('#sr-index').parent().scroll(function() { + $('#sr-index').parent().scroll(function() { var scrollPos = $(this).scrollTop(); callback(scrollPos); }); From ac173eb8f9713355c4fae33953b509dbbb84f99a Mon Sep 17 00:00:00 2001 From: Sascha Herzinger Date: Wed, 27 Apr 2016 15:50:25 +0200 Subject: [PATCH 09/11] get tests green + new test --- .../javascript/fetchButtonDirectiveTests.js | 17 ++++++++++++----- test/unit/javascript/smartRUtilsServiceTests.js | 6 +++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/test/unit/javascript/fetchButtonDirectiveTests.js b/test/unit/javascript/fetchButtonDirectiveTests.js index 3650baa..cd132a8 100644 --- a/test/unit/javascript/fetchButtonDirectiveTests.js +++ b/test/unit/javascript/fetchButtonDirectiveTests.js @@ -70,7 +70,7 @@ describe('fetchButton', function() { }); it('should show another text after data is loaded if showSummaryStats is enabled', function() { - _prepareScope(1, true, {foo: ['concept']}); + _prepareScope(1, true, {foo: {concepts: ['concept'], valid: true}}); try { // we just want to see if the progress message is there _clickButton('resolve()'); } catch (e) {} @@ -82,7 +82,7 @@ describe('fetchButton', function() { }); it('should have the correct scope when successful without showSummaryStats', function() { - _prepareScope(2, false, {foo: ['concept']}); + _prepareScope(2, false, {foo: {concepts: ['concept'], valid: true}}); _clickButton('resolve()'); expect(element.find('span').text()).toBe('Task complete! Go to the "Preprocess" or "Run Analysis" tab to continue.'); expect(element.isolateScope().running).toBe(false); @@ -92,7 +92,7 @@ describe('fetchButton', function() { }); it('should have the correct scope when successful with showSummaryStats', function() { - _prepareScope(1, true, {foo: ['concept']}); + _prepareScope(1, true, {foo: {concepts: ['concept'], valid: true}}); _clickButton('resolve()', 'resolve({result: {allSamples: 1337, subsets: null}})'); expect(element.find('span').text()).toBe('Task complete! Go to the "Preprocess" or "Run Analysis" tab to continue.'); expect(element.isolateScope().running).toBe(false); @@ -102,14 +102,21 @@ describe('fetchButton', function() { }); it('should show error due to missing cohorts', function() { - _prepareScope(0, false, {foo: ['concept']}); + _prepareScope(0, false, {foo: {concepts: ['concept'], valid: true}}); _clickButton(); expect(element.find('span').text()).toBe('Error: No cohorts selected!'); }); it('should show error due to missing concepts', function() { - _prepareScope(1, false, {}); + _prepareScope(1, false, {foo: {concepts: [], valid: true}}); _clickButton(); expect(element.find('span').text()).toBe('Error: No concepts selected!'); }); + + it('should show error due to invalid concepts', function() { + _prepareScope(1, false, {foo: {concepts: [], valid: false}}); + _clickButton(); + expect(element.find('span').text()).toBe('Error: Your data do not match the requirements! All fields must be green.'); + }); }); + diff --git a/test/unit/javascript/smartRUtilsServiceTests.js b/test/unit/javascript/smartRUtilsServiceTests.js index 96e64a5..f0fbb08 100644 --- a/test/unit/javascript/smartRUtilsServiceTests.js +++ b/test/unit/javascript/smartRUtilsServiceTests.js @@ -15,7 +15,11 @@ describe('smartRUtils', function() { }); it('has working conceptBoxMapToConceptKeys()', function() { - var params = {a: ['c1', 'c2'], 'foo bar __-!*()123 abc': ['c3'], b: [], c: ['12--_- c31/??/*&^/foobar']}; + var params = {a: {concepts: ['c1', 'c2'], valid: true}, + 'foo bar __-!*()123 abc': {concepts: ['c3'], valid: true}, + b: {concepts: [], valid: true}, + c: {concepts: ['12--_- c31/??/*&^/foobar'], valid: true} + }; var expected = {a_n0: 'c1', a_n1: 'c2', 'foo bar __-!*()123 abc_n0': 'c3', c_n0: '12--_- c31/??/*&^/foobar'}; var result = smartRUtils.conceptBoxMapToConceptKeys(params); expect(result).toEqual(expected); From 36cc6fc65d68bffddf5fd747e0383941cbcadf38 Mon Sep 17 00:00:00 2001 From: Sascha Herzinger Date: Thu, 28 Apr 2016 10:38:04 +0200 Subject: [PATCH 10/11] genecards is back --- grails-app/views/layouts/_heatmap.gsp | 20 +++++++++++++++++++ web-app/HeimScripts/heatmap/run.R | 2 +- web-app/css/heatmap.css | 6 ++++++ .../js/smartR/_angular/controllers/heatmap.js | 7 ++++--- web-app/js/smartR/_angular/viz/d3Heatmap.js | 14 ++++++++++++- 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/grails-app/views/layouts/_heatmap.gsp b/grails-app/views/layouts/_heatmap.gsp index 25c48ab..7e310fe 100644 --- a/grails-app/views/layouts/_heatmap.gsp +++ b/grails-app/views/layouts/_heatmap.gsp @@ -87,6 +87,26 @@ +
+

I have read and accept the + GeneCards TOU +

+
+ + +
+
+ %{--Type of sorting to apply--}%
Date: Thu, 28 Apr 2016 11:38:37 +0200 Subject: [PATCH 11/11] added EMBL EBI as default --- grails-app/views/layouts/_heatmap.gsp | 4 +- web-app/js/smartR/_angular/viz/d3Heatmap.js | 49 +++++++++------------ 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/grails-app/views/layouts/_heatmap.gsp b/grails-app/views/layouts/_heatmap.gsp index 7e310fe..21659f6 100644 --- a/grails-app/views/layouts/_heatmap.gsp +++ b/grails-app/views/layouts/_heatmap.gsp @@ -96,13 +96,13 @@ yes + ng-value="true"> yes (use GeneCards)
diff --git a/web-app/js/smartR/_angular/viz/d3Heatmap.js b/web-app/js/smartR/_angular/viz/d3Heatmap.js index 2902f2d..1543805 100644 --- a/web-app/js/smartR/_angular/viz/d3Heatmap.js +++ b/web-app/js/smartR/_angular/viz/d3Heatmap.js @@ -5,7 +5,8 @@ window.smartRApp.directive('heatmapPlot', [ 'smartRUtils', 'controlElements', - function(smartRUtils, controlElements) { + '$http', + function(smartRUtils, controlElements, $http) { return { restrict: 'E', @@ -519,14 +520,19 @@ window.smartRApp.directive('heatmapPlot', [ .on('click', function(d) { var genes = d.split('--'); genes.shift(); + var urls = []; if (geneCardsAllowed) { genes.forEach(function(gene) { - var url = 'http://www.genecards.org/cgi-bin/carddisp.pl?gene=' + gene; - window.open(url); + urls.push('http://www.genecards.org/cgi-bin/carddisp.pl?gene=' + gene); }); } else { - alert('To use this function you have to accept the GeneCards Terms of Use and re-create the plot'); + genes.forEach(function(gene) { + urls.push('https://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=' + gene); + }); } + urls.forEach(function(url) { + window.open(url); + }); }); uid.transition() @@ -1121,32 +1127,21 @@ window.smartRApp.directive('heatmapPlot', [ var uid = uids[leaf]; var split = uid.split("--"); split.shift(); - split.each(function (gene) { - genes.push(gene); - }); + genes = genes.concat(split); }); - $.ajax({ - url: 'http://biocompendium.embl.de/cgi-bin/biocompendium.cgi', - type: 'POST', - timeout: '5000', - async: false, + + $http({ + url: pageInfo.basePath + '/SmartR/goToBiocompendium', + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + config: { + timeout: 5000 + }, data: { - section: 'upload_gene_lists_general', - primary_org: 'Human', - background: 'whole_genome', - Category1: 'Human', - gene_list_1: 'gene_list_1', - SubCat1: 'hgnc_symbol', - attachment1: genes.join(' ') + genes: genes.join(' ') } - }).done(function (serverAnswer) { - var sessionID = serverAnswer.match(/tmp_\d+/)[0]; - var url = 'http://biocompendium.embl.de/' + - 'cgi-bin/biocompendium.cgi?section=pathway&pos=0&background=whole_genome&session=' + - sessionID + '&list=gene_list_1__1&list_size=15&org=human'; - window.open(url); - }).fail(function () { - alert('An error occurred. Maybe the external resource is unavailable.'); }); }) .on('mouseover', function (d) {