Commit 8057f332 authored by Marc Duez's avatar Marc Duez

browser : replace windows with clones object

parent 8d9c9b2b
......@@ -139,7 +139,7 @@ Axis.prototype = {
var n_min = 0;
var n_max = 1;
for (var i=0; i<this.m.n_windows; i++){
for (var i=0; i<this.m.n_clones; i++){
if (this.m.clone(i).Nlength > n_max) n_max = this.m.clone(i).Nlength;
}
......
......@@ -112,7 +112,7 @@ Builder.prototype = {
normalize_list.appendChild(document.createTextNode("none"))
normalize_list.appendChild(document.createElement("br"))
for (var i=0; i<self.m.n_windows; i++){
for (var i=0; i<self.m.n_clones; i++){
if (typeof self.m.clone(i).expected != "undefined"){
var input = document.createElement("input")
var text = document.createTextNode(self.m.clone(i).getName() + " => " +self.m.clone(i).expected)
......@@ -357,7 +357,7 @@ Builder.prototype = {
//init slider
var max_top = 0;
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
if (this.m.clone(i).top > max_top)
max_top = this.m.clone(i).top
}
......@@ -410,7 +410,7 @@ Builder.prototype = {
var clusterSelector = document.getElementById("clusterby_button")
clusterSelector.innerHTML = "";
if (self.m.windows[0]._target){
if (self.m.clones[0]._target){
var target = document.createElement('a');
target.className = "buttonSelector"
......@@ -437,7 +437,7 @@ Builder.prototype = {
clusterSelector.appendChild(clonotype)
}
if (self.m.windows[0].system){
if (self.m.clones[0].system){
var system = document.createElement('a');
system.className = "buttonSelector"
......
......@@ -64,7 +64,7 @@ Clone.prototype = {
}
},
/* compute the clone size ( sum of all windows clustered )
/* compute the clone size ( sum of all clones clustered )
* @t : tracking point (default value : current tracking point)
* */
getSize: function (time) {
......@@ -107,7 +107,7 @@ Clone.prototype = {
}, //end getSequenceSize
/* compute the clone reads number ( sum of all reads of windows clustered )
/* compute the clone reads number ( sum of all reads of clones clustered )
* @t : tracking point (default value : current tracking point)
* */
getReads: function (time) {
......
......@@ -50,7 +50,7 @@ Germline.prototype = {
//reduce germline size (keep only detected genes)
//and add undetected genes
var g = {}
for (var i=0; i<this.m.n_windows; i++){
for (var i=0; i<this.m.n_clones; i++){
if (typeof this.m.clone(i)[type] != "undefined"
&& typeof this.m.clone(i)[type][0] != "undefined"){
var gene=this.m.clone(i)[type][0];
......
......@@ -136,7 +136,7 @@ Graph.prototype = {
this.initAxis();
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
this.data_graph[i] = {
id: i,
name: "line" + i,
......@@ -153,13 +153,13 @@ Graph.prototype = {
}
this.data_res.push({
id: this.m.n_windows,
id: this.m.n_clones,
name: "resolution1",
path: this.constructPathR(this.resolution1)
});
this.data_res.push({
id: this.m.n_windows + 1,
id: this.m.n_clones + 1,
name: "resolution5",
path: this.constructPathR(this.resolution5)
});
......@@ -398,12 +398,12 @@ Graph.prototype = {
this.data_res[0].path = this.constructPathR(this.resolution1);
this.data_res[1].path = this.constructPathR(this.resolution5);
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
for (var j = 0; j < this.m.clusters[i].length; j++) {
this.data_graph[this.m.clusters[i][j]].path = this.constructPath(i, false);
}
}
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
var cloneID = i
for (var j = 0; j < this.m.clusters[cloneID].length; j++) {
var seqID = this.m.clusters[cloneID][j]
......@@ -892,11 +892,11 @@ Stack.prototype = {
this.total_size = [];
for (j=0; j<this.m.samples.number; j++){
this.total_size[j]=0
for (i=0; i<this.m.n_windows; i++){
for (i=0; i<this.m.n_clones; i++){
if (this.m.clone(i).isActive()) this.total_size[j] += this.m.clone(i).getSize(j); //active clones
}
this.total_size[j] += this.m.clone(this.m.windows.length-1).getSize(j);//other clones
this.total_size[j] += this.m.clone(this.m.clones.length-1).getSize(j);//other clones
}
},
......@@ -909,7 +909,7 @@ Stack.prototype = {
this.sum[j]=1
}
for (i=0; i<this.m.n_windows; i++){
for (i=0; i<this.m.n_clones; i++){
this.min[i] = []
this.max[i] = []
//active clones
......@@ -929,9 +929,9 @@ Stack.prototype = {
//other
for (j=0; j<this.m.samples.number; j++){
this.min[this.m.windows.length-1][j] = this.sum[j]
this.sum[this.m.windows.length-1] += this.m.clone(this.m.windows.length-1).getSize(j)
this.max[this.m.windows.length-1][j] = this.sum[j]
this.min[this.m.clones.length-1][j] = this.sum[j]
this.sum[this.m.clones.length-1] += this.m.clone(this.m.clones.length-1).getSize(j)
this.max[this.m.clones.length-1][j] = this.sum[j]
}
},
......
......@@ -60,7 +60,7 @@ List.prototype = {
var div_list_clones = document.createElement('div')
div_list_clones.id = "list_clones"
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
var div = document.createElement('li');
div.className = "list";
div.id = i;
......@@ -158,7 +158,7 @@ List.prototype = {
var startTime = new Date()
.getTime();
var elapsedTime = 0;
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
this.updateElem([i]);
}
elapsedTime = new Date()
......@@ -472,7 +472,7 @@ List.prototype = {
},
reset_filter: function (bool) {
for (var i=0; i<this.m.n_windows; i++){
for (var i=0; i<this.m.n_clones; i++){
var c = this.m.clone(i)
c.isFiltered=bool
}
......@@ -480,7 +480,7 @@ List.prototype = {
filter: function (str) {
this.reset_filter(true)
for (var i=0; i<this.m.n_windows; i++){
for (var i=0; i<this.m.n_clones; i++){
var c = this.m.clone(i)
if (c.getName().toUpperCase().indexOf(str.toUpperCase())!=-1 ) c.isFiltered = false
if (c.getSequence().toUpperCase().indexOf(str.toUpperCase())!=-1 ) c.isFiltered = false
......
This diff is collapsed.
......@@ -41,7 +41,7 @@ PDF.prototype = {
if (this.list.length == 0) {
var flag = 5;
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
if (this.m.clusters[i].length != 0 && flag != 0) {
this.list.push(i);
flag--;
......@@ -182,7 +182,7 @@ PDF.prototype = {
opt2.y_offset = opt.y;
//clones style
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
var polyline = elem.querySelectorAll('[id="polyline'+i+'"]')[0]
var color = tagColor[this.m.clone(i).getTag()]
......@@ -194,7 +194,7 @@ PDF.prototype = {
polyline.setAttribute("stroke", color);
}
if (m.windows[i].window == "other" || !m.windows[i].active) {
if (m.clone(i).window == "other" || !m.clone(i).isActive()) {
polyline.parentNode.removeChild(polyline);
}
}
......@@ -378,9 +378,9 @@ PDF.prototype = {
this.doc.setFont('courier', 'normal');
this.doc.setTextColor(0, 0, 0)
if (typeof (m.windows[cloneID].sequence) != 'number') {
if (m.clone(cloneID).getSequence() != "0") {
var seq = m.windows[cloneID].sequence;
var seq = m.clone(cloneID).getSequence()
var seqV = seq.substring(0, this.m.clone(cloneID).Vend + 1)
var seqN = seq.substring(this.m.clone(cloneID).Vend + 1, this.m.clone(cloneID).Jstart)
var seqJ = seq.substring(this.m.clone(cloneID).Jstart)
......@@ -426,7 +426,7 @@ PDF.prototype = {
}
} else {
this.doc.text(this.marge + 20, this.y, "segment fail :" + m.windows[cloneID].window);
this.doc.text(this.marge + 20, this.y, "segment fail :" + m.clone(cloneID).window);
}
this.y += 5;
......@@ -462,7 +462,7 @@ PDF.prototype = {
icon: function (cloneID, x, y, w, h) {
var color = tagColor[m.windows[cloneID].tag]
var color = tagColor[m.clone(cloneID).tag]
var polyline = document.getElementById("polyline" + cloneID)
.cloneNode(true);
......
......@@ -215,9 +215,9 @@ ScatterPlot.prototype = {
this.grpLinks = this.plot_container.append('svg:g').attr('class', 'grpLinks');
//Initialisation des nodes
this.nodes = d3.range(this.m.n_windows)
this.nodes = d3.range(this.m.n_clones)
.map(Object);
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
this.nodes[i].id = i; //L'id d'un cercle vaut le nombre de i dans la boucle
this.nodes[i].r1 = 5; // longueur du rayon1
this.nodes[i].r2 = 5; // longueur du rayon2
......@@ -280,14 +280,14 @@ ScatterPlot.prototype = {
},
/* Function which allows to return the number of active windows
/* Function which allows to return the number of active clones
*/
returnActiveWindows: function() {
var activeWindows = 0;
for (var i=0; i<this.m.n_windows;i++) {
if (this.m.clone(i).isActive()) activeWindows += 1;
returnActiveclones: function() {
var activeclones = 0;
for (var i=0; i<this.m.n_clones;i++) {
if (this.m.clone(i).isActive()) activeclones += 1;
}
return activeWindows;
return activeclones;
},
/* Function which allows to initialize the D3JS engine - usefull with reinitMotor()
......@@ -682,7 +682,7 @@ ScatterPlot.prototype = {
}
//classement des clones suivant V
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
if (this.m.clone(i).isActive()) {
var geneV = this.m.clone(i).getV();
var clone = {
......@@ -1135,7 +1135,7 @@ ScatterPlot.prototype = {
/* Function which permits to force all no-clustered clones, to return at their initial position
*/
forceNodesToStayInInitialPosition: function() {
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
if (this.m.dbscan.clusters[this.m.clone(i).cluster].length == 1) {
//Calcul du delta
var x = this.nodes[i].x;
......
......@@ -187,7 +187,7 @@ Segment.prototype = {
*
* */
update: function () {
for (var i = 0; i < this.m.n_windows; i++) {
for (var i = 0; i < this.m.n_clones; i++) {
this.updateElem([i]);
}
},
......
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