Commit 667c2e1c authored by flothoni's avatar flothoni Committed by Mathieu Giraud

model & grpah; add button to focus on samples with selected clones

parent 8b6d7c24
......@@ -288,7 +288,7 @@ Graph.prototype = {
var table = document.getElementById(""+this.id +"_table")
table.removeAllChildren()
// Show All
var line = document.createElement("tr")
var line_content = document.createElement("td")
line_content.id = this.id +"_listElem_showAll"
......@@ -298,6 +298,7 @@ Graph.prototype = {
line.appendChild(line_content)
table.appendChild(line)
// Hide All
line = document.createElement("tr")
line_content = document.createElement("td")
line_content.id = this.id +"_listElem_hideAll"
......@@ -307,6 +308,16 @@ Graph.prototype = {
line.appendChild(line_content)
table.appendChild(line)
// Hide not share
line = document.createElement("tr")
line_content = document.createElement("td")
line_content.id = this.id +"_listElem_hideNotShare"
line_content.classList.add("graph_listAll")
line_content.textContent = "Samples with selection"
line_content.colSpan = "2"
line.appendChild(line_content)
table.appendChild(line)
for (var i=0; i<this.m.samples.number; i++){
// Create a line for each sample, with checkbox and name (text)
var list_content = document.createElement("tr")
......@@ -330,6 +341,13 @@ Graph.prototype = {
list_content.appendChild(line_content_check)
list_content.appendChild(line_content_text)
// Add all descripion of sample keys as tooltip
var tooltip = "Sample name: " + this.m.getStrTime(i, "names")
tooltip += String.fromCharCode(13)+"Sampling date: " + this.m.getStrTime(i, "sampling_date")
tooltip += String.fromCharCode(13)+"Delta time: " + this.m.getStrTime(i, "delta_date")
list_content.title = tooltip
table.appendChild(list_content)
}
......@@ -341,6 +359,10 @@ Graph.prototype = {
console.log( "self.hideAllTimepoint( true )" )
self.m.hideAllTime()
})
$("#"+this.id +"_listElem_hideNotShare").click(function () {
console.log( "self.hideNotShare()" )
self.m.hideNotShare()
})
$(".graph_listElem").click(function () {
var time = parseInt( this.dataset.time )
......@@ -455,6 +477,7 @@ Graph.prototype = {
/* repositionne le graphique en fonction de la taille de la div le contenant
*
* */
......
......@@ -3364,5 +3364,41 @@ changeAlleleNotation: function(alleleNotation) {
},
/**
* Return a list of samples with selected clones
* @return {Array} list of samples
*/
getSampleWithSelectedClones: function(){
var selected = this.getSelected()
if (selected.length == 0) {
return this.samples.actifs
}
var list = []
for (var pos = 0; pos < selected.length; pos++) {
var clone = this.clones[selected[pos]]
for (var time = 0; time < clone.reads.length; time++) {
if (clone.reads[time] != 0 && list.indexOf(time) == -1) {
list.push(time)
}
}
}
return list
},
/**
* Remove all sample of the graph except one
*/
hideNotShare: function(){
// get list of sample with shared clone
if (this.getSelected().length == 0) {
return
}
this.changeTimeOrder( this.getSampleWithSelectedClones() )
// this.updateList()
// this.m.update()
return
},
}; //end prototype Model
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