Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where user adds a gene/transcript/etc and then removes it b… #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 40 additions & 9 deletions web-app/js/HighDimensionalData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var HighDimensionalData = function () {

/**
* Get supported high dimensional data types
* @returns {*}
Expand Down Expand Up @@ -42,9 +42,10 @@ var HighDimensionalData = function () {
* Populate data to the popup window
*/
HighDimensionalData.prototype.populate_data = function () {

for (var key in this.data) {
if (this.data.hasOwnProperty(key)) {

var _tmp_data = this.data[key];

// set global marker type
Expand All @@ -55,7 +56,6 @@ HighDimensionalData.prototype.populate_data = function () {
}

if (document.getElementById("highDimContainer")) {

document.getElementById("highDimensionType").value = key;
document.getElementById("platforms1").value = GLOBAL.HighDimDataType;
document.getElementById("gpl1").value = _tmp_data.platforms[0].id ? _tmp_data.platforms[0].id : "";
Expand All @@ -82,18 +82,39 @@ HighDimensionalData.prototype.populate_data = function () {
}else{
document.getElementById("probesAggregationDiv").style.visibility = "visible";
}
}
}

} else {
Ext.Msg.alert("Error", "Returned object is unknown.");
}
}
}

HighDimensionalData.prototype.reconcile_pathways = function (inputPathways, ignorePathway) {
var inputPathwaysArr = inputPathways.split(",").map( function(element) {
return element.trim();
});

var globalPathwaysArr = GLOBAL.CurrentPathwayName.split(", ");
var globalPathwayIdsArr = GLOBAL.CurrentPathway.split(",");

globalPathwaysArr.forEach( function(element, index) {
if ((inputPathwaysArr.indexOf(element) == -1) && (element != ignorePathway)) {
globalPathwaysArr.splice(index, 1);
globalPathwayIdsArr.splice(index, 1)
}
});

GLOBAL.CurrentPathway = globalPathwayIdsArr.join(",");
GLOBAL.CurrentPathwayName = globalPathwaysArr.join(", ");
}

HighDimensionalData.prototype.create_pathway_search_box = function (searchInputEltName, divName) {

var ajaxurl, ds, resultTpl;

var self = this;

// remove all elements
var el = document.getElementById(searchInputEltName);
if (el) {
Expand Down Expand Up @@ -173,8 +194,11 @@ HighDimensionalData.prototype.create_pathway_search_box = function (searchInputE
GLOBAL.CurrentPathwayName += record.data.keyword;
}

// Set the value in the text field
var sp = Ext.get(searchInputEltName);
var pathways = sp.dom.value;

self.reconcile_pathways(pathways, record.data.keyword);

sp.dom.value = GLOBAL.CurrentPathwayName;

search.collapse();
Expand All @@ -190,10 +214,10 @@ HighDimensionalData.prototype.create_pathway_search_box = function (searchInputE
}

HighDimensionalData.prototype.generate_view = function () {

var _this = this;
var _view = this.view;

/**
* to satisfy load high dim function
* @private
Expand Down Expand Up @@ -287,6 +311,9 @@ HighDimensionalData.prototype.generate_view = function () {
id: 'dataAssociationApplyButton',
text: 'Apply Selections',
handler: function () {
var sp = Ext.get('searchPathway');
var pathways = sp.dom.value;
_this.reconcile_pathways(pathways);
_display_high_dim_selection_summary();
_view.hide();
}
Expand Down Expand Up @@ -351,7 +378,10 @@ HighDimensionalData.prototype.get_inputs = function (divId) {
}

HighDimensionalData.prototype.gather_high_dimensional_data = function (divId, hideAggregration, doValidatePlatforms) {


this.view = this.generate_view();
this.display_high_dimensional_popup();

var _this = this;
this.hideAggregration=hideAggregration;
doValidatePlatforms = typeof doValidatePlatforms !== 'undefined' ? doValidatePlatforms : true;
Expand Down Expand Up @@ -628,8 +658,9 @@ HighDimensionalData.prototype.load_parameters = function (formParams) {
HighDimensionalData.prototype.display_high_dimensional_popup = function () {

// generate view and populate it with the data
this.view = this.generate_view();
this.view = this.generate_view();
// then show it

if (typeof viewport !== undefined) {
this.view.show(viewport, this.populate_data());
} else {
Expand Down