Commit 3c542597 authored by flothoni's avatar flothoni

Fix error of various list of compatible clone for distrib get_reads

parent 0762af4c
Pipeline #98474 failed with stages
in 18 seconds
......@@ -88,7 +88,7 @@ Axes.prototype = {
doc: "average length of the reads belonging to each clone",
label: "clone average read length",
axis: new FloatAxis(this.m),
fct: function(clone) {return clone.getAverageReadLength()}, // prends en compte le timepoint ?
fct: function(clone, time) {return clone.getAverageReadLength(time)},
set: function(clone, value) {clone._average_read_length = value},
round: function(value) { return Math.round(Number(value)) },
pretty: function(len) { return createClassedSpan('widestBox', (len == 'undefined' ? '?' : len)) }
......
......@@ -389,7 +389,8 @@ Clone.prototype = {
* */
getName: function () {
if (this.axes != undefined){
var n = sum(this.clone_number)
var t = this.m.t
var n = this.lst_compatible_clones[t].length
return this.get_distributions_values() + " (" + n + " clone" + (n>1 ? "s" : "") + ")"
}
if (this.getCluster().name){
......@@ -718,10 +719,10 @@ Clone.prototype = {
* @return {Boolean} True if share the same axes
*/
same_as_distrib_clone: function(dclone, dvalues, t){
t = t==undefined ? t:0
var axes = dclone.axes
var values = this.get_distributions_values(axes, t)
for (var pos = 0; pos < axes.length; pos++) {
var axe = axes[pos]
if (this.m.axes[axe] != undefined && this.m.axes[axe].round != undefined){
......@@ -740,17 +741,25 @@ Clone.prototype = {
* This list is called at the creation of the clone
*/
define_compatible_clones: function(){
this.lst_compatible_clones = []
var t = this.m.t
var nb_sample = this.m.samples.number
this.lst_compatible_clones = new Array(nb_sample)
for (var i = 0; i < this.lst_compatible_clones.length; i++) {
this.lst_compatible_clones[i] = []
}
if (this.has_size_distrib()){
var axes = this.axes
var dvalues = this.get_distributions_values(axes, 0)
for (var i = 0; i < this.m.clones.length; i++) {
var clone = this.m.clones[i]
if (clone.has_size_constant()) {
if (clone.same_as_distrib_clone(this, dvalues, t)){
this.lst_compatible_clones.push(i)
for (var timepoint = 0; timepoint < nb_sample; timepoint++) {
if (clone.same_as_distrib_clone(this, dvalues, timepoint)){
this.lst_compatible_clones[timepoint].push(i)
if (tolog){
console.default.log( "add ", i, " to ", this.index, " ("+ timepoint, ", "+ this.lst_compatible_clones[timepoint] +")")
}
}
}
}
}
}
......@@ -764,21 +773,24 @@ Clone.prototype = {
*/
update_reads_distrib_clones: function(){
if (this.has_size_distrib()){
var t = this.m.t
// var time = this.m.t
var nb_sample = this.m.samples.number
this.current_reads = JSON.parse(JSON.stringify(this.reads))
var axes = this.axes
var dvalues = this.get_distributions_values(axes, 0)
for (var pos = 0; pos < this.lst_compatible_clones.length; pos++) {
var c_index = this.lst_compatible_clones[pos]
var clone = this.m.clones[c_index]
if (clone.has_size_constant()) {
if (clone.active || clone.isFiltered) {
this.current_reads[t] -= clone.getReads(t, true) // todo verif nan
}
for (var timepoint = 0; timepoint < nb_sample; timepoint++) {
for (var pos = 0; pos < this.lst_compatible_clones[timepoint].length; pos++) {
var c_index = this.lst_compatible_clones[timepoint][pos]
var clone = this.m.clones[c_index]
if (clone.has_size_constant()) {
if (clone.active || clone.isFiltered) {
this.current_reads[timepoint] -= clone.getReads(timepoint, true) // todo verif nan
}
}
}
}
return result
return result // ???
}
},
......@@ -1730,7 +1742,7 @@ Clone.prototype = {
console.default.error("Getter: not axis " + axe + "; ("+naxe+")")
}
if (axes_obj.available()[naxe] != undefined && axes_obj.available()[naxe].fct != undefined) {
values.push( axes_obj.available()[naxe].fct(this) )
values.push( axes_obj.available()[naxe].fct(this, timepoint) )
} else {
console.default.error("Getter: not axis " + axe + "; ("+naxe+")")
if (axe == "lenSeq") { values.push( this.getSequence().length ) }
......
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