Commit 82dab069 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

Merge branch 'feature-c/4783-focus-on-selected-clones-modifie-l-ordre-des-samples' into 'dev'

Resolve "focus on selected clones modifie l'ordre des samples"

Closes #4783

See merge request !988
parents 47d56391 99ad9475
Pipeline #274081 passed with stages
in 21 minutes and 15 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