Commit f503327a authored by Marc Duez's avatar Marc Duez Committed by Mathieu Giraud

js : simplify use of time_order

var t was the current position inside the time_order array
now var t is just the current time and time_order is used only to draw graph
parent 56ec2a52
......@@ -133,7 +133,7 @@ Graph.prototype = {
this.resolution1 = []
this.resolution5 = []
for (i = 0; i < this.m.normalization_factor.length; i++) {
for (i = 0; i < this.m.time.length; i++) {
this.resolution1[i] = (1 / this.m.reads_segmented[i])
this.resolution5[i] = (5 / this.m.reads_segmented[i])
}
......@@ -581,20 +581,21 @@ Graph.prototype = {
var size = []
if (this.m.norm == true){
for (var i = 0; i < res.length; i++) {
size[i] = this.m.normalize(res[this.m.time_order[i]], this.m.time_order[i])
size[i] = this.m.normalize(res[i], i)
}
}else{
for (var i = 0; i < res.length; i++) {
size[i] = res[this.m.time_order[i]]
size[i] = res[i]
}
}
console.log(size)
p.push([0, (1 - this.scale_x(size[0] * this.m.precision))]);
for (var i = 0; i < this.graph_col.length; i++) {
p.push([(this.graph_col[i]), (1 - this.scale_x(size[i] * this.m.precision))]);
p.push([(this.graph_col[i]), (1 - this.scale_x(size[this.m.time_order[i]] * this.m.precision))]);
}
p.push([1, (1 - this.scale_x(size[this.graph_col.length - 1] * this.m.precision))]);
p.push([1, (1 - this.scale_x(size[this.m.time_order[this.graph_col.length - 1]] * this.m.precision))]);
p.push([1, 1 + 0.1]);
return p;
......@@ -610,8 +611,8 @@ Graph.prototype = {
var size = []
for (var i = 0; i < this.graph_col.length; i++) {
if (seq_size) size[i] = this.m.getSequenceSize(id, i)
else size[i] = this.m.getSize(id, i)
if (seq_size) size[i] = this.m.getSequenceSize(id, this.m.time_order[i])
else size[i] = this.m.getSize(id, this.m.time_order[i])
}
var x = this.graph_col[0];
......
......@@ -683,8 +683,7 @@ Model.prototype = {
getSize: function (cloneID, time) {
time = typeof time !== 'undefined' ? time : this.t;
var t = this.time_order[time]
var result = this.getReads(cloneID, time) / this.reads_segmented[t]
var result = this.getReads(cloneID, time) / this.reads_segmented[time]
if (this.norm) {
result = this.normalize(result, time)
......@@ -728,7 +727,7 @@ Model.prototype = {
var tmp = this.norm
this.norm = false
for (var i=0; i<this.time_order.length; i++){
for (var i=0; i<this.time.length; i++){
this.normalization.A[i] = this.getSize(cloneID, i)
}
this.norm = tmp
......@@ -745,7 +744,7 @@ Model.prototype = {
for (var i=0; i<this.time_order.length; i++){
var t = this.time_order[i]
var size = this.normalize(this.min_sizes[t], i)
var size = this.normalize(this.min_sizes[t], t)
if (size < min_size) min_size = size
}
......@@ -763,8 +762,7 @@ Model.prototype = {
getSequenceSize: function (cloneID, time) {
time = typeof time !== 'undefined' ? time : this.t;
var t = this.time_order[time]
var result = this.getSequenceReads(cloneID, time) / this.reads_segmented[t]
var result = this.getSequenceReads(cloneID, time) / this.reads_segmented[time]
if (this.norm) {
result = this.normalize(result, time)
......@@ -783,7 +781,7 @@ Model.prototype = {
var result = 0;
for (var j = 0; j < this.clones[cloneID].cluster.length; j++) {
result += this.windows[this.clones[cloneID].cluster[j]].size[this.time_order[time]];
result += this.windows[this.clones[cloneID].cluster[j]].size[time];
}
return result
......@@ -797,7 +795,7 @@ Model.prototype = {
time = typeof time !== 'undefined' ? time : this.t;
var result = 0;
result = this.windows[cloneID].size[this.time_order[time]];
result = this.windows[cloneID].size[time];
return result;
......
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