Commit 54b2029e authored by Vidjil Team's avatar Vidjil Team Committed by Mathieu Giraud
Browse files

model.js: Use isVirtual() for smaller clones

Don't rely on the fact that a clone is at the end. It is absolutely
not reliable.

Commit performed in trio-programming: @tydax @RyanHerb @mikael-s
parent 7ec38dd6
...@@ -1074,27 +1074,29 @@ changeCloneNotation: function(cloneNotationType) { ...@@ -1074,27 +1074,29 @@ changeCloneNotation: function(cloneNotationType) {
} }
// compute size for each germlines of newOthers // compute size for each germlines of newOthers
lenSA = this.system_available.length; virtual_clones = [];
for (var pos = 0; pos < this.clones.length - lenSA; pos++) { for (var pos = 0; pos < this.clones.length; pos++) {
if (this.clone(pos).isActive()) { if (this.clone(pos).isVirtual()) {
virtual_clones.push(pos);
} else if (this.clone(pos).isActive()) {
for (var sample = 0; sample < this.samples.number ; sample++) { for (var sample = 0; sample < this.samples.number ; sample++) {
for (var k = 0; k < this.clusters[pos].length; k++) { for (var k = 0; k < this.clusters[pos].length; k++) {
if (this.clusters[pos][k] != this.clones.length - lenSA) { newOthers[this.clone(pos).germline][sample] -= this.clone(this.clusters[pos][k]).get('reads', sample);
newOthers[this.clone(pos).germline][sample] -= this.clone(this.clusters[pos][k]).get('reads', sample);}
else { break; }
} }
} }
} }
} }
// values assignation of other // values assignation of other
for (var pos = this.clones.length -lenSA; pos < this.clones.length ; pos++) { //for (var pos = this.clones.length -lenSA; pos < this.clones.length ; pos++) {
var c = this.clone(pos); var self = this;
virtual_clones.forEach(function(pos) {
var c = self.clone(pos);
c.reads = newOthers[c.germline]; c.reads = newOthers[c.germline];
c.name = c.germline + " smaller clones"; c.name = c.germline + " smaller clones";
if (this.someClonesFiltered) if (self.someClonesFiltered)
c.name += " + filtered clones"; c.name += " + filtered clones";
} })
}, },
/** /**
......
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