Commit ba8ca42e authored by Mathieu Giraud's avatar Mathieu Giraud

model.js, clone.js: do not compute size ratios when there are too few reads

It does not make much sense to compute ratios below a given number of reads.
We prefer to label the clone as 'positive, but not quantifiable'.
parent a4bd220e
......@@ -192,8 +192,9 @@ Clone.prototype = {
* @return {string} size
* */
getStrSize: function (time) {
var size = this.getSize(this.m.getTime(time));
return this.m.formatSize(size, true)
var size = this.getSize(time);
var sizeQ = this.m.getSizeThresholdQ(time);
return this.m.formatSize(size, true, sizeQ)
},
/**
......
......@@ -1523,16 +1523,45 @@ Model.prototype = {
},
NB_READS_THRESHOLD_QUANTIFIABLE: 5,
/**
* Size threshold to compute percentages.
* Under this threshold, the clone is 'positive, but not quantifiable'
* inspired from clone:getSize()
* @param {integer} time - tracking point (default value : current tracking point)
* @return {float} size
* */
getSizeThresholdQ: function (time) {
time = this.getTime(time);
if (this.reads.segmented[time] == 0 ) return 0;
var result = this.NB_READS_THRESHOLD_QUANTIFIABLE / this.reads.segmented[time];
if (this.norm) result = this.normalize(result, time);
return result;
},
/**
* format size with the default format in use (model.notation_type)
* @param {float} size
* @param {bool} fixed - use a fixed size
* @param {float} sizeQ - under this size, this is not quantifiable
* */
formatSize: function (size, fixed) {
formatSize: function (size, fixed, sizeQ) {
var result = "-"
if (size == 0) return result
if (typeof sizeQ !== 'undefined') {
if (size < sizeQ) {
return "+"
// return "< " + this.formatSize(sizeQ, true)
}
}
switch (this.notation_type) {
case "percent":
if (fixed) {
......
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