Commit 99ad9475 authored by Thonier Florian's avatar Thonier Florian
Browse files

model.js; keep correct order when, use 'focus on selected clones'

Link to #4783
parent 74d5439a
Pipeline #268167 passed with stages
in 35 minutes and 53 seconds
......@@ -3611,7 +3611,7 @@ changeAlleleNotation: function(alleleNotation, update, save) {
},
/**
* Return a list of samples with selected clones
* Return a list of samples with selected clones, in the same order than in stock_order
* @return {Array} list of samples
*/
getSampleWithSelectedClones: function(){
......@@ -3629,7 +3629,16 @@ changeAlleleNotation: function(alleleNotation, update, save) {
}
}
}
return list
// Reorder list as in stock_order
nlist = []
for (var i = 0; i < this.samples.stock_order.length; i++) {
pos = this.samples.stock_order[i]
if (list.indexOf( pos ) != -1 ){
nlist.push( pos )
}
}
return nlist
},
/**
......
......@@ -667,6 +667,15 @@ QUnit.test("getSampleWithSelectedClones", function(assert) {
m.select(2)
assert.deepEqual( m.getSampleWithSelectedClones(), [0,1,2], "clone 1 and 2, should return samples 1 and 2 and 3")
// Test order
// clone 1 present only in sample 1 and 3
m.clones[1].reads[1] = 0
m.clones[1].reads[2] = 10
// clone 2 present only in sample 1 and 2
m.clones[2].reads[0] = 10
m.clones[2].reads[2] = 0
assert.deepEqual( m.getSampleWithSelectedClones(), [0,1,2], "clone 1 and 2, should return samples 1 and 2 and 3 in the correct order")
});
......
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