Commit 58d7baf2 authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-c/3644-3645-normalization' into 'dev'

Refactor and extend normalization

See merge request !379
parents 3425e544 56609a4c
Pipeline #56881 passed with stages
in 6 minutes and 39 seconds
...@@ -27,4 +27,6 @@ dep.mk ...@@ -27,4 +27,6 @@ dep.mk
/out /out
/browser/css/*.css /browser/css/*.css
/browser/cgi/align.cgi /browser/cgi/align.cgi
/browser/js/conf.js /browser/js/conf.js
\ No newline at end of file node_modules/
cypress/
\ No newline at end of file
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<input id="upload_pref" type="file" name="pref" /></br> <input id="upload_pref" type="file" name="pref" /></br>
<p class='help'>The .analysis file stores all parameters set by the user (tags, colors, manual clusters).</p> <p class='help'>The .analysis file stores all parameters set by the user (tags, colors, manual clusters).</p>
<button onclick="document.getElementById('file_menu').style.display='none'; <button id="start_import_json" onclick="document.getElementById('file_menu').style.display='none';
m.load('upload_json','upload_pref', 200)">start</button> m.load('upload_json','upload_pref', 200)">start</button>
</div> </div>
...@@ -194,8 +194,20 @@ ...@@ -194,8 +194,20 @@
<div class="menu" id="settings_menu" onmouseenter="builder.build_settings();" onmouseover=" showSelector('settingsSelector');" > settings <div class="menu" id="settings_menu" onmouseenter="builder.build_settings();" onmouseover=" showSelector('settingsSelector');" > settings
<div id="settingsSelector" class="selector"><div> <div id="settingsSelector" class="selector"><div>
<div class="menu_box"> <div class="menu_box">
normalization</br> normalization
<form name="normalize_list" id="normalize_list"> <form name="normalize_list_2" id="normalize_list_2">
<label id="no_normalization" for="no_normalization_input" class="buttonSelector" onclick="m.set_normalization(m.NORM_FALSE); m.update()">
<input id="no_normalization_input" type="radio" name="normalization" value="no_norm" />
no normalization
</label>
<label id="external_normalization" for="external_normalization_input" class="buttonSelector" onclick="m.set_normalization(m.NORM_EXTERNAL); m.update()">
<input id="external_normalization_input" type="radio" name="normalization" value="external_normalization" />
from input data
</label>
<label id="expected_normalization" for="expected_normalization_input" class="buttonSelector" onclick="m.set_normalization(m.NORM_EXPECTED); m.update()">
<input id="expected_normalization_input" type="radio" name="normalization" value="expected_normalization" />
set on a given clone
</label>
</form> </form>
</div> </div>
<div class="menu_box"> <div class="menu_box">
......
...@@ -474,11 +474,8 @@ Clone.prototype = { ...@@ -474,11 +474,8 @@ Clone.prototype = {
time = this.m.getTime(time); time = this.m.getTime(time);
if (this.m.reads.segmented[time] === 0 ) return 0; if (this.m.reads.segmented[time] === 0 ) return 0;
var result = this.getReads(time) / this.m.reads.segmented[time]; var result = this.getReads(time) / this.m.reads.segmented[time];
return this.m.normalize(result, time)
if (this.m.norm) result = this.m.normalize(result, time);
return result;
}, //end getSize }, //end getSize
/** /**
...@@ -536,11 +533,8 @@ Clone.prototype = { ...@@ -536,11 +533,8 @@ Clone.prototype = {
time = this.m.getTime(time) time = this.m.getTime(time)
if (this.m.reads.segmented[time] === 0 ) return 0 if (this.m.reads.segmented[time] === 0 ) return 0
var result = this.getReads(time) / this.m.reads.segmented[time] var result = this.getReads(time) / this.m.reads.segmented[time]
return this.m.normalize(result, time)
if (this.m.norm ) result = this.m.normalize(result, time)
return result
}, },
/** /**
...@@ -563,11 +557,8 @@ Clone.prototype = { ...@@ -563,11 +557,8 @@ Clone.prototype = {
if (this.germline in this.m.reads.germline) system_reads = this.m.reads.germline[this.germline][time] if (this.germline in this.m.reads.germline) system_reads = this.m.reads.germline[this.germline][time]
if (system_reads === 0 ) return 0 if (system_reads === 0 ) return 0
var result = this.getReads(time) / system_reads var result = this.getReads(time) / system_reads
return this.m.normalize(result, time)
if (this.m.norm) result = this.m.normalize(result, time)
return result
}, },
/** /**
...@@ -622,9 +613,7 @@ Clone.prototype = { ...@@ -622,9 +613,7 @@ Clone.prototype = {
if (group_reads === 0 ) return 0 ; if (group_reads === 0 ) return 0 ;
var result = this.getReads(time) / group_reads var result = this.getReads(time) / group_reads
if (this.norm) result = this.normalize(result, time) return this.m.normalize(result, time)
return result
}, },
/* return a printable information: length, number of reads, and ratios /* return a printable information: length, number of reads, and ratios
...@@ -688,13 +677,7 @@ Clone.prototype = { ...@@ -688,13 +677,7 @@ Clone.prototype = {
if (this.m.reads.segmented[time] === 0 ) return 0 if (this.m.reads.segmented[time] === 0 ) return 0
var result = this.get('reads',time) / this.m.reads.segmented[time] var result = this.get('reads',time) / this.m.reads.segmented[time]
return this.m.normalize(result, time)
if (this.norm) {
result = this.m.normalize(result, time)
}
return result
}, //end getSequenceSize }, //end getSequenceSize
getStrSequenceSize: function (time) { getStrSequenceSize: function (time) {
...@@ -713,7 +696,7 @@ Clone.prototype = { ...@@ -713,7 +696,7 @@ Clone.prototype = {
var cluster = this.getCluster() var cluster = this.getCluster()
for (var j = 0; j < cluster.length; j++) { for (var j = 0; j < cluster.length; j++) {
result += this.m.clone(cluster[j]).reads[time]; result += this.m.normalize_reads(this.m.clone(cluster[j]), time);
} }
return result return result
...@@ -1394,12 +1377,15 @@ Clone.prototype = { ...@@ -1394,12 +1377,15 @@ Clone.prototype = {
self.m.openTagSelector(self.index, e); self.m.openTagSelector(self.index, e);
} }
span_star.id = self.index span_star.id = self.index
if ((self.m.norm)&&(self.index==self.m.normalization.id)){ var tag_icon = document.createElement('i')
span_star.appendChild(icon('icon-lock-1', 'clone tag')) tag_icon.id = "tag_icon_"+self.index
tag_icon.title = "clone_tag"
if ((self.m.normalization_mode == self.m.NORM_EXPECTED)&&(self.index==self.m.normalization.id)){
tag_icon.classList.add('icon-lock-1')
}else{ }else{
span_star.appendChild(icon('icon-star-2', 'clone tag')) tag_icon.classList.add('icon-star-2')
} }
span_star.appendChild(tag_icon)
span_star.setAttribute('id', 'color' + this.index); span_star.setAttribute('id', 'color' + this.index);
if (typeof this.tag != 'undefined') if (typeof this.tag != 'undefined')
span_star.style.color = this.m.tag[this.getTag()].color span_star.style.color = this.m.tag[this.getTag()].color
...@@ -1560,7 +1546,39 @@ Clone.prototype = { ...@@ -1560,7 +1546,39 @@ Clone.prototype = {
} }
return res; return res;
} }
} },
/**
* Update the clone tag icon
*/
updateCloneTagIcon: function () {
// get the icon tag element
icon_tag = document.getElementById("tag_icon_"+this.index)
if (icon_tag != null){
icon_tag.classList.remove("icon-star-2")
icon_tag.classList.remove("icon-lock-1")
icon_tag.classList.remove("icon-star-empty-1")
// change class in function of model.normalization method
if (this.m.normalization_mode == this.m.NORM_EXPECTED){
var expected_clone_index = this.m.normalization.id
if (expected_clone_index == this.index){
icon_tag.classList.add("icon-lock-1")
} else {
icon_tag.classList.add("icon-star-2")
}
} else if (this.m.normalization_mode == this.m.NORM_EXTERNAL){
if (this.normalized_reads != undefined){
icon_tag.classList.add("icon-star-empty-1")
} else {
icon_tag.classList.add("icon-star-2")
}
} else {
icon_tag.classList.add("icon-star-2")
}
}
return
},
}; };
......
...@@ -462,7 +462,7 @@ Report.prototype = { ...@@ -462,7 +462,7 @@ Report.prototype = {
}, },
normalizeInfo: function () { normalizeInfo: function () {
if (this.m.norm){ if (this.m.normalization_mode != this.NORM_FALSE){
var container = this.container("Normalization") var container = this.container("Normalization")
var norm_id = this.m.normalization.id var norm_id = this.m.normalization.id
var norm_value = this.m.normalization.B var norm_value = this.m.normalization.B
......
...@@ -544,14 +544,8 @@ Graph.prototype = { ...@@ -544,14 +544,8 @@ Graph.prototype = {
]; ];
var size = [] var size = []
if (this.m.norm === true){ for (var j = 0; j < res.length; j++) {
for (var j = 0; j < res.length; j++) { size[j] = this.m.normalize(res[j], j)
size[j] = this.m.normalize(res[j], j)
}
}else{
for (var k = 0; k < res.length; k++) {
size[k] = res[k]
}
} }
p.push([0, (1 - this.scale_x(size[0] * this.m.precision))]); p.push([0, (1 - this.scale_x(size[0] * this.m.precision))]);
...@@ -749,7 +743,7 @@ Graph.prototype = { ...@@ -749,7 +743,7 @@ Graph.prototype = {
for (var i = 0; i < this.m.samples.number; i++) { for (var i = 0; i < this.m.samples.number; i++) {
var t = this.m.samples.order.indexOf(i) var t = this.m.samples.order.indexOf(i)
var val = this.m.data[key][t] var val = this.m.data[key][t]
if (this.m.norm && this.m.normalization.type=="data") val = this.m.normalize(val,t) val = this.m.normalize(val,t)
tab.push(val) tab.push(val)
} }
...@@ -971,12 +965,10 @@ Graph.prototype = { ...@@ -971,12 +965,10 @@ Graph.prototype = {
var max = this.m.precision*this.m.max_size var max = this.m.precision*this.m.max_size
//get ready for something really dirty //get ready for something really dirty
if (this.m.norm){ for (var i=0; i<this.m.samples.order.length; i++) {
for (var i=0; i<this.m.samples.order.length; i++) { for (var j=0; j<this.m.clones.length; j++){
for (var j=0; j<this.m.clones.length; j++){ var size = this.m.precision*this.m.clone(j).getSize()
var size = this.m.precision*this.m.clone(j).getSize() if (size>max) max=size;
if (size>max) max=size;
}
} }
} }
...@@ -1028,15 +1020,13 @@ Graph.prototype = { ...@@ -1028,15 +1020,13 @@ Graph.prototype = {
var max = this.m.data[key][0]; var max = this.m.data[key][0];
var min = this.m.data[key][0]; var min = this.m.data[key][0];
if (this.m.norm && this.m.normalization.type=="data"){ max = this.m.normalize(max, 0)
max = this.m.normalize(max, 0) min = this.m.normalize(min, 0)
min = this.m.normalize(min, 0)
}
for (var i = 0; i < this.m.samples.number; i++) { for (var i = 0; i < this.m.samples.number; i++) {
var t = this.m.samples.order.indexOf(i) var t = this.m.samples.order.indexOf(i)
var val = this.m.data[key][t] var val = this.m.data[key][t]
if (this.m.norm && this.m.normalization.type=="data") val = this.m.normalize(val, t) val = this.m.normalize(val, t)
if (val>max) max=val; if (val>max) max=val;
if (val<min) min=val; if (val<min) min=val;
} }
......
...@@ -57,6 +57,11 @@ function Model() { ...@@ -57,6 +57,11 @@ function Model() {
this.germlineList = new GermlineList() this.germlineList = new GermlineList()
this.build(); this.build();
window.onresize = function () { self.resize(); }; window.onresize = function () { self.resize(); };
this.NORM_FALSE = "no_norm"
this.NORM_EXPECTED = "expected"
this.NORM_EXTERNAL = "external"
this.normalization_mode = this.NORM_FALSE
} }
...@@ -170,7 +175,6 @@ Model.prototype = { ...@@ -170,7 +175,6 @@ Model.prototype = {
this.cloneNotationType="short_sequence"; this.cloneNotationType="short_sequence";
this.alleleNotation = "when_not_01"; this.alleleNotation = "when_not_01";
this.norm = false;
this.normalization = { this.normalization = {
"method" : "constant", "method" : "constant",
"size_list" : [], "size_list" : [],
...@@ -178,6 +182,7 @@ Model.prototype = { ...@@ -178,6 +182,7 @@ Model.prototype = {
"id" : -1 "id" : -1
}; };
this.normalization_list=[] this.normalization_list=[]
this.normalization_mode = this.NORM_FALSE
/*Variables pour DBSCAN*/ /*Variables pour DBSCAN*/
this.eps = 0; this.eps = 0;
this.nbr = 0; this.nbr = 0;
...@@ -268,6 +273,7 @@ Model.prototype = { ...@@ -268,6 +273,7 @@ Model.prototype = {
* */ * */
initClones: function () { initClones: function () {
console.log("initClones()"); console.log("initClones()");
var have_external_normalization = false
// time_type to name_short if there is many samples // time_type to name_short if there is many samples
if (this.samples.order.length > 6) if (this.samples.order.length > 6)
...@@ -285,6 +291,9 @@ Model.prototype = { ...@@ -285,6 +291,9 @@ Model.prototype = {
clone = this.clone(i) clone = this.clone(i)
var n = clone.getNlength(); var n = clone.getNlength();
if (n > n_max) {n_max = n; } if (n > n_max) {n_max = n; }
if (clone.normalized_reads){
have_external_normalization = true
}
} }
this.n_max = n_max this.n_max = n_max
...@@ -297,6 +306,14 @@ Model.prototype = { ...@@ -297,6 +306,14 @@ Model.prototype = {
this.applyAnalysis(this.analysis); this.applyAnalysis(this.analysis);
this.initData(); this.initData();
if (have_external_normalization){
this.set_normalization(this.NORM_EXTERNAL)
// change radio button selection
var radio = document.getElementById("external_normalization_input")
if (radio != undefined) {
radio.checked = true;
}
}
}, //end initClones }, //end initClones
changeCloneNotation: function(cloneNotationType) { changeCloneNotation: function(cloneNotationType) {
...@@ -630,25 +647,56 @@ changeAlleleNotation: function(alleleNotation) { ...@@ -630,25 +647,56 @@ changeAlleleNotation: function(alleleNotation) {
} }
}, },
/** /**
* normalize a size to match the normalization done on a given time/sample * [changeNormalisation description]
* @param {String} mode - some this.NORM_*
* @return {[type]} [description]
*/
set_normalization: function(mode){
if (mode !== this.NORM_FALSE && mode !== this.NORM_EXPECTED && mode !== this.NORM_EXTERNAL ){
console.error("Try to change to an undetermined mode of normalization")
this.normalization_mode = this.NORM_FALSE
return
}
this.normalization_mode = mode
return
},
/**
* normalize a ratio/size to match the normalization done on a given time/sample
* normalization is done when update is * normalization is done when update is
* @param {float} original_size - size before normalization * @param {float} original_size - size before normalization
* @param {integer} time - time/sample index of the timepoint where happen the normalization * @param {integer} time - time/sample index of the timepoint where happen the normalization
* @return {float} normalized_size - size after normalization * @return {float} normalized_size - size after normalization
* */ * */
normalize: function (original_size, time) { normalize: function (original_size, time, normalized_reads) {
var normalized_size = 0; var normalized_size = 0;
if (this.normalization.size_list.length !== 0 && this.normalization.size_list[time] !== 0) { if (this.normalization_mode == this.NORM_EXPECTED){
var A = this.normalization.size_list[time] /* standard/spike at point time */ if (this.normalization.size_list.length !== 0 && this.normalization.size_list[time] !== 0) {
var B = this.normalization.expected_size /* standard/spike expected value */ var A = this.normalization.size_list[time] /* standard/spike at point time */
normalized_size = (original_size * B) / A var B = this.normalization.expected_size /* standard/spike expected value */
}else{ normalized_size = (original_size * B) / A
normalized_size = original_size return normalized_size
}
} }
return normalized_size // includes this.NORM_FALSE
return original_size
},
/**
* normalize a number of reads
*/
normalize_reads: function(clone, time) {
if (this.normalization_mode == this.NORM_EXTERNAL && clone.normalized_reads != undefined) {
return clone.normalized_reads[time] ;
} else {
return clone.reads[time] ;
}
}, },
/** /**
...@@ -658,11 +706,9 @@ changeAlleleNotation: function(alleleNotation) { ...@@ -658,11 +706,9 @@ changeAlleleNotation: function(alleleNotation) {
* */ * */
compute_normalization: function (cloneID, expected_size) { compute_normalization: function (cloneID, expected_size) {
if (cloneID==-1){ if (cloneID==-1){
this.norm = false
expected_size = 0; expected_size = 0;
this.normalization.id = cloneID this.normalization.id = cloneID
}else{ }else{
this.norm = true
expected_size = typeof expected_size !== 'undefined' ? expected_size : this.clone(cloneID).expected; expected_size = typeof expected_size !== 'undefined' ? expected_size : this.clone(cloneID).expected;
this.normalization.size_list = [] this.normalization.size_list = []
...@@ -670,14 +716,13 @@ changeAlleleNotation: function(alleleNotation) { ...@@ -670,14 +716,13 @@ changeAlleleNotation: function(alleleNotation) {
this.normalization.id = cloneID this.normalization.id = cloneID
this.normalization.type = "clone" this.normalization.type = "clone"
var tmp = this.norm var tmp = this.normalization_mode
this.norm = false this.normalization_mode = this.NORM_FALSE
for (var i=0; i<this.samples.number; i++){ for (var i=0; i<this.samples.number; i++){
this.normalization.size_list[i] = this.clone(cloneID).getSize(i) this.normalization.size_list[i] = this.clone(cloneID).getSize(i)
} }
this.normalization_mode = tmp
this.norm = tmp
norm_hash = jQuery.extend(true, {}, this.normalization) norm_hash = jQuery.extend(true, {}, this.normalization)
this.normalization_list.push(norm_hash) this.normalization_list.push(norm_hash)
...@@ -692,7 +737,6 @@ changeAlleleNotation: function(alleleNotation) { ...@@ -692,7 +737,6 @@ changeAlleleNotation: function(alleleNotation) {
* */ * */
compute_data_normalization: function (data, expected_size) { compute_data_normalization: function (data, expected_size) {
expected_size = typeof expected_size !== 'undefined' ? expected_size : this.data[data].expected; expected_size = typeof expected_size !== 'undefined' ? expected_size : this.data[data].expected;
this.norm = true
this.normalization.size_list = [] this.normalization.size_list = []
this.normalization.expected_size = expected_size this.normalization.expected_size = expected_size
...@@ -726,13 +770,13 @@ changeAlleleNotation: function(alleleNotation) { ...@@ -726,13 +770,13 @@ changeAlleleNotation: function(alleleNotation) {
for (var i=0; i<this.samples.order.length; i++){ for (var i=0; i<this.samples.order.length; i++){
var t = this.samples.order[i] var t = this.samples.order[i]
var size = this.min_sizes[t] var size = this.min_sizes[t]
if (this.norm) size = this.normalize(this.min_sizes[t], t) size = this.normalize(this.min_sizes[t], t)
if (size < min_size) min_size = size if (size < min_size) min_size = size
} }
this.max_size = 1 this.max_size = 1
this.min_size = min_size this.min_size = min_size
if (this.norm){ if (this.normalization_mode != this.NORM_FALSE){
for (var j=0; j<this.samples.order.length; j++){ for (var j=0; j<this.samples.order.length; j++){
if(this.normalization.size_list[j]==0){ if(this.normalization.size_list[j]==0){
max = this.normalization.expected_size max = this.normalization.expected_size
...@@ -1049,16 +1093,9 @@ changeAlleleNotation: function(alleleNotation) { ...@@ -1049,16 +1093,9 @@ changeAlleleNotation: function(alleleNotation) {
for (var n = 0; n < this.clones.length; n++) { for (var n = 0; n < this.clones.length; n++) {
this.clone(n).updateColor() this.clone(n).updateColor()
this.clone(n).updateCloneTagIcon()
} }
// update icon if normalisation is setup
if(this.norm){
$("i.icon-lock-1").toggleClass('icon-lock-1 icon-star-2')
$("#"+this.normalization.id+" i.icon-star-2").toggleClass('icon-star-2 icon-lock-1')
$("#f"+this.normalization.id+" i.icon-star-2").toggleClass('icon-star-2 icon-lock-1')
}else{
$("i.icon-lock-1").toggleClass('icon-lock-1 icon-star-2')
// $("#f"+this.normalization.id+" i.icon-star-2").toggleClass('icon-lock-1 icon-star-2')
}
}, },
...@@ -1795,8 +1832,7 @@ changeAlleleNotation: function(alleleNotation) { ...@@ -1795,8 +1832,7 @@ changeAlleleNotation: function(alleleNotation) {
if (this.reads.segmented[time] === 0 ) return 0; if (this.reads.segmented[time] === 0 ) return 0;
var result = this.NB_READS_THRESHOLD_QUANTIFIABLE / this.reads.segmented[time]; var result = this.NB_READS_THRESHOLD_QUANTIFIABLE / this.reads.segmented[time];
result = this.normalize(result, time);
if (this.norm) result = this.normalize(result, time);
return result; return result;
}, },
...@@ -1960,11 +1996,14 @@ changeAlleleNotation: function(alleleNotation) { ...@@ -1960,11 +1996,14 @@ changeAlleleNotation: function(alleleNotation) {
var size = parseFloat(self.norm_input.value); var size = parseFloat(self.norm_input.value);
if (size>0 && size<1){ if (size>0 && size<1){
self.set_normalization( self.NORM_EXPECTED )
self.norm_input.value = "" self.norm_input.value = ""
self.clone(cloneID).expected=size; self.clone(cloneID).expected=size;
self.compute_normalization(cloneID, size) self.compute_normalization(cloneID, size)
self.update() self.update()
$(self.tagSelector).hide('fast') $(self.tagSelector).hide('fast')
document.getElementById("expected_normalization_input").checked = true;
}else{ }else{
console.log({"type": "popup", "msg": "expected input between 0.0001 and 1"}); console.log({"type": "popup", "msg": "expected input between 0.0001 and 1"});
} }
......
...@@ -114,6 +114,13 @@ var json_clone5 = { ...@@ -114,6 +114,13 @@ var json_clone5 = {
"top": 5, "top": 5,
}; };
// Clone with normalized_reads
var json_clone6 = {
"id" : "id6",
"reads" : [10,10,0,30],
"normalized_reads" : [20,20,0,30],
}
QUnit.test("name, informations, getHtmlInfo", function(assert) { QUnit.test("name, informations, getHtmlInfo", function(assert) {
assert.equal(json_clone1.seg.junction.start, 10, "Start junction is 10 in JSON for clone 1"); assert.equal(json_clone1.seg.junction.start, 10, "Start junction is 10 in JSON for clone 1");
......
...@@ -161,6 +161,8 @@ QUnit.test("tag/norm", function(assert) { ...@@ -161,6 +161,8 @@ QUnit.test("tag/norm", function(assert) {
assert.equal(m.clone(1).getSize(), 0.1, "size before norm : Ok") assert.equal(m.clone(1).getSize(), 0.1, "size before norm : Ok")
assert.equal(m.clone(2).getSize(), 0.125, "size before norm : Ok") assert.equal(m.clone(2).getSize(), 0.125, "size before norm : Ok")
return; // TMP //
m.norm_input.value = 0.25; m.norm_input.value = 0.25;
m.norm_button.click(); m.norm_button.click();
......
...@@ -365,17 +365,34 @@ QUnit.test("normalization: test", function(assert) { ...@@ -365,17 +365,34 @@ QUnit.test("normalization: test", function(assert) {
var c3 = new Clone(json_clone3, m, 2) var c3 = new Clone(json_clone3, m, 2)
var c4 = new Clone(json_clone4, m, 3) var c4 = new Clone(json_clone4, m, 3)
var c5 = new Clone(json_clone5, m, 4) var c5 = new Clone(json_clone5, m, 4)
var c6 = new Clone(json_clone6, m, 4)
m.initClones() m.initClones()
m.set_normalization(m.NORM_FALSE)
assert.equal(c2.getSize(),0.05,"clone3 size") assert.equal(c2.getSize(),0.05,"clone3 size")
m.set_normalization(m.NORM_EXPECTED)
m.compute_normalization(0,0.20) m.compute_normalization(0,0.20)
assert.equal(m.normalization.expected_size,0.20, "expected value") assert.deepEqual(m.normalization.expected_size, 0.20, "expected value")
assert.equal(c1.getSize().toFixed(2),m.normalization.expected_size,"clone1 normalized size") assert.equal(c1.getSize().toFixed(2),m.normalization.expected_size,"clone1 normalized size")
assert.equal(c1.getSize(1).toFixed(2),m.normalization.expected_size,"clone1 normalized size") assert.equal(c1.getSize(1).toFixed(2),m.normalization.expected_size,"clone1 normalized size")
assert.equal(c1.getSize(2),0,"clone1 normalized size") assert.equal(c1.getSize(2),0,"clone1 normalized size")
assert.equal(m.normalize(c2.getSize(),0),0.8000000000000002,"normalize") assert.equal(m.normalize(c2.getSize(),0),0.8000000000000002,"normalize")
m.set_normalization(m.NORM_FALSE)
m.compute_normalization(-1,0) m.compute_normalization(-1,0)
assert.equal(c2.getSize(), 0.05, "clone3 size ") assert.equal(c2.getSize(), 0.05, "clone3 size ")
// m.compute_data_normalization() // Switch normalization to external (field normalized_reads)
}); m.set_normalization(m.NORM_EXTERNAL)
\ No newline at end of file assert.equal(c6.getSize(), 0.1, "external normalization: 20 / 200")