Commit 77a3fa5e authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-c/2837_inherit_cluster_selection' into 'dev'

Uncluster inherit selection

Closes #1891 and #2837

See merge request !184
parents 4dd4eeef b6207a1b
Pipeline #22808 failed with stages
in 13 seconds
......@@ -816,6 +816,26 @@ changeAlleleNotation: function(alleleNotation) {
}
},
/**
* Unselect an isolated clone
* @param {integer} - cloneID - index of the clone to remove from the selection
*/
unselect: function(cloneID) {
console.log("unselect() (clone " + cloneID + ")");
if (this.clones[cloneID].isVirtual()) {
return 0;
}
if (this.clone(cloneID).isSelected()) {
var index = this.orderedSelectedClones.indexOf(cloneID);
if (index > -1)
this.orderedSelectedClones.splice(index, 1);
this.clone(cloneID).select = false;
this.updateElemStyle([cloneID]);
}
console.log("orderedSelectedClones: " + this.orderedSelectedClones.join(","));
},
toggleSelect: function(cloneID) {
console.log("toggle() (clone " + cloneID + ")");
......@@ -950,13 +970,21 @@ changeAlleleNotation: function(alleleNotation) {
if (!this.clone(i).split) {
for (var j = 0; j < this.clusters[i].length; j++) {
seq = this.clusters[i][j]
this.clone(seq).disable();
var subclone = this.clone(seq);
subclone.disable();
if (seq != i && subclone.isSelected())
// Unselect all subclones
this.unselect(seq);
}
this.clone(i).enable(this.top)
} else {
var main_clone = this.clone(i);
for (var k = 0; k < this.clusters[i].length; k++) {
seq = this.clusters[i][k]
this.clone(seq).enable(this.top)
var clone = this.clone(seq);
clone.enable(this.top)
if (clone.isSelected() != main_clone.isSelected())
this.select(seq, main_clone.select);
}
}
}
......
......@@ -168,5 +168,3 @@ QUnit.test("tag/norm", function(assert) {
assert.equal(m.clone(2).getSize(), 0.3125, "size after norm : Ok")
});
......@@ -149,6 +149,10 @@ QUnit.test("select/focus", function(assert) {
assert.deepEqual(m.getSelected(), [], "unselect all");
m.multiSelect([0,2,3])
assert.deepEqual(m.getSelected(), [0,2,3], "multi-select");
m.unselect(2);
assert.deepEqual(m.getSelected(), [0, 3], "unselect");
m.unselect(5);
assert.deepEqual(m.getSelected(), [0, 3], "unselect");
m.unselectAll()
assert.equal(m.findWindow("aaaaaaaaaaaid1aaaaaaa"), 0, "findWindow : Ok")
assert.equal(m.findWindow("aaaaaaaaaaaplopaaaaaaa"), -1, "findWindow : Ok")
......@@ -200,6 +204,9 @@ QUnit.test("cluster", function(assert) {
m.merge()
assert.deepEqual(m.clusters[0], [0,1], "merge 0 and 1: build cluster [0,1]");
assert.equal(m.clone(0).getSize(), 0.15, "cluster [0,1] : getsize = 0.15");
assert.ok(! m.clones[1].isSelected(), "Merged clone should not be selected");
assert.ok(m.clones[0].isSelected(), "Main merged clone should not be selected");
m.unselectAll()
m.select(0)
......
......@@ -30,6 +30,13 @@ QUnit.test("segmenter", function(assert) {
assert.equal(document.getElementById("f0"), null, "unselect : Ok")
assert.equal(document.getElementById("f1"), null, "unselect : Ok")
assert.equal(document.getElementById("f2"), null, "unselect : Ok")
m.select(0);
m.select(2);
m.unselect(2);
assert.notEqual(div0.innerHTML.indexOf("test1"), -1, "select : Ok")
assert.equal(document.getElementById("f2"), null, "unselect : Ok")
m.unselectAll();
//
assert.deepEqual(segment.findPotentialField(), ["","cdr3","fr1", "5", "id", "f1", "V-REGION","J-REGION","D-REGION","CDR3-IMGT"], "potentialField : Ok")
......
......@@ -129,6 +129,30 @@ end
assert (not $b.clone_in_scatterplot('2').visible?)
end
def test_08_select_cluster
$b.clone_in_scatterplot('1').click
clustered = $b.clone_info('1')
assert ($b.clone_in_scatterplot('1', :class => "circle_select").exists?)
assert ($b.clone_in_graph('1', :class=> "graph_select").exists?)
assert ($b.clone_in_segmenter('1').exists? ), ">> fail to add clone to segmenter by clicking on the list or scatterplot"
assert ( not $b.clone_in_scatterplot('2', :class => "circle_select").exists?)
assert ( not $b.clone_in_graph('2', :class=> "graph_select").exists?)
assert ( not $b.clone_in_segmenter('2').exists? ), ">> fail to add clone to segmenter by clicking on the list or scatterplot"
clustered[:cluster].click
assert ($b.clone_in_scatterplot('1', :class => "circle_select").exists?)
assert ($b.clone_in_graph('1', :class=> "graph_select").exists?)
assert ($b.clone_in_segmenter('1').exists? ), ">> fail to add clone to segmenter by clicking on the list or scatterplot"
assert ( $b.clone_in_scatterplot('2', :class => "circle_select").exists?)
assert ( $b.clone_in_graph('2', :class=> "graph_select").exists?)
assert ( $b.clone_in_segmenter('2').exists? ), ">> fail to add clone to segmenter by clicking on the list or scatterplot"
clustered[:cluster].click
$b.unselect
end
def test_90_select_other
# Click on first point
$b.graph_x_legend('1').click
......
......@@ -269,6 +269,39 @@ class TestMultilocus < BrowserTest
assert ($b.clone_in_segmenter(clone_id).exists?), "Clone %s is not in segmenter" % clone_id
end
def test_17_select_clustered
$b.clone_in_scatterplot('1').click
$b.clone_in_scatterplot('37').click(:control)
$b.clone_in_scatterplot('90').click(:control)
$b.merge.click
assert ($b.clone_in_scatterplot('90').exists?), "Main clone of the cluster should be clone 90"
assert ($b.clone_in_scatterplot('90', :class => "circle_select").exists?), "Clone should be selected"
$b.clone_info('90')[:cluster].click
assert ( $b.clone_in_scatterplot('1', :class => "circle_select").exists?)
assert ( $b.clone_in_graph('1', :class=> "graph_select").exists?)
assert ( $b.clone_in_segmenter('1').exists? ), ">> fail to add clone to segmenter by clicking on the list or scatterplot"
assert ( $b.clone_in_scatterplot('37', :class => "circle_select").exists?)
assert ( $b.clone_in_graph('37', :class=> "graph_select").exists?)
assert ( $b.clone_in_segmenter('37').exists? ), ">> fail to add clone to segmenter by clicking on the list or scatterplot"
assert ( $b.clone_in_scatterplot('90', :class => "circle_select").exists?)
assert ( $b.clone_in_graph('90', :class=> "graph_select").exists?)
assert ( $b.clone_in_segmenter('90').exists? ), ">> fail to add clone to segmenter by clicking on the list or scatterplot"
$b.clone_in_cluster('90', '1')[:delete].click
$b.clone_in_cluster('90', '37')[:delete].click
$b.unselect
assert ($b.clone_in_scatterplot('1').exists?)
assert ($b.clone_in_scatterplot('37').exists?)
assert ($b.clone_in_scatterplot('90').exists?)
end
def TODO_test_14_edit_tag
......
......@@ -45,8 +45,8 @@ class VidjilBrowser < Watir::Browser
return clone_in_list(id, extra).element(:id => 'cluster'+id)
end
# Return the n-th clone in a cluster for clone ID
# n: a str (starting at 1)
# Return a given clone in a cluster for clone ID
# n: a str corresponding to the clone ID in the cluster
def clone_in_cluster(id, n, extra = {})
cluster = clone_cluster(id, extra).element(:id => '_'+n)
return {object: cluster,
......
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