Commit 323dac7d authored by Mathieu Giraud's avatar Mathieu Giraud

js/clone.js: compute .coverage, average between non-zero coverages

The displayed coverage is the average of actual coverages.
(As the representative is computed only on samples above the -y limit,
some samples may not have any coverage.)
parent 3f978192
......@@ -51,6 +51,7 @@ function Clone(data, model, index) {
this.m.clones[index]=this
this.tag = this.getTag();
this.computeGCContent()
this.computeCoverage()
}
......@@ -352,6 +353,28 @@ Clone.prototype = {
return s
},
/*
* Compute coverage as the average value of non-zero coverages
*/
computeCoverage: function () {
if (typeof (this._coverage) == 'undefined') {
this.coverage = undefined
return
}
var sum = 0.0
var nb = 0
for (var i=0; i<this._coverage.length; i++) {
if (this._coverage[i] > 0) {
sum += parseFloat(this._coverage[i])
nb += 1
}
}
this.coverage = sum/nb
},
computeGCContent: function () {
if (typeof (this.sequence) == 'undefined') {
this.GCContent = '?'
......
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