Commit 8270d149 authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-c/4422-afficher-les-index-d-overlap' into 'dev'

Resolve "Afficher les index d'overlap"

Closes #4422

See merge request !795
parents ca7bdc30 3cbec1d1
Pipeline #169012 passed with stages
in 8 minutes and 42 seconds
......@@ -1155,9 +1155,11 @@ span.logo {
text-align: center;
vertical-align: middle;
}
#info_timepoint td {
#info_timepoint,
#info_timepoint td,
.info_overlaps td {
min-width: 150px;
max-width: 700px;
max-width: 100%;
overflow-wrap: break-word;
word-wrap: break-word;
border-style: solid;
......@@ -1166,16 +1168,22 @@ span.logo {
vertical-align: middle;
}
#info_window table,
#info_timepoint table {
#info_timepoint table,
.info_overlaps {
border-style: solid;
border-color: #333333;
border-collapse: collapse;
}
#info_window table .header,
#info_timepoint table .header {
#info_timepoint table .header,
.info_overlaps table .header {
border-width: 2px;
background-color: #333333;
}
.info_overlaps_line {
background-color: #333333;
font-weight: bold;
}
span.ok {
color: green;
}
......
......@@ -1156,9 +1156,11 @@ span.logo {
text-align: center;
vertical-align: middle;
}
#info_timepoint td {
#info_timepoint,
#info_timepoint td,
.info_overlaps td {
min-width: 150px;
max-width: 700px;
max-width: 100%;
overflow-wrap: break-word;
word-wrap: break-word;
border-style: solid;
......@@ -1167,16 +1169,22 @@ span.logo {
vertical-align: middle;
}
#info_window table,
#info_timepoint table {
#info_timepoint table,
.info_overlaps {
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
#info_window table .header,
#info_timepoint table .header {
#info_timepoint table .header,
.info_overlaps table .header {
border-width: 2px;
background-color: #cccccc;
}
.info_overlaps_line {
background-color: #cccccc;
font-weight: bold;
}
span.ok {
color: green;
}
......
......@@ -1351,9 +1351,9 @@ span.logo
vertical-align: middle;
}
#info_timepoint td{
#info_timepoint, #info_timepoint td, .info_overlaps td{
min-width : 150px;
max-width : 700px;
max-width : 100%;
overflow-wrap: break-word;
word-wrap: break-word;
border-style:solid;
......@@ -1362,17 +1362,22 @@ span.logo
vertical-align: middle;
}
#info_window table, #info_timepoint table{
#info_window table, #info_timepoint table, .info_overlaps {
border-style:solid;
border-color: @border;
border-collapse: collapse;
}
#info_window table .header, #info_timepoint table .header{
#info_window table .header, #info_timepoint table .header, .info_overlaps table .header{
border-width : 2px;
background-color: @border;
}
.info_overlaps_line {
background-color: @border;
font-weight: bold;
}
span.ok { color: green; }
text.ok { color: green; }
span.info { color: blue; }
......
......@@ -1484,21 +1484,65 @@ changeAlleleNotation: function(alleleNotation) {
html += "<tr><td> timestamp </td><td>" + this.getTimestampTime(timeID) + "</td></tr>"
html += "<tr><td> analysis log </td><td><pre>" + this.getSegmentationInfo(timeID) + "</pre></td></tr>"
var colspan_header = "colspan='"+(1+this.samples.number)+"'"
if ( typeof this.diversity != 'undefined') {
html += "<tr><td class='header' colspan='2'> diversity </td></tr>"
for (var key in this.diversity) {
html += "<tr><td> " + key.replace('index_', '') + "</td><td>" + this.getDiversity(key, timeID) + '</td></tr>'
html += "<tr><td class='header' "+colspan_header+"> diversity </td></tr>"
for (var key_diversity in this.diversity) {
html += "<tr><td> " + key_diversity.replace('index_', '') + "</td><td>" + this.getDiversity(key_diversity, timeID) + '</td></tr>'
}
}
if ( typeof this.samples.diversity != 'undefined' && typeof this.samples.diversity[timeID] != 'undefined') {
html += "<tr><td class='header' colspan='2'> diversity </td></tr>"
html += "<tr><td class='header' "+colspan_header+"> diversity </td></tr>"
for (var k in this.samples.diversity[timeID]) {
html += "<tr><td> " + k.replace('index_', '') + "</td><td>" + this.samples.diversity[timeID][k].toFixed(3) + '</td></tr>'
}
}
html += "</table></div>"
if ( typeof this.overlaps != 'undefined') {
html += "<br/><h3>Overlaps index</h3>"
var overlap_links = {
"morisita": "https://en.wikipedia.org/wiki/Morisita%27s_overlap_index",
"jaccard": "https://en.wikipedia.org/wiki/Jaccard_index"
}
for (var key_overlap in this.overlaps) {
var overlap_name = key_overlap.charAt(0).toUpperCase() + key_overlap.slice(1);
html += "<h4 style='display:inline'>"+overlap_name+"'s index</h4>"
html += "<a title='Help link for "+overlap_name+"\'s index' class='icon-help-circled-1' target='_blank' href='"+overlap_links[key_overlap]+"' style='text-decoration: none;'></a>"
html += "<table class='info_overlaps' id='overlap_"+key_overlap+"'>"
var overlap = this.overlaps[key_overlap]
html += "<tr><td class='header'></td>" // header with samples names
for (var posSample = 0; posSample < overlap.length; posSample++) {
html += "<td class='header'>"+this.getSampleName(posSample)+"</td>"
}
html += '</tr>'
for (posSample = 0; posSample < overlap.length; posSample++) {
if (posSample == this.t){
html += "<tr class='info_overlaps_line' >"
} else {
html += "<tr>"
}
html += "<td class='header'>"+this.getSampleName(posSample)+"</td>"
values = overlap[posSample]
for (var i = 0; i < (overlap[posSample].length); i++) {
value = overlap[posSample][i]
if (i == posSample){
html += "<td class=''>" + "--" + '</td>'
} else {
html += "<td>" + value + '</td>'
}
}
html += '</tr>'
}
html += "</table>"
}
}
return html
},
......@@ -3421,5 +3465,18 @@ changeAlleleNotation: function(alleleNotation) {
return
},
/**
* Get the name of a samples.
* If getted from the server, the correct name to send come from original_names field
* Else return value from samples.names
*/
getSampleName: function(posSample){
var name_server = this.samples.original_names[posSample]
var name_file = this.samples.names[posSample]
if (name_file == ""){
return name_server
}
return name_file
},
}; //end prototype Model
......@@ -659,5 +659,20 @@ 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")
});
QUnit.test("getSampleName", function(assert) {
var m = new Model();
m.parseJsonData(json_data, 100)
m.initClones()
assert.equal( m.getSampleName(0), "Diag.fa", "Correct name getted as no values for m.samples.names (values from server)")
// Simulate data from server opening
m.samples.names = ["f0", "f1", "f2", "f3"]
assert.equal( m.getSampleName(0), "f0", "Correct name getted if values from server")
});
{
"overlaps": {
"morisita": [
[
1.0,
0.166,
0.48
],
[
0.166,
1.0,
0.12
],
[
0.48,
0.12,
1.0
]
],
"jaccard": [
[
1.0,
0.167,
0.152
],
[
0.167,
1.0,
0.234
],
[
0.152,
0.234,
1.0
]
]
},
"germlines": {},
"producer": "vidjil fuse",
"similarity": [],
"timestamp": "2020-09-04 11:11:47",
"vidjil_json_version": "2016b",
"warn": [
],
"reads": {
"segmented": [
7260,
4149,
9239
],
"total": [
25000,
25000,
25000
],
"germline": {
}
},
"samples": {
"log": [
"log0", "log1", "log2"
],
"producer": [
"vidjil-algo",
"vidjil-algo",
"vidjil-algo"
],
"timestamp": [
"2020-08-06 12:26:02",
"2020-08-06 12:25:50",
"2020-08-06 12:25:40"
],
"commandline": [
"cmd0","cmd1","cmd2"
],
"number": 3,
"original_names": [
"LIL-L3-0",
"LIL-L3-1",
"LIL-L3-2"
],
"run_timestamp": [
"2020-04-30 17:24:15",
"2020-04-30 17:24:15",
"2020-04-30 17:24:15"
]
},
"clones": [
],
"clusters": [
0
]
}
\ No newline at end of file
# coding: utf-8
load 'vidjil_browser.rb'
load 'browser_test.rb'
#browser test suite
class TestGraph < BrowserTest
def setup
super
if not defined? $b
set_browser("/browser/test/data/issues/4422.vidjil")
if $b.div(id: 'tip-container').present?
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
end
end
end
# Test overlaps information
def after_tests
end
def test_00_load_first_config_without_analysis
$b.i(:class => "icon-info").click
assert ($b.table(:id => "overlap_morisita").exist?), "Morisita overlap table exist"
assert ($b.table(:id => "overlap_jaccard").exist?), "Jaccard overlap table exist"
end
# Not really a test
def test_zz_close
close_everything
end
end
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