diff --git a/frontend-js/.idea/dictionaries/piotr_gawron.xml b/frontend-js/.idea/dictionaries/piotr_gawron.xml deleted file mode 100644 index 6a8c909a47f60a556bc261805af778533e72b7eb..0000000000000000000000000000000000000000 --- a/frontend-js/.idea/dictionaries/piotr_gawron.xml +++ /dev/null @@ -1,7 +0,0 @@ -<component name="ProjectDictionaryState"> - <dictionary name="piotr.gawron"> - <words> - <w>mailto</w> - </words> - </dictionary> -</component> \ No newline at end of file diff --git a/frontend-js/src/main/js/map/data/UserPreferences.js b/frontend-js/src/main/js/map/data/UserPreferences.js new file mode 100644 index 0000000000000000000000000000000000000000..5a2467eaa76ab190321650e56fd53c285b1001bb --- /dev/null +++ b/frontend-js/src/main/js/map/data/UserPreferences.js @@ -0,0 +1,62 @@ +"use strict"; + +/* exported logger */ + +var logger = require('../../logger'); + +function UserPreferences(javaObject) { + if (javaObject !== undefined) { + this.setProjectUpload(javaObject["project-upload"]); + this.setElementAnnotators(javaObject["element-annotators"]); + this.setElementRequiredAnnotations(javaObject["element-required-annotations"]); + this.setElementValidAnnotations(javaObject["element-valid-annotations"]); + } else { + this._projectUpload = {}; + this._elementAnnotators = {}; + this._elementRequiredAnnotations = {}; + this._elementValidAnnotations = {}; + } +} + +UserPreferences.prototype.setProjectUpload = function (projectUpload) { + this._projectUpload = { + autoResize: projectUpload["auto-resize"], + validateMiriam: projectUpload["validate-miriam"], + annotateModel: projectUpload["annotate-model"], + cacheData: projectUpload["cache-data"], + semanticZooming: projectUpload["semantic-zooming"], + sbgn: projectUpload["sbgn"] + }; +}; +UserPreferences.prototype.getProjectUpload = function () { + return this._projectUpload; +}; +UserPreferences.prototype.setElementAnnotators = function (elementAnnotators) { + this._elementAnnotators = elementAnnotators; +}; +UserPreferences.prototype.getElementAnnotators = function (className) { + return this._elementAnnotators[className]; +}; +UserPreferences.prototype.setElementRequiredAnnotations = function (elementRequiredAnnotations) { + this._elementRequiredAnnotations = {}; + for (var key in elementRequiredAnnotations) { + if (elementRequiredAnnotations.hasOwnProperty(key)) { + var data = elementRequiredAnnotations[key]; + this._elementRequiredAnnotations[key] = { + requiredAtLeastOnce: data["require-at-least-one"], + list: data["annotation-list"] + }; + } + } +}; +UserPreferences.prototype.getElementRequiredAnnotations = function (className) { + return this._elementRequiredAnnotations[className]; +}; +UserPreferences.prototype.setElementValidAnnotations = function (elementValidAnnotations) { + this._elementValidAnnotations = elementValidAnnotations; +}; +UserPreferences.prototype.getElementValidAnnotations = function (className) { + return this._elementValidAnnotations[className]; +}; + +module.exports = UserPreferences; diff --git a/frontend-js/src/test/js/helper.js b/frontend-js/src/test/js/helper.js index f0233456579a476d169c47b1958127da75e44650..47c121d93f8026b52257cb4b97ac9a328c31376c 100644 --- a/frontend-js/src/test/js/helper.js +++ b/frontend-js/src/test/js/helper.js @@ -25,6 +25,7 @@ var SearchDbOverlay = require("../../main/js/map/overlay/SearchDbOverlay"); var User = require("../../main/js/map/data/User"); var Cookies = require('js-cookie'); +var fs = require('fs'); var GuiConnector = require('../../main/js/GuiConnector'); @@ -37,10 +38,10 @@ function Helper(configuration) { this.EPSILON = Helper.EPSILON; } -Helper.prototype.setConfiguration = function (configuration) { +Helper.prototype.setConfiguration = function(configuration) { this._configuration = configuration; }; -Helper.prototype.getConfiguration = function () { +Helper.prototype.getConfiguration = function() { return this._configuration; }; @@ -143,7 +144,7 @@ Helper.prototype.createComment = function (element) { return result; }; -Helper.prototype.createProject = function() { +Helper.prototype.createProject = function () { var result = new Project(); result.setProjectId("testId"); result.setId(this.idCounter++); @@ -151,17 +152,17 @@ Helper.prototype.createProject = function() { return result; }; -Helper.prototype.createUser = function() { +Helper.prototype.createUser = function () { var result = new User({ - login : "test_login", - id : this.idCounter++, - name : "some name", - surname : "surname", + login: "test_login", + id: this.idCounter++, + name: "some name", + surname: "surname", }); return result; }; -Helper.prototype.createAlias = function(map) { +Helper.prototype.createAlias = function (map) { var mapId; if (map === undefined) { mapId = this.idCounter++; @@ -169,15 +170,15 @@ Helper.prototype.createAlias = function(map) { mapId = map.getId(); } var result = new Alias({ - idObject : this.idCounter++, - name : "Test element", - type : "RNA", - modelId : mapId, - bounds : { - x : 10.0, - y : 20.0, - width : 30.0, - height : 40.0, + idObject: this.idCounter++, + name: "Test element", + type: "RNA", + modelId: mapId, + bounds: { + x: 10.0, + y: 20.0, + width: 30.0, + height: 40.0, }, references: [], }); @@ -198,10 +199,10 @@ Helper.prototype.createLayoutAlias = function (alias) { modelId = this.idCounter++; } var result = new LayoutAlias({ - idObject : id, - value : 0.2, - color : { - a : 23 + idObject: id, + value: 0.2, + color: { + a: 23 }, modelId: modelId, geneVariations: [{}] @@ -386,6 +387,18 @@ Helper.prototype.setUrl = function (url) { GuiConnector.init(); }; +Helper.prototype.readFile = function (filename) { + return new Promise(function (resolve, reject) { + fs.readFile(filename, 'utf8', function (err, content) { + if (err) { + reject(err); + } else { + resolve(content); + } + }); + }); +}; + Helper.EPSILON = 1e-6; module.exports = Helper; diff --git a/frontend-js/src/test/js/map/data/UserPreferences-test.js b/frontend-js/src/test/js/map/data/UserPreferences-test.js new file mode 100644 index 0000000000000000000000000000000000000000..2f9c8e86e455206c03fe93135dbd7ce5cfea3fdd --- /dev/null +++ b/frontend-js/src/test/js/map/data/UserPreferences-test.js @@ -0,0 +1,30 @@ +"use strict"; + +require("../../mocha-config") +/* exported logger */ + +var UserPreferences = require('../../../../main/js/map/data/UserPreferences'); + +var logger = require('../../logger'); + +var chai = require('chai'); +var assert = chai.assert; + +var fs = require('fs'); +var Promise = require('fs'); + +describe('UserPreferences', function () { + it("constructor", function () { + return helper.readFile("testFiles/preferences.json").then(function (content) { + var object = new UserPreferences(JSON.parse(content)); + assert.ok(object); + assert.notOk(object.getProjectUpload().autoResize); + assert.ok(object.getProjectUpload().cacheData); + + assert.ok(object.getElementAnnotators("lcsb.mapviewer.model.map.species.Protein").length > 0); + assert.ok(object.getElementValidAnnotations("lcsb.mapviewer.model.map.species.Protein").length > 0); + assert.ok(object.getElementRequiredAnnotations("lcsb.mapviewer.model.map.species.Protein").requiredAtLeastOnce); + assert.ok(object.getElementRequiredAnnotations("lcsb.mapviewer.model.map.species.Protein").list.length > 0); + }) + }); +}); diff --git a/frontend-js/testFiles/preferences.json b/frontend-js/testFiles/preferences.json new file mode 100644 index 0000000000000000000000000000000000000000..5f017aff41908460c352cd9f128b38771241ae54 --- /dev/null +++ b/frontend-js/testFiles/preferences.json @@ -0,0 +1,753 @@ +{ + "element-required-annotations": { + "lcsb.mapviewer.model.map.reaction.type.UnknownReducedTriggerReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.compartment.BottomSquareCompartment": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.reaction.type.ReducedPhysicalStimulationReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.species.Chemical": { + "require-at-least-one": true, + "annotation-list": [ + "CHEBI", + "PUBCHEM", + "PUBCHEM_SUBSTANCE" + ] + }, + "lcsb.mapviewer.model.map.species.Degraded": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.compartment.PathwayCompartment": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.species.SimpleMolecule": { + "require-at-least-one": true, + "annotation-list": [ + "CHEBI", + "PUBCHEM", + "PUBCHEM_SUBSTANCE" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.BooleanLogicGateReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.species.ReceptorProtein": { + "require-at-least-one": true, + "annotation-list": [ + "HGNC", + "HGNC_SYMBOL" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.UnknownTransitionReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.TranscriptionReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.species.Gene": { + "require-at-least-one": true, + "annotation-list": [ + "HGNC", + "HGNC_SYMBOL" + ] + }, + "lcsb.mapviewer.model.map.compartment.OvalCompartment": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.reaction.type.PositiveInfluenceReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.ReducedTriggerReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.species.Protein": { + "require-at-least-one": true, + "annotation-list": [ + "HGNC", + "HGNC_SYMBOL" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.UnknownReducedPhysicalStimulationReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.BioEntity": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.species.GenericProtein": { + "require-at-least-one": true, + "annotation-list": [ + "HGNC", + "HGNC_SYMBOL" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.TransportReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.species.IonChannelProtein": { + "require-at-least-one": true, + "annotation-list": [ + "HGNC", + "HGNC_SYMBOL" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.UnknownReducedModulationReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.species.Phenotype": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.species.Drug": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.species.Element": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.reaction.type.DissociationReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.compartment.SquareCompartment": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.species.Ion": { + "require-at-least-one": true, + "annotation-list": [ + "CHEBI", + "PUBCHEM", + "PUBCHEM_SUBSTANCE" + ] + }, + "lcsb.mapviewer.model.map.reaction.Reaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.HeterodimerAssociationReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.compartment.RightSquareCompartment": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.reaction.type.TranslationReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.UnknownPositiveInfluenceReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.ReducedModulationReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.species.AntisenseRna": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.species.Complex": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.species.Unknown": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.reaction.type.TruncationReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.compartment.LeftSquareCompartment": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.reaction.type.UnknownNegativeInfluenceReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.NegativeInfluenceReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.species.TruncatedProtein": { + "require-at-least-one": true, + "annotation-list": [ + "HGNC", + "HGNC_SYMBOL" + ] + }, + "lcsb.mapviewer.model.map.compartment.Compartment": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.compartment.TopSquareCompartment": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.species.Species": { + "require-at-least-one": true, + "annotation-list": [ + ] + }, + "lcsb.mapviewer.model.map.species.Rna": { + "require-at-least-one": true, + "annotation-list": [ + "HGNC", + "HGNC_SYMBOL" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.KnownTransitionOmittedReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + }, + "lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction": { + "require-at-least-one": true, + "annotation-list": [ + "PUBMED" + ] + } + }, + "element-valid-annotations": { + "lcsb.mapviewer.model.map.reaction.type.UnknownReducedTriggerReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.compartment.BottomSquareCompartment": [ + "GO", + "MESH_2012", + "PUBMED" + ], + "lcsb.mapviewer.model.map.reaction.type.ReducedPhysicalStimulationReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.species.Chemical": [ + "CHEBI", + "HMDB", + "KEGG_COMPOUND", + "PUBCHEM", + "PUBCHEM_SUBSTANCE", + "PUBMED" + ], + "lcsb.mapviewer.model.map.species.Degraded": [ + "PUBMED" + ], + "lcsb.mapviewer.model.map.compartment.PathwayCompartment": [ + "GO", + "MESH_2012", + "PUBMED" + ], + "lcsb.mapviewer.model.map.species.SimpleMolecule": [ + "CHEBI", + "HMDB", + "KEGG_COMPOUND", + "PUBCHEM", + "PUBCHEM_SUBSTANCE", + "PUBMED" + ], + "lcsb.mapviewer.model.map.reaction.type.BooleanLogicGateReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.species.ReceptorProtein": [ + "CHEMBL_TARGET", + "EC", + "ENSEMBL", + "ENTREZ", + "HGNC", + "HGNC_SYMBOL", + "INTERPRO", + "KEGG_GENES", + "MGD", + "PANTHER", + "PUBMED", + "REFSEQ", + "UNIPROT", + "UNIPROT_ISOFORM" + ], + "lcsb.mapviewer.model.map.reaction.type.UnknownTransitionReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.reaction.type.TranscriptionReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.species.Gene": [ + "ENSEMBL", + "ENTREZ", + "HGNC", + "HGNC_SYMBOL", + "KEGG_GENES", + "MGD", + "PANTHER", + "PUBMED", + "REFSEQ", + "UNIPROT" + ], + "lcsb.mapviewer.model.map.compartment.OvalCompartment": [ + "GO", + "MESH_2012", + "PUBMED" + ], + "lcsb.mapviewer.model.map.reaction.type.PositiveInfluenceReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.reaction.type.ReducedTriggerReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.species.Protein": [ + "CHEMBL_TARGET", + "EC", + "ENSEMBL", + "ENTREZ", + "HGNC", + "HGNC_SYMBOL", + "INTERPRO", + "KEGG_GENES", + "MGD", + "PANTHER", + "PUBMED", + "REFSEQ", + "UNIPROT", + "UNIPROT_ISOFORM" + ], + "lcsb.mapviewer.model.map.reaction.type.UnknownReducedPhysicalStimulationReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.BioEntity": [ + ], + "lcsb.mapviewer.model.map.species.GenericProtein": [ + "CHEMBL_TARGET", + "EC", + "ENSEMBL", + "ENTREZ", + "HGNC", + "HGNC_SYMBOL", + "INTERPRO", + "KEGG_GENES", + "MGD", + "PANTHER", + "PUBMED", + "REFSEQ", + "UNIPROT", + "UNIPROT_ISOFORM" + ], + "lcsb.mapviewer.model.map.reaction.type.TransportReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.species.IonChannelProtein": [ + "CHEMBL_TARGET", + "EC", + "ENSEMBL", + "ENTREZ", + "HGNC", + "HGNC_SYMBOL", + "INTERPRO", + "KEGG_GENES", + "MGD", + "PANTHER", + "PUBMED", + "REFSEQ", + "UNIPROT", + "UNIPROT_ISOFORM" + ], + "lcsb.mapviewer.model.map.reaction.type.UnknownReducedModulationReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.species.Phenotype": [ + "GO", + "MESH_2012", + "OMIM", + "PUBMED" + ], + "lcsb.mapviewer.model.map.species.Drug": [ + "CHEBI", + "CHEMBL_COMPOUND", + "DRUGBANK", + "HMDB", + "PUBMED" + ], + "lcsb.mapviewer.model.map.species.Element": [ + "PUBMED" + ], + "lcsb.mapviewer.model.map.reaction.type.DissociationReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.compartment.SquareCompartment": [ + "GO", + "MESH_2012", + "PUBMED" + ], + "lcsb.mapviewer.model.map.species.Ion": [ + "CHEBI", + "HMDB", + "KEGG_COMPOUND", + "PUBCHEM", + "PUBCHEM_SUBSTANCE", + "PUBMED" + ], + "lcsb.mapviewer.model.map.reaction.Reaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.reaction.type.HeterodimerAssociationReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.compartment.RightSquareCompartment": [ + "GO", + "MESH_2012", + "PUBMED" + ], + "lcsb.mapviewer.model.map.reaction.type.TranslationReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.reaction.type.UnknownPositiveInfluenceReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.reaction.type.ReducedModulationReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.species.AntisenseRna": [ + "PUBMED" + ], + "lcsb.mapviewer.model.map.species.Complex": [ + "CHEMBL_TARGET", + "EC", + "GO", + "INTERPRO", + "MESH_2012", + "PUBMED" + ], + "lcsb.mapviewer.model.map.species.Unknown": [ + "PUBMED" + ], + "lcsb.mapviewer.model.map.reaction.type.TruncationReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.compartment.LeftSquareCompartment": [ + "GO", + "MESH_2012", + "PUBMED" + ], + "lcsb.mapviewer.model.map.reaction.type.UnknownNegativeInfluenceReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.reaction.type.NegativeInfluenceReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.species.TruncatedProtein": [ + "CHEMBL_TARGET", + "EC", + "ENSEMBL", + "ENTREZ", + "HGNC", + "HGNC_SYMBOL", + "INTERPRO", + "KEGG_GENES", + "MGD", + "PANTHER", + "PUBMED", + "REFSEQ", + "UNIPROT", + "UNIPROT_ISOFORM" + ], + "lcsb.mapviewer.model.map.compartment.Compartment": [ + "GO", + "MESH_2012", + "PUBMED" + ], + "lcsb.mapviewer.model.map.compartment.TopSquareCompartment": [ + "GO", + "MESH_2012", + "PUBMED" + ], + "lcsb.mapviewer.model.map.species.Species": [ + "PUBMED" + ], + "lcsb.mapviewer.model.map.species.Rna": [ + "ENSEMBL", + "ENTREZ", + "HGNC", + "HGNC_SYMBOL", + "KEGG_GENES", + "MGD", + "PANTHER", + "PUBMED", + "REFSEQ", + "UNIPROT" + ], + "lcsb.mapviewer.model.map.reaction.type.KnownTransitionOmittedReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ], + "lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction": [ + "KEGG_PATHWAY", + "KEGG_REACTION", + "PUBMED", + "REACTOME" + ] + }, + "element-annotators": { + "lcsb.mapviewer.model.map.reaction.type.UnknownReducedTriggerReaction": [ + ], + "lcsb.mapviewer.model.map.compartment.BottomSquareCompartment": [ + "Gene Ontology" + ], + "lcsb.mapviewer.model.map.reaction.type.ReducedPhysicalStimulationReaction": [ + ], + "lcsb.mapviewer.model.map.species.Chemical": [ + "Chebi" + ], + "lcsb.mapviewer.model.map.species.Degraded": [ + ], + "lcsb.mapviewer.model.map.compartment.PathwayCompartment": [ + "Gene Ontology" + ], + "lcsb.mapviewer.model.map.species.SimpleMolecule": [ + "Chebi" + ], + "lcsb.mapviewer.model.map.reaction.type.BooleanLogicGateReaction": [ + ], + "lcsb.mapviewer.model.map.species.ReceptorProtein": [ + "Biocompendium", + "HGNC" + ], + "lcsb.mapviewer.model.map.reaction.type.UnknownTransitionReaction": [ + ], + "lcsb.mapviewer.model.map.reaction.type.TranscriptionReaction": [ + ], + "lcsb.mapviewer.model.map.species.Gene": [ + "HGNC" + ], + "lcsb.mapviewer.model.map.compartment.OvalCompartment": [ + "Gene Ontology" + ], + "lcsb.mapviewer.model.map.reaction.type.PositiveInfluenceReaction": [ + ], + "lcsb.mapviewer.model.map.reaction.type.ReducedTriggerReaction": [ + ], + "lcsb.mapviewer.model.map.species.Protein": [ + "Biocompendium", + "HGNC" + ], + "lcsb.mapviewer.model.map.reaction.type.UnknownReducedPhysicalStimulationReaction": [ + ], + "lcsb.mapviewer.model.map.BioEntity": [ + ], + "lcsb.mapviewer.model.map.species.GenericProtein": [ + "Biocompendium", + "HGNC" + ], + "lcsb.mapviewer.model.map.reaction.type.TransportReaction": [ + ], + "lcsb.mapviewer.model.map.species.IonChannelProtein": [ + "Biocompendium", + "HGNC" + ], + "lcsb.mapviewer.model.map.reaction.type.UnknownReducedModulationReaction": [ + ], + "lcsb.mapviewer.model.map.species.Phenotype": [ + "Gene Ontology" + ], + "lcsb.mapviewer.model.map.species.Drug": [ + ], + "lcsb.mapviewer.model.map.species.Element": [ + ], + "lcsb.mapviewer.model.map.reaction.type.DissociationReaction": [ + ], + "lcsb.mapviewer.model.map.compartment.SquareCompartment": [ + "Gene Ontology" + ], + "lcsb.mapviewer.model.map.species.Ion": [ + "Chebi" + ], + "lcsb.mapviewer.model.map.reaction.Reaction": [ + ], + "lcsb.mapviewer.model.map.reaction.type.HeterodimerAssociationReaction": [ + ], + "lcsb.mapviewer.model.map.compartment.RightSquareCompartment": [ + "Gene Ontology" + ], + "lcsb.mapviewer.model.map.reaction.type.TranslationReaction": [ + ], + "lcsb.mapviewer.model.map.reaction.type.UnknownPositiveInfluenceReaction": [ + ], + "lcsb.mapviewer.model.map.reaction.type.ReducedModulationReaction": [ + ], + "lcsb.mapviewer.model.map.species.AntisenseRna": [ + ], + "lcsb.mapviewer.model.map.species.Complex": [ + "Gene Ontology" + ], + "lcsb.mapviewer.model.map.species.Unknown": [ + ], + "lcsb.mapviewer.model.map.reaction.type.TruncationReaction": [ + ], + "lcsb.mapviewer.model.map.compartment.LeftSquareCompartment": [ + "Gene Ontology" + ], + "lcsb.mapviewer.model.map.reaction.type.UnknownNegativeInfluenceReaction": [ + ], + "lcsb.mapviewer.model.map.reaction.type.NegativeInfluenceReaction": [ + ], + "lcsb.mapviewer.model.map.species.TruncatedProtein": [ + "Biocompendium", + "HGNC" + ], + "lcsb.mapviewer.model.map.compartment.Compartment": [ + "Gene Ontology" + ], + "lcsb.mapviewer.model.map.compartment.TopSquareCompartment": [ + "Gene Ontology" + ], + "lcsb.mapviewer.model.map.species.Species": [ + ], + "lcsb.mapviewer.model.map.species.Rna": [ + "HGNC" + ], + "lcsb.mapviewer.model.map.reaction.type.KnownTransitionOmittedReaction": [ + ], + "lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction": [ + ] + }, + "project-upload": { + "auto-resize": false, + "sbgn": false, + "cache-data": true, + "semantic-zooming": false, + "annotate-model": false, + "validate-miriam": false + } +} \ No newline at end of file diff --git a/persist/src/db/11.1.0/fix_db_20170829.sql b/persist/src/db/11.1.0/fix_db_20170829.sql index c5d18a2ac2cca017e749cd449d76970d507c4047..43eead655e216bcbb59e7ed06b9e8befea12e27b 100644 --- a/persist/src/db/11.1.0/fix_db_20170829.sql +++ b/persist/src/db/11.1.0/fix_db_20170829.sql @@ -4,3 +4,10 @@ alter table user_annotation_schema_table add column autoresizemap boolean defaul alter table user_annotation_schema_table add column cachedata boolean default true; alter table user_annotation_schema_table add column semanticzooming boolean default false; alter table class_required_annotation_table RENAME column requireatlestoneannotation to requireatleastoneannotation; + +-- rename config annotation class name +update class_annotator_table set classname ='lcsb.mapviewer.model.map.BioEntity' where classname ='lcsb.mapviewer.model.map.AnnotatedObject'; +update class_required_annotation_table set classname ='lcsb.mapviewer.model.map.BioEntity' where classname ='lcsb.mapviewer.model.map.AnnotatedObject'; +update class_valid_annotation_table set classname ='lcsb.mapviewer.model.map.BioEntity' where classname ='lcsb.mapviewer.model.map.AnnotatedObject'; + + diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/users/UserRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/users/UserRestImpl.java index 0ed3cd9889fe6e0510dbe6773e1e5e8146a50b03..b3dbe1354330db2b53e19797776072ead5ffca71 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/users/UserRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/users/UserRestImpl.java @@ -128,7 +128,7 @@ public class UserRestImpl extends BaseRestImpl { private Map<String, Object> prepareValidAnnotations(List<UserClassValidAnnotations> classValidAnnotators) { Map<String, Object> result = new HashMap<>(); for (UserClassValidAnnotations userClassAnnotators : classValidAnnotators) { - result.put(userClassAnnotators.getClassName(), userClassAnnotators.getValidMiriamTypes()); + result.put(userClassAnnotators.getClassName(), new ArrayList<>(userClassAnnotators.getValidMiriamTypes())); } return result; } @@ -158,7 +158,12 @@ public class UserRestImpl extends BaseRestImpl { for (UserClassRequiredAnnotations requiredAnnotations : classRequiredAnnotators) { Map<String, Object> row = new HashMap<>(); row.put("require-at-least-one", requiredAnnotations.getRequireAtLeastOneAnnotation()); - row.put("annotation-list", requiredAnnotations.getRequiredMiriamTypes()); + List<String> miriamTypes = new ArrayList<>(); + + for (MiriamType mt : requiredAnnotations.getRequiredMiriamTypes()) { + miriamTypes.add(mt.name()); + } + row.put("annotation-list", miriamTypes); result.put(requiredAnnotations.getClassName(), row); } return result; @@ -200,7 +205,7 @@ public class UserRestImpl extends BaseRestImpl { private Map<String, Object> prepareElementAnnotators(List<UserClassAnnotators> classAnnotators) { Map<String, Object> result = new HashMap<>(); for (UserClassAnnotators userClassAnnotators : classAnnotators) { - result.put(userClassAnnotators.getClassName(), userClassAnnotators.getAnnotators()); + result.put(userClassAnnotators.getClassName(), new ArrayList<>(userClassAnnotators.getAnnotators())); } return result; }