Commit 11b1b740 authored by Marc Duez's avatar Marc Duez
Browse files

browser : update/change for tests

parent b3f0afa1
......@@ -144,7 +144,7 @@ Axis.prototype = {
var n_min = 0;
var n_max = 1;
for (var i=0; i<this.m.n_clones; i++){
for (var i=0; i<this.m.clones.length; i++){
var n = this.m.clone(i).getNlength();
if (n > n_max) n_max = n;
}
......
......@@ -117,7 +117,7 @@ Builder.prototype = {
normalize_list.appendChild(div)
for (var i=0; i<self.m.n_clones; i++){
for (var i=0; i<self.m.clones.length; i++){
if (typeof self.m.clone(i).expected != "undefined"){
var input = document.createElement("input")
......@@ -419,7 +419,7 @@ Builder.prototype = {
//init slider
var max_top = 0;
for (var i = 0; i < this.m.n_clones; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
if (this.m.clone(i).top > max_top)
max_top = this.m.clone(i).top
}
......
......@@ -22,14 +22,43 @@ function Clone(data, model, hash) {
this.hash = hash
this.split = false
var key = Object.keys(data)
for (var i=0; i<key.length; i++ ){
this[key[i]]=data[key[i]]
}
if (typeof (this.getSequence()) != 'undefined' && typeof (this.name) != 'undefined') {
this.shortName = this.name.replace(new RegExp('IGHV', 'g'), "VH");
this.shortName = this.shortName.replace(new RegExp('IGHD', 'g'), "DH");
this.shortName = this.shortName.replace(new RegExp('IGHJ', 'g'), "JH");
this.shortName = this.shortName.replace(new RegExp('TRG', 'g'), "");
this.shortName = this.shortName.replace(new RegExp('\\*..', 'g'), "");
}
this.m.clusters[hash]=[hash]
this.m.clones[hash]=this
}
Clone.prototype = {
/* return clone name
* or return name of the representative sequence of the clone
*
* */
getName: function () {
if (this.m.clusters[this.hash].name){
return this.m.clusters[this.hash].name;
}else if (this.c_name) {
return this.c_name;
} else if (this.name) {
return this.name;
} else {
return this.getSequenceName();
}
},
/* return custom name
* or segmentation name
*
......@@ -57,12 +86,22 @@ Clone.prototype = {
return this.id;
}
}, //end getCode
/* give a new custom name to a clone
*
* */
changeName: function (newName) {
myConsole.log("changeName() (clone " + this.hash + " <<" + newName + ")");
this.c_name = newName;
this.m.updateElem([this.hash]);
}, //fin changeName,
getSystem: function () {
if (typeof (this.germline) != 'undefined') {
return this.germline;
}
},
/* compute the clone size ( sum of all clones clustered )
* @t : tracking point (default value : current tracking point)
......@@ -138,10 +177,24 @@ Clone.prototype = {
* */
getSequenceReads: function (time) {
time = typeof time !== 'undefined' ? time : this.m.t;
return this.reads[time];;
return this.reads[time];
}, //end getSequenceSize
getSystem: function () {
if (typeof (this.germline) != 'undefined') {
return this.germline;
}
},
getV: function (withAllele) {
withAllele = typeof withAllele !== 'undefined' ? withAllele : true;
if (typeof (this.seg) != 'undefined' && typeof (this.seg["5"]) != 'undefined') {
......@@ -206,15 +259,10 @@ Clone.prototype = {
}
},
/* give a new custom name to a clone
*
* */
changeName: function (newName) {
myConsole.log("changeName() (clone " + this.hash + " <<" + newName + ")");
this.c_name = newName;
this.m.updateElem([this.hash]);
}, //fin changeName,
/* give a new custom tag to a clone
*
* */
......@@ -225,20 +273,6 @@ Clone.prototype = {
this.tag = newTag;
this.m.updateElem([this.hash]);
},
/* return clone name
* or return name of the representative sequence of the clone
*
* */
getName: function () {
if (this.c_name) {
return this.c_name;
} else if (this.name) {
return this.name;
} else {
return this.getSequenceName();
}
},
getColor: function () {
if (this.color) {
......@@ -276,11 +310,17 @@ Clone.prototype = {
}else if (this.m.colorMethod == "dbscan"){
this.color = this.colorDBSCAN;
}else if (this.m.colorMethod == "V" && this.getV() != "undefined V"){
this.color = this.colorV;
this.color = "";
var allele = this.m.germlineV.allele[this.getV()]
if (typeof allele != 'undefined' ) this.color = allele.color;
}else if (this.m.colorMethod == "D" && this.getD() != "undefined D"){
this.color = this.colorD;
this.color = "";
var allele = this.m.germlineD.allele[this.getD()]
if (typeof allele != 'undefined' ) this.color = allele.color;
}else if (this.m.colorMethod == "J" && this.getJ() != "undefined J"){
this.color = this.colorJ;
this.color = "";
var allele = this.m.germlineJ.allele[this.getJ()]
if (typeof allele != 'undefined' ) this.color = allele.color;
}else if (this.m.colorMethod == "N"){
this.color = this.colorN;
}else if (this.m.colorMethod == "system") {
......@@ -290,6 +330,7 @@ Clone.prototype = {
}
},
/* return info about a sequence/clone in html
*
* */
......
......@@ -137,7 +137,7 @@ Germline.prototype = {
//reduce germline size (keep only detected genes)
//and add undetected genes (missing from germline)
var g = {}
for (var i=0; i<this.m.n_clones; i++){
for (var i=0; i<this.m.clones.length; i++){
if (typeof this.m.clone(i).seg != "undefined" &&
typeof this.m.clone(i).seg[type2] != "undefined"
){
......
......@@ -184,7 +184,7 @@ Graph.prototype = {
initClones : function () {
this.data_clones = [];
for (var i = 0; i < this.m.n_clones; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
this.data_clones[i] = {
id: i,
name: "line" + i,
......@@ -215,13 +215,13 @@ Graph.prototype = {
}
this.data_res.push({
id: this.m.n_clones,
id: this.m.clones.length,
name: "resolution1",
path: this.constructPathR(this.resolution1)
});
this.data_res.push({
id: this.m.n_clones + 1,
id: this.m.clones.length + 1,
name: "resolution5",
path: this.constructPathR(this.resolution5)
});
......@@ -505,12 +505,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_clones; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
for (var j = 0; j < this.m.clusters[i].length; j++) {
this.data_clones[this.m.clusters[i][j]].path = this.constructPath(i, false);
}
}
for (var i = 0; i < this.m.n_clones; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
var cloneID = i
for (var j = 0; j < this.m.clusters[cloneID].length; j++) {
var seqID = this.m.clusters[cloneID][j]
......@@ -533,7 +533,7 @@ Graph.prototype = {
updateStack: function () {
var stack = new Stack(this.m)
stack.compute();
for (var i = 0; i < this.m.n_clones; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
this.data_clones[i].path = this.constructStack(i, stack);
}
},
......@@ -1043,7 +1043,7 @@ 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_clones; i++){
for (i=0; i<this.m.clones.length; i++){
if (this.m.clone(i).isActive()) this.total_size[j] += this.m.clone(i).getSize(j); //active clones
}
......@@ -1060,7 +1060,7 @@ Stack.prototype = {
this.sum[j]=1
}
for (i=0; i<this.m.n_clones; i++){
for (i=0; i<this.m.clones.length; i++){
this.min[i] = []
this.max[i] = []
//active clones
......
......@@ -64,7 +64,7 @@ List.prototype = {
//clone list
var div_list_clones = document.createElement('div')
div_list_clones.id = "list_clones"
for (var i = 0; i < this.m.n_clones; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
var div = document.createElement('li');
div.className = "list";
div.id = i;
......@@ -232,7 +232,7 @@ List.prototype = {
.getTime();
var elapsedTime = 0;
for (var i = 0; i < this.m.n_clones; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
this.updateElem([i]);
}
this.update_data_list()
......@@ -558,7 +558,7 @@ List.prototype = {
},
reset_filter: function (bool) {
for (var i=0; i<this.m.n_clones; i++){
for (var i=0; i<this.m.clones.length; i++){
var c = this.m.clone(i)
c.isFiltered=bool
}
......@@ -566,7 +566,7 @@ List.prototype = {
filter: function (str) {
this.reset_filter(true)
for (var i=0; i<this.m.n_clones; i++){
for (var i=0; i<this.m.clones.length; 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
......
......@@ -85,10 +85,6 @@ if (config.use_database) var db = new Database("plop!", DB_ADDRESS);
var stats = new Stats(sp);
var shortcut = new Shortcut()
/* Add view in the model -> Alignment button
*/
m.addSegment(segment);
if (location.search != ''){
var tmp = location.search.substring(1).split('&')
var patient = -1
......
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_clones; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
if (this.m.clusters[i].length != 0 && flag != 0 && this.m.clone(i).isActive()) {
this.list.push(i);
flag--;
......@@ -184,7 +184,7 @@ PDF.prototype = {
opt2.y_offset = opt.y;
//clones style
for (var i = 0; i < this.m.n_clones; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
var polyline = elem.querySelectorAll('[id="polyline'+i+'"]')[0]
var color = tagColor[this.m.clone(i).getTag()]
......
......@@ -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_clones)
this.nodes = d3.range(this.m.clones.length)
.map(Object);
for (var i = 0; i < this.m.n_clones; i++) {
for (var i = 0; i < this.m.clones.length; 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
......@@ -286,7 +286,7 @@ ScatterPlot.prototype = {
*/
returnActiveclones: function() {
var activeclones = 0;
for (var i=0; i<this.m.n_clones;i++) {
for (var i=0; i<this.m.clones.length;i++) {
if (this.m.clone(i).isActive()) activeclones += 1;
}
return activeclones;
......@@ -684,7 +684,7 @@ ScatterPlot.prototype = {
}
//classement des clones suivant V
for (var i = 0; i < this.m.n_clones; i++) {
for (var i = 0; i < this.m.clones.length; i++) {
if (this.m.clone(i).isActive()) {
var geneV = this.m.clone(i).getV(false);
var clone = {
......@@ -1123,7 +1123,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_clones; i++) {
for (var i = 0; i < this.m.clones.length; 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_clones; i++) {
for (var i = 0; i < this.m.clones.length; 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