Commit 53a9b3d8 authored by Thonier Florian's avatar Thonier Florian
Browse files

clone.js; adapt gethtmlinfo to use data from seg_xxx field

Update qunit testing
parent 1f582c56
Pipeline #274963 passed with stages
in 37 minutes and 18 seconds
......@@ -1563,16 +1563,20 @@ Clone.prototype = {
}
var row_cast_content = function(title, content) {
if ("info" in content) {
if (content == undefined) {
return ""
} else if (typeof(content) != "object") {
return row_1(title, content.toString())
} else if (Object.keys(content).indexOf("info") != -1) {
// Textual field
return row_1(title, content.info)
} else if ("name" in content) {
} else if (Object.keys(content).indexOf("name") != -1) {
// Textual field
return row_1(title, content.name)
} else if ("val" in content) {
} else if (Object.keys(content).indexOf("val") != -1) {
// Numerical field
return row_1(title, content.val)
} else if ("seq" in content) {
} else if (Object.keys(content).indexOf("seq") != -1) {
// Sequence field with pos
return row_1(title, content.seq)
} else {
......@@ -1773,8 +1777,7 @@ Clone.prototype = {
var exclude_seg_info = ['affectSigns', 'affectValues', '5', '4', '3']
for (var s in this.seg) {
if (exclude_seg_info.indexOf(s) == -1 &&
this.seg[s] instanceof Object &&
!s.includes("script_") ) {
this.seg[s] instanceof Object ) {
html += row_cast_content(s, this.seg[s])
}
}
......@@ -1800,17 +1803,14 @@ Clone.prototype = {
}
}
// Result of external script or tools
// Result of external tools (inside seg and already defined)
// Can't be bypass as already used
var other_infos = {"imgt": "<a target='_blank' href='http://www.imgt.org/IMGT_vquest/share/textes/'>IMGT/V-QUEST</a>",
"clonedb": "<a target='_blank' href='http://ecngs.vidjil.org/clonedb'>CloneDB</a> "+ (this.numberSampleSetInCloneDB() > 0 ? "<br /> A similar clone exists in "+this.numberSampleSetInCloneDB()+" other patients/runs/sets" : "")};
for (s in this.seg) {
if (this.seg[s] instanceof Object &&
s.includes("script_") || other_infos[s] != undefined ) {
if (other_infos[s] != undefined){ // External tools
html += header("Results of "+other_infos[s])
} else { // External scripts
html += header("Results of script '"+s.substring(7)+"'")
}
other_infos[s] != undefined ) {
html += header("Results of "+other_infos[s])
var keys = Object.keys(this.seg[s]).sort();
for (var key_seg = 0; key_seg < keys.length; key_seg++) {
var sub = keys[key_seg]
......@@ -1819,6 +1819,22 @@ Clone.prototype = {
}
}
// Result of external scripts (defined as seg_xxx)
// TODO: refactor with classic seg field
var this_keys = Object.keys(this).sort();
for (var thiskey_pos = 0; thiskey_pos < this_keys.length; thiskey_pos++) {
var thiskey = this_keys[thiskey_pos]
if (this[thiskey] instanceof Object &&
thiskey.indexOf("seg_") != -1 && thiskey != "seg_stat") {
html += header("Results of script '"+thiskey.substring(4)+"'")
var keys_seg = Object.keys(this[thiskey]).sort();
for (var key_segthis = 0; key_segthis < keys_seg.length; key_segthis++) {
var subthis = keys_seg[key_segthis]
html += row_cast_content(subthis, this[thiskey][subthis])
}
}
}
html += "</table></div>"
return html
},
......
......@@ -392,17 +392,16 @@ QUnit.test("getHtmlInfo; feature from script", function(assert) {
var c1 = new Clone(json_clone1, m, 0, c_attributes)
m.initClones()
m.clones[0].seg = {
"script_AAA": {
"5": {"stop": 99, "name": "IGHV3-11*01", "delRight": 3 },
"evalue_right": {"val": "7.79e-111"}
},
"script_BBB": {
"feature_val": {"val": "7.79e-111"},
"feature_str": {"info": "a feature value"},
"feature_seq": {"seq": "CARLY" },
}
m.clones[0].seg_AAA = {
"5": {"stop": 99, "name": "IGHV3-11*01", "delRight": 3 },
"evalue_right": {"val": "7.79e-111"}
}
m.clones[0].seg_BBB = {
"feature_val": {"val": "7.79e-111"},
"feature_str": {"info": "a feature value"},
"feature_seq": {"seq": "CARLY" },
}
html_script = m.clones[0].getHtmlInfo();
console.log( html_script)
console.log( m.clones[0].sequence)
......
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