Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 987b107f authored by Mikaël Salson's avatar Mikaël Salson

Clone: Every key in seg must be an object

When the seg[key] is not an object, we convert it to an object such as seg[key] = {'val': value}.
e-values were stored that way (without object).
parent ce221b32
......@@ -488,7 +488,7 @@ Clone.prototype = {
computeEValue: function () {
var e = this.seg['_evalue'];
if (typeof(e) != 'undefined')
this.eValue = parseFloat(e)
this.eValue = parseFloat(e['val'])
else
this.eValue = undefined
},
......
......@@ -594,16 +594,19 @@ Model_loader.prototype = {
var newSeg = {};
for (key in seg) {
var firstChar = key.substring(0, 1);
if ((segMapping.indexOf(firstChar) != -1 && typeof seg[firstChar] != 'object')
|| typeof seg[key] != 'object') {
if (segMapping.indexOf(firstChar) != -1 && typeof seg[firstChar] != 'object') {
if (typeof newSeg[firstChar] == 'undefined') {
newSeg[firstChar] = this.getConvertedSeg(seg, firstChar);
}
key = firstChar
} else {
newSeg[key] = seg[key];
}
if (typeof newSeg[key] == 'object') {
newSeg[key] = this.getConvertedSegNames(newSeg[key])
} else {
// We must have an object
newSeg[key] = {'val': newSeg[key]}
}
}
return newSeg;
......
......@@ -8,6 +8,7 @@ test("model: convert", function () {
"3start": 3,
"3": "J",
"4": "D",
"score": 42,
"5": {"name": "V", "stop": 0},
"cdr3": {"start": 0, "end": 3}
};
......@@ -18,7 +19,7 @@ test("model: convert", function () {
deepEqual(m.getConvertedSeg(seg, "3"), {"name": "J", "start": 3}, "getConvertedSeg: Ok");
deepEqual(m.convertSeg(json_clone3.seg), {"5": {"stop": 5}, "4": {"name": "IGHD2*03"}, "3": {"name": "IGHV4*01", "start": 15}, "junction": {"productive": false, "start": 2, "stop": 13}}, "convertSeg: Ok");
deepEqual(m.convertSeg(seg), {"3": {"name": "J", "start": 3}, "4": {"name": "D", "start": 1, "stop": 2}, "5": {"name": "V", "stop": 0}, "cdr3": {"start": 0, "stop": 3}}, "convertSeg: Ok");
deepEqual(m.convertSeg(seg), {"3": {"name": "J", "start": 3}, "4": {"name": "D", "start": 1, "stop": 2}, "5": {"name": "V", "stop": 0}, "score": {"val": 42}, "cdr3": {"start": 0, "stop": 3}}, "convertSeg: Ok");
});
test("model : load", function() {
......
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