Commit b211c329 authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-c/4026-distributions-et-graphe' into 'dev'

Resolve "Distributions et graphe"

Closes #4026

See merge request !525
parents 271b2dd4 06b07c7e
Pipeline #101825 passed with stages
in 7 minutes and 55 seconds
......@@ -381,11 +381,16 @@ Graph.prototype = {
var stack = new Stack(this.m)
stack.compute();
for (var i = 0; i < this.m.clones.length; i++) {
this.data_clone[i].path = this.constructStack(i, stack);
if (this.m.clone(i).hasSizeConstant()) {
this.data_clone[i].path = this.constructStack(i, stack);
}
}
}else{
var list = []
for (var j = 0; j < this.m.clones.length; j++) list.push(j)
for (var j = 0; j < this.m.clones.length; j++)
if (this.m.clone(j).hasSizeConstant()) {
list.push(j)
}
this.updateElem(list)
}
......@@ -421,7 +426,7 @@ Graph.prototype = {
*
* */
updateElemStyle: function (list) {
if (this.m.focus != -1) {
if (this.m.focus != -1 && this.m.clone(this.m.focus).hasSizeConstant()) {
var line = document.getElementById("polyline" + this.m.focus);
document.getElementById("clones_container")
.appendChild(line);
......@@ -775,11 +780,13 @@ Graph.prototype = {
this.data_clone = [];
for (var i = 0; i < this.m.clones.length; i++) {
this.data_clone[i] = {
id: i,
name: "line" + i,
path: this.constructPath(i, false)
};
if (this.m.clone(i).hasSizeConstant()) {
this.data_clone[i] = {
id: i,
name: "line" + i,
path: this.constructPath(i, false)
};
}
}
this.g_clone = this.clones_container.selectAll("path")
......@@ -967,8 +974,10 @@ Graph.prototype = {
//get ready for something really dirty
for (var i=0; i<this.m.samples.order.length; i++) {
for (var j=0; j<this.m.clones.length; j++){
var size = this.m.precision*this.m.clone(j).getSize()
if (size>max) max=size;
if (this.m.clone(j).hasSizeConstant()) {
var size = this.m.precision*this.m.clone(j).getSize()
if (size>max) max=size;
}
}
}
......@@ -1404,7 +1413,11 @@ Stack.prototype = {
for (j=0; j<this.m.samples.number; j++){
this.total_size[j]=0
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
if (this.m.clone(i).hasSizeConstant()) {
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.clones.length-1).getSize(j);//other clones
......@@ -1421,28 +1434,30 @@ Stack.prototype = {
}
for (i=0; i<this.m.clones.length; i++){
this.min[i] = []
this.max[i] = []
//active clones
if (this.m.clone(i).isActive()) {
for (j=0; j<this.m.samples.number; j++){
this.min[i][j] = this.sum[j]
this.sum[j] -= this.m.clone(i).getSize(j)
this.max[i][j] = this.sum[j]
}
}else{
for (j=0; j<this.m.samples.number; j++){
this.min[i][j] = this.sum[j]
this.max[i][j] = this.sum[j]
if (this.m.clone(i).hasSizeConstant()) {
this.min[i] = []
this.max[i] = []
//active clones
if (this.m.clone(i).isActive()) {
for (j=0; j<this.m.samples.number; j++){
this.min[i][j] = this.sum[j]
this.sum[j] -= this.m.clone(i).getSize(j)
this.max[i][j] = this.sum[j]
}
}else{
for (j=0; j<this.m.samples.number; j++){
this.min[i][j] = this.sum[j]
this.max[i][j] = this.sum[j]
}
}
}
}
//other
for (j=0; j<this.m.samples.number; 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]
this.min[this.m.getNumberRealClones()-1][j] = this.sum[j]
this.sum[this.m.getNumberRealClones()-1] += this.m.clone(this.m.clones.length-1).getSize(j)
this.max[this.m.getNumberRealClones()-1][j] = this.sum[j]
}
}
......
......@@ -3188,5 +3188,20 @@ changeAlleleNotation: function(alleleNotation) {
},
/**
* Get the number of cloens that have constant size
* @return {Number}
*/
getNumberRealClones: function(){
var nb = 0
for (var i = 0; i < this.clones.length; i++) {
if (this.clone(i).hasSizeConstant()){
nb += 1
}
}
return nb
},
}; //end prototype Model
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