Commit a9a7ac2f authored by Marc Duez's avatar Marc Duez

clone.js : remove/replace some getter with the get function

parent 732c1d14
......@@ -271,7 +271,7 @@ Clone.prototype = {
time = this.m.getTime(time)
if (this.m.reads.segmented[time] == 0 ) return 0
var result = this.getSequenceReads(time) / this.m.reads.segmented[time]
var result = this.get('reads',time) / this.m.reads.segmented[time]
if (this.norm) {
result = this.m.normalize(result, time)
......@@ -298,28 +298,9 @@ Clone.prototype = {
}, //end getSize
/*
*
* */
getSequenceReads: function (time) {
time = this.m.getTime(time)
return this.reads[time];
}, //end getSequenceSize
getSystem: function () {
if (typeof (this.germline) != 'undefined') {
return this.germline;
}
},
getGene: function (type, withAllele) {
withAllele = typeof withAllele !== 'undefined' ? withAllele : true;
if (typeof (this.seg) != 'undefined' && typeof (this.seg[type]) != 'undefined') {
......@@ -523,7 +504,7 @@ Clone.prototype = {
html += "<tr><td> length </td><td colspan='" + time_length + "'>" + this.getSequenceLength() + "</td></tr>"
html += "<tr><td> size (n-reads (total reads) )</td>"
for (var i = 0; i < time_length; i++) {
html += "<td>" + this.getSequenceReads(this.m.samples.order[i]) +
html += "<td>" + this.get('reads',this.m.samples.order[i]) +
" (" + this.m.reads.segmented[this.m.samples.order[i]] + ")</td>"
}
html += "</tr>"
......@@ -557,7 +538,7 @@ Clone.prototype = {
html += "<tr><td> sequence </td><td colspan='" + time_length + "'>" + this.sequence + "</td></tr>"
html += "<tr><td> id </td><td colspan='" + time_length + "'>" + this.id + "</td></tr>"
html += "<tr><td> 5 </td><td colspan='" + time_length + "'>" + this.getGene("5") + "</td></tr>"
html += "<tr><td> 4 </td><td colspan='" + time_length + "'>" + this.getgene("4") + "</td></tr>"
html += "<tr><td> 4 </td><td colspan='" + time_length + "'>" + this.getGene("4") + "</td></tr>"
html += "<tr><td> 3 </td><td colspan='" + time_length + "'>" + this.getGene("3") + "</td></tr>"
......@@ -581,7 +562,7 @@ Clone.prototype = {
},
toCSV: function () {
var csv = this.getName() + "," + this.id + "," + this.getSystem() + "," + this.getTagName() + ","
var csv = this.getName() + "," + this.id + "," + this.get('germline') + "," + this.getTagName() + ","
+ this.getGene("5") + "," + this.getGene("4") + "," + this.getGene("3") + "," + this.getSequence()
for (var i=0; i<this.m.samples.order.length; i++) csv += "," + this.getReads(this.m.samples.order[i])
......
......@@ -866,7 +866,7 @@ Uploader.prototype = {
html += "<span class='button' onclick='db.uploader.cancel("+id+")'>cancel</span>"
break;
case "server_check":
html += "<span class='loading_seq'> processing file on server </span>"
html += "<span class='loading_seq'> processing file </span>"
break;
case "canceled":
html += "<span class='loading_status'> canceled by user </span>"
......
......@@ -491,7 +491,7 @@ Report.prototype = {
var seqJ = seq.substring(seg['3start'])
$('<span/>', {'class': 'v_gene', 'text': seqV}).appendTo(sequence);
if (this.m.clone(cloneID).getD() != "undefined D"){
if (this.m.clone(cloneID).getGene("4") != "undefined D"){
var seqN1 = seq.substring(seg['5end'] + 1, seg['4start'])
var seqD = seq.substring(seg['4start'] , seg['4end'] + 1)
var seqN2 = seq.substring(seg['4end'] + 1, seg['3start'])
......
......@@ -182,7 +182,7 @@ Germline.prototype = {
typeof this.m.clone(i).seg[type2] != "undefined"
){
var gene=this.m.clone(i).seg[type2];
if (this.m.system != "multi" || this.m.clone(i).getSystem() == system){
if (this.m.system != "multi" || this.m.clone(i).get('germline') == system){
if ( typeof this.allele[gene] != "undefined"){
g[gene] = this.allele[gene]
}else{
......
......@@ -479,7 +479,7 @@ List.prototype = {
div_elem.appendChild(span_cluster);
if (this.m.system=="multi") {
var system = this.m.clone(cloneID).getSystem()
var system = this.m.clone(cloneID).get('germline')
div_elem.appendChild(this.m.systemBox(system));
}
div_elem.appendChild(span_name);
......@@ -553,7 +553,7 @@ List.prototype = {
var r = 100
if (clusterSize != 0) {
span_stat.appendChild(document.createTextNode( (this.m.clone(id).getSequenceReads(this.m.t)*100/clusterReads).toFixed(1) + "%"));
span_stat.appendChild(document.createTextNode( (this.m.clone(id).get('reads', this.m.t)*100/clusterReads).toFixed(1) + "%"));
} else {
span_stat.appendChild(document.createTextNode("0%"))
}
......@@ -811,15 +811,15 @@ List.prototype = {
var cloneB = self.m.clone(idB)
//sort by system
var systemA = cloneA.getSystem()
var systemA = cloneA.get('germline')
if (typeof systemA == "undefined") systemA = "";
var systemB = cloneB.getSystem()
var systemB = cloneB.get('germline')
if (typeof systemB == "undefined") systemB = "";
if (systemA != systemB) return systemA.localeCompare(systemB);
//sort by V
var vA = cloneA.getV(true)
var vB = cloneB.getV(true)
var vA = cloneA.getGene("5",true)
var vB = cloneB.getGene("5",true)
return vA.localeCompare(vB);
})
......@@ -844,15 +844,15 @@ List.prototype = {
var cloneB = self.m.clone(idB)
//sort by system
var systemA = cloneA.getSystem()
var systemA = cloneA.get('germline')
if (typeof systemA == "undefined") systemA = "";
var systemB = cloneB.getSystem()
var systemB = cloneB.get('germline')
if (typeof systemB == "undefined") systemB = "";
if (systemA != systemB) return systemA.localeCompare(systemB);
//sort by J
var jA = cloneA.getJ(true)
var jB = cloneB.getJ(true)
var jA = cloneA.getGene("3",true)
var jB = cloneB.getGene("3",true)
return jA.localeCompare(jB);
})
......
......@@ -174,7 +174,7 @@ Model.prototype = {
var max = 0;
for (var i=0; i<this.clones.length; i++){
var clone_size = this.clone(i).getSize()
var clone_system = this.clone(i).getSystem()
var clone_system = this.clone(i).get('germline')
if (clone_size>max && typeof clone_system != "undefined"){
max = clone_size
system = clone_system
......@@ -796,7 +796,7 @@ Model.prototype = {
// unactive clones from unselected system
if (this.system == "multi") {
for (var i = 0; i < this.clones.length; i++) {
if (this.system_selected.indexOf(this.clone(i).getSystem()) == -1) {
if (this.system_selected.indexOf(this.clone(i).get('germline')) == -1) {
this.clones[i].disable()
}
}
......@@ -955,7 +955,7 @@ Model.prototype = {
if (this.clone(i).isActive()) {
for (var k = 0; k < this.clusters[i].length; k++) {
if (this.clusters[i][k] != this.clones.length - 1)
other[j] -= this.clone(this.clusters[i][k]).getSequenceReads(j);
other[j] -= this.clone(this.clusters[i][k]).get('reads', j);
}
}
}
......
......@@ -333,7 +333,7 @@ Model_loader.prototype = {
self.system_selected = [];
self.system_available = [];
for (var i = 0; i < this.clones.length; i++) {
var system = this.clone(i).getSystem()
var system = this.clone(i).get('germline')
if (typeof system != "undefined" && self.system_available.indexOf(system) ==-1){
self.system_available.push(system)
}
......
......@@ -805,16 +805,16 @@ ScatterPlot.prototype = {
//split clones into bar (axisX)
switch (this.splitX) {
case "allele_v" :
this.makeBarTab(function(cloneID){return self.m.clone(cloneID).getV()}, Object.keys(self.m.germlineV.allele))
this.makeBarTab(function(cloneID){return self.m.clone(cloneID).getGene("5")}, Object.keys(self.m.germlineV.allele))
break;
case "gene_v" :
this.makeBarTab(function(cloneID){return self.m.clone(cloneID).getV(false)}, Object.keys(self.m.germlineV.gene))
this.makeBarTab(function(cloneID){return self.m.clone(cloneID).getGene("5",false)}, Object.keys(self.m.germlineV.gene))
break;
case "allele_j" :
this.makeBarTab(function(cloneID){return self.m.clone(cloneID).getJ()}, Object.keys(self.m.germlineJ.allele))
this.makeBarTab(function(cloneID){return self.m.clone(cloneID).getGene("3")}, Object.keys(self.m.germlineJ.allele))
break;
case "gene_j" :
this.makeBarTab(function(cloneID){return self.m.clone(cloneID).getJ(false)}, Object.keys(self.m.germlineJ.gene))
this.makeBarTab(function(cloneID){return self.m.clone(cloneID).getGene("3",false)}, Object.keys(self.m.germlineJ.gene))
break;
default :
if (typeof this.available_axis[this.splitX])
......@@ -823,19 +823,19 @@ ScatterPlot.prototype = {
}
//sort each bar (axisY)
this.sortBarTab(function(a){return self.m.clone(a).getJ()});
this.sortBarTab(function(a){return self.m.clone(a).getGene("3")});
switch (this.splitY) {
case "allele_v" :
this.sortBarTab(function(cloneID){return self.m.clone(cloneID).getV()});
this.sortBarTab(function(cloneID){return self.m.clone(cloneID).getGene("5")});
break;
case "gene_v" :
this.sortBarTab(function(cloneID){return self.m.clone(cloneID).getV(false)});
this.sortBarTab(function(cloneID){return self.m.clone(cloneID).getGene("5",false)});
break;
case "allele_j" :
this.sortBarTab(function(cloneID){return self.m.clone(cloneID).getJ()});
this.sortBarTab(function(cloneID){return self.m.clone(cloneID).getGene("3")});
break;
case "gene_j" :
this.sortBarTab(function(cloneID){return self.m.clone(cloneID).getJ(false)});
this.sortBarTab(function(cloneID){return self.m.clone(cloneID).getGene("3",false)});
break;
default :
if (typeof this.available_axis[this.splitY])
......@@ -854,7 +854,7 @@ ScatterPlot.prototype = {
if (typeof values == "undefined"){
for (var i in this.m.clones) {
var clone = this.m.clone(i)
if (!this.use_system_grid || (this.use_system_grid && this.m.germlineV.system == clone.getSystem() ) ){
if (!this.use_system_grid || (this.use_system_grid && this.m.germlineV.system == clone.get('germline') ) ){
var v;
try{
var v = fct(i);
......@@ -876,7 +876,7 @@ ScatterPlot.prototype = {
for (var i in this.m.clones) {
var clone = this.m.clone(i)
if (!this.use_system_grid || (this.use_system_grid && this.m.germlineV.system == clone.getSystem() ) ){
if (!this.use_system_grid || (this.use_system_grid && this.m.germlineV.system == clone.get('germline') ) ){
var v;
try{
var v = fct(i);
......@@ -1445,7 +1445,7 @@ ScatterPlot.prototype = {
this.nodes[cloneID].s = 0
}
var sys = this.m.clone(cloneID)
.getSystem()
.get('germline')
if (this.use_system_grid && this.m.system == "multi" && typeof sys != 'undefined' && sys != this.m.germlineV.system) {
this.nodes[cloneID].x2 = this.systemGrid[sys].x * this.resizeW;
this.nodes[cloneID].y2 = this.systemGrid[sys].y * this.resizeH;
......
......@@ -486,7 +486,7 @@ Segment.prototype = {
request += ">" + c.getName() + "\n" + c.id + "\n";
}
if (c.getSize()>max){
system=c.getSystem()
system=c.get('germline')
max=c.getSize()
}
}
......
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