Skip to content
Snippets Groups Projects
Commit facee5d9 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

data about modifications from rest aPI is taken into account

parent 463083fe
No related branches found
No related tags found
1 merge request!68Resolve "Modification of proteins are not displayed"
......@@ -6,6 +6,7 @@ var logger = require('./logger');
var ConfigurationType = require('./ConfigurationType');
var MiriamType = require('./map/data/MiriamType');
var ModificationStateType = require('./map/data/ModificationStateType');
function Configuration(json) {
var self = this;
......@@ -46,6 +47,7 @@ function Configuration(json) {
self.setElementTypes(json.elementTypes);
self.setReactionTypes(json.reactionTypes);
self.setMiriamTypes(json.miriamTypes);
self.setModificationStateTypes(json.modificationStateTypes);
}
Configuration.prototype.setOption = function(type, value) {
......@@ -110,4 +112,24 @@ Configuration.prototype.getMiriamTypeByName = function(name) {
return null;
};
Configuration.prototype.setModificationStateTypes = function(modificationStateTypes) {
this._modificationStateTypes = [];
for ( var key in modificationStateTypes) {
if (modificationStateTypes.hasOwnProperty(key)) {
var typeData = modificationStateTypes[key];
this._modificationStateTypes.push(new ModificationStateType(typeData, key));
}
}
};
Configuration.prototype.getModificationStateTypeByName = function(name) {
var self = this;
for (var i = 0; i < self._modificationStateTypes.length; i++) {
var modificationStateType = self._modificationStateTypes[i];
if (modificationStateType.getName() === name) {
return modificationStateType;
}
}
return null;
};
module.exports = Configuration;
"use strict";
var ObjectWithListeners = require('../../ObjectWithListeners');
function ModificationStateType(data, name) {
// call super constructor
ObjectWithListeners.call(this);
var self = this;
self.setAbbreviation(data.abbreviation);
self.setName(name);
self.setCommonName(data.commonName);
}
ModificationStateType.prototype = Object.create(ObjectWithListeners.prototype);
ModificationStateType.prototype.constructor = ModificationStateType;
ModificationStateType.prototype.setName = function(name) {
this._name = name;
};
ModificationStateType.prototype.getName = function() {
return this._name;
};
ModificationStateType.prototype.setAbbreviation= function(abbreviation) {
this._abbreviation = abbreviation;
};
ModificationStateType.prototype.getAbbreviation = function() {
return this._abbreviation;
};
ModificationStateType.prototype.setCommonName = function(commonName) {
this._commonName = commonName;
};
ModificationStateType.prototype.getCommonName = function() {
return this._commonName;
};
module.exports = ModificationStateType;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment