Commit 3dae0091 authored by marc's avatar marc Committed by Mathieu Giraud

test report contamination

parent c155b41c
......@@ -109,7 +109,10 @@ Database.prototype = {
{"sequence_file_id":self.m.samples.sequence_file_id,
"config_id":self.m.samples.config_id,
"results_file_id":self.m.samples.results_file_id,
}, function(a){console.log(a)})
}, function(a){
self.m.contamination=jQuery.parseJSON(a);
report.reportcontamination()
})
},
/**
......
......@@ -5,6 +5,28 @@ function Report(model) {
Report.prototype = {
reportcontamination : function() {
this.m.wait("generating report : this operation can take a few seconds")
var self = this
this.w = window.open("report.html", "_blank", "selected=0, toolbar=yes, scrollbars=yes, resizable=yes");
var text = "contamination report: "
if (typeof this.m.patient_name != 'undefined')
text += this.m.patient_name
this.w.onload = function(){
self.w.document.title = text
self.w.document.getElementById("header-title").innerHTML = text
self.info()
.contamination()
self.m.resize()
self.m.resume()
}
},
reportHTML : function() {
this.m.wait("generating report : this operation can take a few seconds")
......@@ -118,6 +140,39 @@ Report.prototype = {
return container
},
contamination : function(){
var self = this;
var contamination = this.container("Report run contamination")
var left = $('<div/>', {'class': 'flex'}).appendTo(contamination);
var content = [
{'label': "sample name" , 'value' : self.m.samples.names}
]
var table = $('<table/>', {'class': 'info-table2 float-left'}).appendTo(left);
for ( var key in content ){
var v = content[key]
var row = $('<tr/>').appendTo(table);
$('<td/>', {'class': 'label', 'text': v.label}).appendTo(row);
for (var i in v.value) $('<td/>', {'text': v.value[i].replace("_L001__001", "")}).appendTo(row);
}
var row0 = $('<tr/>').appendTo(table);
$('<td/>', {'class': 'label', 'text': " "}).appendTo(row0);
var row1 = $('<tr/>').appendTo(table);
$('<td/>', {'class': 'label', 'text': "reads "}).appendTo(row1);
for (var i in self.m.contamination) $('<td/>', {
'text': self.m.contamination[i].total_reads }).appendTo(row1);
var row2 = $('<tr/>').appendTo(table);
$('<td/>', {'class': 'label', 'text': "(%) "}).appendTo(row2);
for (var i in self.m.contamination) $('<td/>', {
'text': " (" +(self.m.contamination[i].total_reads/self.m.reads.segmented[i]*100).toFixed(3)+"%)"}).appendTo(row2);
return this
},
info : function() {
var info = this.container("Report info")
......
......@@ -39,7 +39,7 @@ Model_loader.prototype = {
var self = this;
var dataURL = ""
var analysisURL = ""
var patient = -1
var sample_set_id = -1
var dbconfig = -1
var custom_list = []
......
......@@ -122,6 +122,12 @@
font-size: 100%;
word-break: break-all;
}
.info-table2 {
font-size: 100%;
width: 100%;
word-break: break-all;
table-layout: fixed;
}
.flex{
width: 100%;
display: flex;
......
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