Commit 90517ee5 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

opening genomics on submap fixed

parent 770e7fbf
......@@ -210,7 +210,7 @@ DataOverlay.prototype.getFullAliasById = function (id) {
var self = this;
var alias = self.getAliasById(id);
if (alias !== undefined) {
if (alias.getType() === LayoutAlias.LIGTH) {
if (alias.getType() === LayoutAlias.LIGHT) {
return ServerConnector.getFullOverlayElement({
element: new IdentifiedElement(alias),
overlay: self
......
......@@ -15,7 +15,7 @@ function LayoutAlias(javaObject) {
this.setModelId(javaObject.modelId);
this.setDescription(javaObject.description);
if (javaObject.type === undefined) {
this.setType(LayoutAlias.LIGTH);
this.setType(LayoutAlias.LIGHT);
} else if (javaObject.type === LayoutAlias.GENETIC_VARIANT) {
this.setType(LayoutAlias.GENETIC_VARIANT);
} else if (javaObject.type === LayoutAlias.GENERIC) {
......
......@@ -291,7 +291,7 @@ AliasInfoWindow.prototype.createGenomicDiv = function () {
if (data !== null && data !== undefined && data.getType() === LayoutAlias.GENETIC_VARIANT) {
geneticInformation = true;
return Promise.each(data.getGeneVariants(), function (variant) {
return self.getCustomMap().getReferenceGenome(variant.getReferenceGenomeType(),
return self.getCustomMap().getTopMap().getReferenceGenome(variant.getReferenceGenomeType(),
variant.getReferenceGenomeVersion()).then(
function (genome) {
if (genome.getUrl() !== null && genome.getUrl() !== undefined) {
......
......@@ -220,6 +220,11 @@ Helper.prototype.createAlias = function (map) {
return result;
};
/**
*
* @param {Alias} [alias]
* @returns {LayoutAlias}
*/
Helper.prototype.createLayoutAlias = function (alias) {
var id;
var modelId;
......@@ -237,7 +242,7 @@ Helper.prototype.createLayoutAlias = function (alias) {
a: 23
},
modelId: modelId,
geneVariations: [{}]
geneVariations: []
});
};
......
......@@ -7,6 +7,7 @@ var Promise = require("bluebird");
var functions = require('../../../../main/js/Functions');
var Alias = require('../../../../main/js/map/data/Alias');
var LayoutAlias = require('../../../../main/js/map/data/LayoutAlias');
var Drug = require('../../../../main/js/map/data/Drug');
var GeneVariant = require('../../../../main/js/map/data/GeneVariant');
var AliasInfoWindow = require('../../../../main/js/map/window/AliasInfoWindow');
......@@ -220,107 +221,144 @@ describe('AliasInfoWindow', function () {
});
});
xit("createGeneticsDiv", function () {
var map;
var overlay;
var layoutAlias;
var win;
return ServerConnector.getProject().then(function (project) {
map = helper.createCustomMap(project);
overlay = new DataOverlay(18077, "xxx");
return overlay.init();
}).then(function () {
return overlay.getFullAliasById(overlay.getAliases()[0].getId());
}).then(function (data) {
layoutAlias = data;
return map.getModel().getAliasById(layoutAlias.getId());
}).then(function (alias) {
win = new AliasInfoWindow({
alias: alias,
map: map,
marker: helper.createMarker({element: alias, map: map})
describe("createGeneticsDiv", function () {
it("on top map", function () {
var map;
var overlay;
var layoutAlias;
var win;
return ServerConnector.getProject().then(function (project) {
map = helper.createCustomMap(project);
overlay = new DataOverlay(18077, "xxx");
return overlay.init();
}).then(function () {
return overlay.getFullAliasById(overlay.getAliases()[0].getId());
}).then(function (data) {
layoutAlias = data;
return map.getModel().getAliasById(layoutAlias.getId());
}).then(function (alias) {
win = new AliasInfoWindow({
alias: alias,
map: map,
marker: helper.createMarker({element: alias, map: map})
});
return win.init();
}).then(function () {
win.layoutAliases = [layoutAlias];
win.layoutNames = ["xxx"];
return win.createGenomicDiv();
}).then(function (div) {
assert.ok(div);
assert.ok(div.innerHTML.indexOf("No reference genome data available on minerva platform") === -1);
win.destroy();
});
return win.init();
}).then(function () {
win.layoutAliases = [layoutAlias];
win.layoutNames = ["xxx"];
return win.createGenomicDiv();
}).then(function (div) {
assert.ok(div);
assert.ok(div.innerHTML.indexOf("No reference genome data available on minerva platform") === -1);
win.destroy();
});
});
it("createGeneticsDiv with no genetic data", function () {
var map;
var win;
var aliasId = 329173;
});
return ServerConnector.getProject().then(function (project) {
map = helper.createCustomMap(project);
var overlay = new DataOverlay(18077, "xxx");
return overlay.init();
}).then(function () {
return map.getModel().getAliasById(aliasId);
}).then(function (alias) {
win = new AliasInfoWindow({
alias: alias,
map: map,
marker: helper.createMarker({element: alias, map: map})
it("on submap map", function () {
helper.setUrl("http://test/?id=complex_model_with_submaps");
var map, submap, overlay, win, alias;
return ServerConnector.getProject().then(function (project) {
map = helper.createCustomMap(project);
submap = map.getSubmapById(16731);
overlay = new DataOverlay(18077, "xxx");
overlay.setInitialized(true);
return map.openSubmap(submap.getId());
}).then(function () {
return submap.getModel().getAliasById(345337);
}).then(function (data) {
alias = data;
win = new AliasInfoWindow({
alias: alias,
map: submap,
marker: helper.createMarker({element: alias, map: submap})
});
return win.init();
}).then(function () {
var layoutAlias = helper.createLayoutAlias(alias);
layoutAlias.setType(LayoutAlias.GENETIC_VARIANT);
win.layoutAliases = [layoutAlias];
win.layoutNames = ["xxx"];
return win.createGenomicDiv();
}).then(function (div) {
assert.ok(div);
win.destroy();
return map.destroy();
});
return win.init();
}).then(function () {
win.layoutAliases = [undefined];
return win.createGenomicDiv();
}).then(function (div) {
assert.ok(div);
assert.ok(div.innerHTML.indexOf("No reference genome data available on minerva platform") === -1);
win.destroy();
});
});
});
it("createGeneticsDivForUnknownOrganism", function () {
var map;
var overlay;
it("with no genetic data", function () {
var map;
var win;
var aliasId = 329173;
return ServerConnector.getProject().then(function (project) {
map = helper.createCustomMap(project);
var overlay = new DataOverlay(18077, "xxx");
return overlay.init();
}).then(function () {
return map.getModel().getAliasById(aliasId);
}).then(function (alias) {
win = new AliasInfoWindow({
alias: alias,
map: map,
marker: helper.createMarker({element: alias, map: map})
});
return win.init();
}).then(function () {
win.layoutAliases = [undefined];
return win.createGenomicDiv();
}).then(function (div) {
assert.ok(div);
assert.ok(div.innerHTML.indexOf("No reference genome data available on minerva platform") === -1);
win.destroy();
});
var layoutAlias;
var win;
});
return ServerConnector.getProject().then(function (project) {
project.setOrganism({
type: "TAXONOMY",
resource: "123456"
it("for unknown organism", function () {
var map;
var overlay;
var layoutAlias;
var win;
return ServerConnector.getProject().then(function (project) {
project.setOrganism({
type: "TAXONOMY",
resource: "123456"
});
map = helper.createCustomMap(project);
overlay = new DataOverlay(18077, "xxx");
return overlay.init();
}).then(function () {
return overlay.getFullAliasById(overlay.getAliases()[0].getId());
}).then(function (data) {
layoutAlias = data;
return map.getModel().getAliasById(layoutAlias.getId());
}).then(function (alias) {
win = new AliasInfoWindow({
alias: alias,
map: map,
marker: helper.createMarker({element: alias, map: map})
});
return win.init();
}).then(function () {
win.layoutAliases = [layoutAlias];
return win.createGenomicDiv();
}).then(function (div) {
assert.ok(div);
assert.ok(div.innerHTML.indexOf("No reference genome data available on minerva platform") >= -1);
win.destroy();
});
map = helper.createCustomMap(project);
overlay = new DataOverlay(18077, "xxx");
return overlay.init();
}).then(function () {
return overlay.getFullAliasById(overlay.getAliases()[0].getId());
}).then(function (data) {
layoutAlias = data;
return map.getModel().getAliasById(layoutAlias.getId());
}).then(function (alias) {
win = new AliasInfoWindow({
alias: alias,
map: map,
marker: helper.createMarker({element: alias, map: map})
});
return win.init();
}).then(function () {
win.layoutAliases = [layoutAlias];
return win.createGenomicDiv();
}).then(function (div) {
assert.ok(div);
assert.ok(div.innerHTML.indexOf("No reference genome data available on minerva platform") >= -1);
win.destroy();
});
});
});
it("createWaitingContentDiv", function () {
......@@ -392,7 +430,7 @@ describe('AliasInfoWindow', function () {
referenceGenomeVersion: "hg19"
});
var str = aliasWindow.createVcfString([variant, variant2]);
assert.ok(str.indexOf("null") === -1,"null shouldn't appear in vcf format");
assert.ok(str.indexOf("null") === -1, "null shouldn't appear in vcf format");
});
});
{"downloadProgress":100.0,"geneMapping":[],"idObject":1830,"localUrl":"../minerva-big//9395/eboVir3.2bit","organism":{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1150730,"link":"http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=1570291","resource":"1570291","type":"TAXONOMY"},"sourceUrl":"ftp://hgdownload.cse.ucsc.edu/goldenPath/eboVir3/bigZips/eboVir3.2bit","type":"UCSC","version":"eboVir3"}
\ No newline at end of file
{"version":"0","disease":{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1104479,"link":"http://bioportal.bioontology.org/ontologies/1351?p=terms&conceptid=D010300","resource":"D010300","type":"MESH_2012"},"organism":{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1104480,"link":"http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=9606","resource":"9606","type":"TAXONOMY"},"idObject":14898,"status":"Ok","directory":"5e8ff9bf55ba3508199d22e984129be6","progress":100.0,"notifyEmail":"","warnings":true,"errors":false,"name":"UNKNOWN DISEASE MAP","projectId":"sample","mapCanvasType":"OPEN_LAYERS","overviewImageViews":[],"topOverviewImage":null}
\ No newline at end of file
{"version":"0","disease":{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1104479,"link":"http://bioportal.bioontology.org/ontologies/1351?p=terms&conceptid=D010300","resource":"D010300","type":"MESH_2012"},"organism":{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1104480,"link":"http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=1570291","resource":"1570291","type":"TAXONOMY"},"idObject":14898,"status":"Ok","directory":"5e8ff9bf55ba3508199d22e984129be6","progress":100.0,"notifyEmail":"","warnings":true,"errors":false,"name":"UNKNOWN DISEASE MAP","projectId":"sample","mapCanvasType":"OPEN_LAYERS","overviewImageViews":[],"topOverviewImage":null}
\ No newline at end of file
{"version":"0","disease":{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1104479,"link":"http://bioportal.bioontology.org/ontologies/1351?p=terms&conceptid=D010300","resource":"D010300","type":"MESH_2012"},"organism":{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1104480,"link":"http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=9606","resource":"9606","type":"TAXONOMY"},"idObject":14898,"status":"Ok","directory":"5e8ff9bf55ba3508199d22e984129be6","progress":100.0,"notifyEmail":"","warnings":true,"errors":false,"name":"UNKNOWN DISEASE MAP","projectId":"sample","mapCanvasType":"OPEN_LAYERS","overviewImageViews":[],"topOverviewImage":null}
\ No newline at end of file
{"version":"0","disease":{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1104479,"link":"http://bioportal.bioontology.org/ontologies/1351?p=terms&conceptid=D010300","resource":"D010300","type":"MESH_2012"},"organism":{"annotatorClassName":"","descriptionByType":"","descriptionByTypeRelation":"","id":1104480,"link":"http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=1570291","resource":"1570291","type":"TAXONOMY"},"idObject":14898,"status":"Ok","directory":"5e8ff9bf55ba3508199d22e984129be6","progress":100.0,"notifyEmail":"","warnings":true,"errors":false,"name":"UNKNOWN DISEASE MAP","projectId":"sample","mapCanvasType":"OPEN_LAYERS","overviewImageViews":[],"topOverviewImage":null}
\ No newline at end of file
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