Commit 69cf66ee authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '72-genome-browser' into 'devel_12.1.x'

Resolve "Genome browser in submaps not working"

See merge request !344
parents 3b5f3776 fc34f65d
Pipeline #5721 passed with stage
in 1 minute and 57 seconds
......@@ -127,7 +127,7 @@ public interface ReferenceGenomeConnector {
* @param version
* version of the reference genome
* @throws IOException
* thrown when there is a problem with removeing file
* thrown when there is a problem with removing file
*/
void removeGenomeVersion(MiriamData organism, String version) throws IOException;
......@@ -135,7 +135,7 @@ public interface ReferenceGenomeConnector {
* Returns url to the file that describes reference genome.
*
* @param organism
* organism of redference genome
* organism of reference genome
* @param version
* version of the reference genome
* @return url to the file that describes reference genome
......
......@@ -336,9 +336,9 @@
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"base62": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/base62/-/base62-1.2.0.tgz",
"integrity": "sha1-MeflYNyEbJ9EwaUx32UU2jVHQVc="
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/base62/-/base62-1.2.8.tgz",
"integrity": "sha512-V6YHUbjLxN1ymqNLb1DPHoU1CpfdL7d2YTIp5W3U4hhoG4hhxNmsFDs66M9EXxBiSEke5Bt5dwdfMwwZF70iLA=="
},
"base64-arraybuffer": {
"version": "0.1.5",
......@@ -942,9 +942,9 @@
"detective": "4.5.0",
"glob": "5.0.15",
"graceful-fs": "4.1.11",
"iconv-lite": "0.4.18",
"iconv-lite": "0.4.23",
"mkdirp": "0.5.1",
"private": "0.1.7",
"private": "0.1.8",
"q": "1.5.0",
"recast": "0.11.23"
},
......@@ -1576,9 +1576,9 @@
}
},
"es6-promise": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz",
"integrity": "sha512-OaU1hHjgJf+b0NzsxCg7NdIYERD6Hy/PEmFLTjw+b65scuisG3Kt4QoTvJ66BBkPZ581gr0kpoVzKnxniM8nng=="
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz",
"integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ=="
},
"escape-html": {
"version": "1.0.3",
......@@ -1742,7 +1742,7 @@
"core-js": "1.2.7",
"loose-envify": "1.3.1",
"promise": "7.3.1",
"ua-parser-js": "0.7.14",
"ua-parser-js": "0.7.18",
"whatwg-fetch": "0.9.0"
}
},
......@@ -2308,9 +2308,12 @@
"dev": true
},
"iconv-lite": {
"version": "0.4.18",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz",
"integrity": "sha512-sr1ZQph3UwHTR0XftSbK85OvBbxe/abLGzEnPENCQwmHf7sck8Oyu4ob3LgBxWWxRoM+QszeUyl7jbqapu2TqA=="
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"requires": {
"safer-buffer": "2.1.2"
}
},
"ieee754": {
"version": "1.1.8",
......@@ -2560,7 +2563,7 @@
"resolved": "https://registry.npmjs.org/jbinary/-/jbinary-2.1.3.tgz",
"integrity": "sha1-JDLiOYmZPpcKE8uw7eQcp/xMkZk=",
"requires": {
"es6-promise": "4.1.1",
"es6-promise": "4.2.4",
"jdataview": "2.5.0",
"request": "2.82.0"
}
......@@ -2860,7 +2863,7 @@
"resolved": "https://registry.npmjs.org/jstransform/-/jstransform-11.0.3.tgz",
"integrity": "sha1-CaeJk+CuTU70SH9hVakfYZDLQiM=",
"requires": {
"base62": "1.2.0",
"base62": "1.2.8",
"commoner": "0.10.8",
"esprima-fb": "15001.1.0-dev-harmony-fb",
"object-assign": "2.1.1",
......@@ -3709,9 +3712,9 @@
"dev": true
},
"pileup": {
"version": "0.6.8",
"resolved": "https://registry.npmjs.org/pileup/-/pileup-0.6.8.tgz",
"integrity": "sha1-LYhmfpRLC4I9A3tTSto1lnHBh04=",
"version": "0.6.9",
"resolved": "https://registry.npmjs.org/pileup/-/pileup-0.6.9.tgz",
"integrity": "sha1-y/xM24/tNzOOX0k6gJQfkE/bGko=",
"requires": {
"backbone": "1.1.2",
"d3": "3.5.17",
......@@ -3765,9 +3768,9 @@
"integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks="
},
"private": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz",
"integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE="
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
"integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg=="
},
"process": {
"version": "0.11.10",
......@@ -3970,7 +3973,7 @@
"requires": {
"ast-types": "0.9.6",
"esprima": "3.1.3",
"private": "0.1.7",
"private": "0.1.8",
"source-map": "0.5.7"
},
"dependencies": {
......@@ -4204,6 +4207,11 @@
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
......@@ -4889,9 +4897,9 @@
"dev": true
},
"ua-parser-js": {
"version": "0.7.14",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.14.tgz",
"integrity": "sha1-EQ1T+kw/MmwSEpK76skE0uAzh8o="
"version": "0.7.18",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.18.tgz",
"integrity": "sha512-LtzwHlVHwFGTptfNSgezHp7WUlwiqb0gA9AALRbKaERfxwJoiX0A73QbTToxteIAuIaFshhgIZfqK8s7clqgnA=="
},
"uglify-js": {
"version": "2.8.29",
......
......@@ -50,7 +50,7 @@
"log4js": "0.6.38",
"multi-checkbox-list": "^0.2.0",
"openlayers": "^4.6.5",
"pileup": "^0.6.8",
"pileup": "^0.6.9",
"request": "^2.82.0",
"spectrum-colorpicker": "^1.8.0",
"text-encoding": "^0.6.4",
......
......@@ -503,14 +503,15 @@ h1 {
font-weight: 400;
}
.minerva-projects-tab, .minerva-users-tab, .minerva-configuration-tab {
.minerva-projects-tab, .minerva-users-tab, .minerva-configuration-tab, .minerva-genome-tab {
margin-left: 10px;
margin-top: 10px;
}
.minerva-projects-tab .minerva-menu-row button,
.minerva-edit-project-dialog .minerva-menu-row button,
.minerva-users-tab .minerva-menu-row button {
.minerva-users-tab .minerva-menu-row button,
.minerva-genome-tab .minerva-menu-row button {
margin: 5px;
}
......@@ -748,7 +749,7 @@ a.adminLink:hover {
}
.popover {
max-width: 600px;
max-width: 800px;
min-width: 390px;
}
......
......@@ -9,6 +9,7 @@ var GuiUtils = require('./gui/leftPanel/GuiUtils');
var ObjectWithListeners = require('./ObjectWithListeners');
var ConfigurationAdminPanel = require('./gui/admin/ConfigurationAdminPanel');
var GenomeAdminPanel = require('./gui/admin/GenomeAdminPanel');
var MapsAdminPanel = require('./gui/admin/MapsAdminPanel');
var UsersAdminPanel = require('./gui/admin/UsersAdminPanel');
......@@ -19,9 +20,8 @@ var Functions = require('./Functions');
/**
* Default constructor.
*
* @param options
* CustomMapOptions object representing all parameters needed for map
* creation
* @param {CustomMapOptions} options
* object representing all parameters needed for map creation
*/
function Admin(options) {
var self = this;
......@@ -55,6 +55,9 @@ Admin.prototype._createGui = function () {
}, {
name: "CONFIGURATION",
panelClass: ConfigurationAdminPanel
}, {
name: "GENOMES",
panelClass: GenomeAdminPanel
}];
var tabDiv = Functions.createElement({
......
......@@ -120,9 +120,18 @@ Configuration.prototype.getOptions = function () {
return result;
};
/**
*
* @param {string[]} overlayTypes
*/
Configuration.prototype.setOverlayTypes = function (overlayTypes) {
this._overlayTypes = overlayTypes;
};
/**
*
* @returns {string[]}
*/
Configuration.prototype.getOverlayTypes = function () {
return this._overlayTypes;
};
......
......@@ -307,6 +307,15 @@ ServerConnector.createGetParams = function (params, prefix) {
return result;
};
/**
*
* @param {Object} paramObj
* @param {string} paramObj.type
* @param {string} [paramObj.url]
* @param {Object} [paramObj.params]
*
* @returns {string}
*/
ServerConnector.getApiUrl = function (paramObj) {
var type = paramObj.type;
var params = this.createGetParams(paramObj.params);
......@@ -411,12 +420,124 @@ ServerConnector.getSbmlParameterUrl = function (queryParams, filterParams) {
});
};
/**
*
* @param {Object} queryParams
* @param {string} [queryParams.version]
* @param {string} [queryParams.organism]
* @param {string} [queryParams.type]
* @param {string} [queryParams.genomeId]
* @param {Object} filterParams
*
* @returns {string}
*/
ServerConnector.getReferenceGenomeUrl = function (queryParams, filterParams) {
var version = this.getIdOrAsterisk(queryParams.version);
if (queryParams.genomeId !== undefined) {
return this.getApiUrl({
type: "genomics/" + queryParams.genomeId + "/",
params: filterParams
});
} else {
var version = this.getIdOrAsterisk(queryParams.version);
return this.getApiUrl({
type: "genomics/taxonomies/" + queryParams.organism + "/genomeTypes/" + queryParams.type + "/versions/" + version
+ "/",
params: filterParams
});
}
};
/**
*
* @param {Object} queryParams
* @param {string} queryParams.genomeId
* @param {string} queryParams.mappingId
* @param {Object} [filterParams]
*
* @returns {string}
*/
ServerConnector.getReferenceGenomeGeneMappingUrl = function (queryParams, filterParams) {
return this.getApiUrl({
type: "genomics/" + queryParams.genomeId + "/geneMapping/" + queryParams.mappingId + "/",
params: filterParams
});
};
/**
*
* @param {Object} queryParams
* @param {string} queryParams.genomeId
* @param {Object} [filterParams]
*
* @returns {string}
*/
ServerConnector.getReferenceGenomeGeneMappingsUrl = function (queryParams, filterParams) {
return this.getApiUrl({
type: "genomics/" + queryParams.genomeId + "/geneMapping/",
params: filterParams
});
};
/**
*
* @param {Object} queryParams
* @param {string} queryParams.version
* @param {Annotation} queryParams.organism
* @param {string} queryParams.type
* @param {Object} filterParams
*
* @returns {string}
*/
ServerConnector.getAvailableGenomeUrlsUrl = function (queryParams, filterParams) {
return this.getApiUrl({
type: "genomics/taxonomies/" + queryParams.organism.getResource() + "/genomeTypes/" + queryParams.type + "/versions/" + queryParams.version
+ ":getAvailableRemoteUrls",
params: filterParams
});
};
/**
*
* @param {Object} queryParams
* @param {Annotation} queryParams.organism
* @param {Object} [filterParams]
*
* @returns {string}
*/
ServerConnector.getReferenceGenomeTypesUrl = function (queryParams, filterParams) {
return this.getApiUrl({
type: "genomics/taxonomies/" + queryParams.organism.getResource() + "/genomeTypes/",
params: filterParams
});
};
/**
*
* @param {Object} queryParams
* @param {Annotation} queryParams.organism
* @param {string} queryParams.type
* @param {Object} [filterParams]
*
* @returns {string}
*/
ServerConnector.getReferenceGenomeVersionsUrl = function (queryParams, filterParams) {
return this.getApiUrl({
type: "genomics/taxonomies/" + queryParams.organism + "/genomeTypes/" + queryParams.type + "/versions/" + version
+ "/",
type: "genomics/taxonomies/" + queryParams.organism.getResource() + "/genomeTypes/" + queryParams.type + "/versions/",
params: filterParams
});
};
/**
*
* @param {Object} [queryParams]
* @param {Object} [filterParams]
*
* @returns {string}
*/
ServerConnector.getReferenceGenomeOrganismsUrl = function (queryParams, filterParams) {
return this.getApiUrl({
type: "genomics/taxonomies/",
params: filterParams
});
};
......@@ -718,6 +839,21 @@ ServerConnector.getUsersUrl = function (queryParams, filterParams) {
});
};
/**
*
* @param {Object} [queryParams]
* @param {Object} [filterParams]
*
* @returns {string}
*/
ServerConnector.getReferenceGenomesUrl = function (queryParams, filterParams) {
return this.getApiUrl({
type: "genomics/",
params: filterParams
});
};
ServerConnector.getUserUrl = function (queryParams, filterParams) {
return this.getApiUrl({
url: this.getUsersUrl() + queryParams.login,
......@@ -1160,9 +1296,23 @@ ServerConnector.getUsers = function (forceRefresh) {
return self.processNetworkError(error);
});
}
};
ServerConnector.getReferenceGenomes = function () {
var self = this;
return self.sendGetRequest(self.getReferenceGenomesUrl()).then(function (content) {
var result = [];
var parsedData = JSON.parse(content);
for (var i = 0; i < parsedData.length; i++) {
var genome = new ReferenceGenome(parsedData[i]);
result.push(genome)
}
return result;
});
};
ServerConnector.getOverlays = function (params) {
var self = this;
if (params === undefined) {
......@@ -1733,7 +1883,6 @@ ServerConnector.addComment = function (params) {
delete filterParams.modelId;
return self.getProjectId(params.projectId).then(function (result) {
queryParams.projectId = result;
console.log(self.addCommentUrl(queryParams));
return self.sendPostRequest(self.addCommentUrl(queryParams), filterParams);
}).then(function (content) {
var response = JSON.parse(content);
......@@ -1761,6 +1910,7 @@ ServerConnector.addOverlay = function (params) {
content: overlay.getContent(),
filename: overlay.getFilename(),
googleLicenseConsent: overlay.isGoogleLicenseConsent(),
type: overlay.getType(),
fileId: params.fileId
};
return self.getProjectId(params.projectId).then(function (result) {
......@@ -1771,6 +1921,12 @@ ServerConnector.addOverlay = function (params) {
});
};
/**
*
* @param {string} name
* @param {string} content
* @returns {Promise}
*/
ServerConnector.addOverlayFromString = function (name, content) {
var fileName = name + ".txt";
var overlay = new DataOverlay({
......@@ -1945,14 +2101,162 @@ ServerConnector.getPublications = function (params) {
});
};
/**
*
* @param {Object} params
* @param {string} [params.version]
* @param {string} [params.organism]
* @param {string} [params.type]
* @param {string|number} [params.genomeId]
*
* @returns {Promise}
*/
ServerConnector.getReferenceGenome = function (params) {
var self = this;
var filterParams = {};
return self.sendGetRequest(self.getReferenceGenomeUrl(params, filterParams)).then(function (content) {
return new ReferenceGenome(JSON.parse(content));
if (params.genomeId !== undefined) {
return self.getReferenceGenomes().then(function (referenceGenomes) {
for (var i = 0; i < referenceGenomes.length; i++) {
var genome = referenceGenomes[i];
if (genome.getId() === params.genomeId) {
return genome;
}
}
return null;
});
} else {
return self.sendGetRequest(self.getReferenceGenomeUrl(params, filterParams)).then(function (content) {
return new ReferenceGenome(JSON.parse(content));
});
}
};
/**
*
* @param {Object} params
* @param {string|number} params.genomeId
* @param {string} params.mappingName
* @param {string} params.mappingUrl
* @returns {PromiseLike}
*/
ServerConnector.addGeneMapping = function (params) {
var self = this;
var data = {
name: params.mappingName,
url: params.mappingUrl
};
return self.sendPostRequest(self.getReferenceGenomeGeneMappingsUrl(params), data);
};
/**
*
* @param {Object} params
* @param {string} params.version
* @param {Annotation} params.organism
* @param {string} params.type
*
* @returns {Promise<string[]>}
*/
ServerConnector.getAvailableGenomeUrls = function (params) {
var self = this;
var filterParams = {};
return self.sendGetRequest(self.getAvailableGenomeUrlsUrl(params, filterParams)).then(function (content) {
var result = [];
var raw = JSON.parse(content);
for (var i = 0; i < raw.length; i++) {
result.push(raw[i].url);
}
return result;
});
};
/**
*
* @param {ReferenceGenome} genome
* @returns {Promise<ReferenceGenome>}
*/
ServerConnector.addReferenceGenome = function (genome) {
var self = this;
var data = {
organismId: genome.getOrganism().getResource(),
type: genome.getType(),
version: genome.getVersion(),
sourceUrl: genome.getSourceUrl()
};
return self.sendPostRequest(self.getReferenceGenomesUrl(), data);
};
/**
*
* @param {Object} params
* @param {string} params.genomeId
* @param {string} params.mappingId
*
* @returns {Promise}
*/
ServerConnector.removeReferenceGenomeGeneMapping = function (params) {
var self = this;
return self.sendDeleteRequest(self.getReferenceGenomeGeneMappingUrl(params));
};
/**
*
* @param {Object} params
* @param {Annotation} params.organism
* @returns {Promise}
*/
ServerConnector.getReferenceGenomeTypes = function (params) {
var self = this;
var filterParams = {};
return self.sendGetRequest(self.getReferenceGenomeTypesUrl(params, filterParams)).then(function (content) {
return JSON.parse(content);
});
};
/**
*
* @param {Object} params
* @param {Annotation} params.organism
* @param {string} params.type
* @returns {Promise}
*/
ServerConnector.getReferenceGenomeVersions = function (params) {
var self = this;
var filterParams = {};
return self.sendGetRequest(self.getReferenceGenomeVersionsUrl(params, filterParams)).then(function (content) {
return JSON.parse(content);
});
};
/**
*
* @returns {Promise}
*/
ServerConnector.getReferenceGenomeOrganisms = function () {
var self = this;
return self.sendGetRequest(self.getReferenceGenomeOrganismsUrl()).then(function (content) {
var array = JSON.parse(content);