Commit 8ad59fa1 authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Vidjil Team
Browse files

js/builder.js: warning/alert when the ratio of segmented reads is below some thresholds

parent 6486e2f8
...@@ -594,7 +594,12 @@ Builder.prototype = { ...@@ -594,7 +594,12 @@ Builder.prototype = {
var percent = (this.m.reads.segmented[this.m.t] / this.m.reads.total[this.m.t]) * 100 var percent = (this.m.reads.segmented[this.m.t] / this.m.reads.total[this.m.t]) * 100
var val = "" + this.m.reads.segmented[this.m.t] + " reads" + " (" + percent.toFixed(2) + "%)" var val = "" + this.m.reads.segmented[this.m.t] + " reads" + " (" + percent.toFixed(2) + "%)"
var div_segmented = this.build_info_line("info_segmented", "segmented", val)
var warning = false ;
if (percent < 10) { val += " – Very few reads segmented" ; warning = "alert" ; }
else if (percent < 50) { val += " – Few reads segmented" ; warning = "warning" ; }
var div_segmented = this.build_info_line("info_segmented", "segmented", val, warning)
parent.appendChild(div_segmented) parent.appendChild(div_segmented)
var div_total = this.build_info_line("info_total", "total", this.m.reads.total[this.m.t] + " reads") var div_total = this.build_info_line("info_total", "total", this.m.reads.total[this.m.t] + " reads")
...@@ -669,11 +674,18 @@ Builder.prototype = { ...@@ -669,11 +674,18 @@ Builder.prototype = {
return div return div
}, },
build_info_line: function (id, name, value) { build_info_line: function (id, name, value, className) {
var span1 = document.createElement('span'); var span1 = document.createElement('span');
span1.appendChild(document.createTextNode(name + " : ")); span1.appendChild(document.createTextNode(name + " : "));
span1.className = "info_row" span1.className = "info_row"
var span2 = document.createElement('span'); var span2 = document.createElement('span');
if (!(typeof(className) === "undefined"))
{
if (className)
{
span2.className = className ;
}
}
span2.appendChild(document.createTextNode(value)); span2.appendChild(document.createTextNode(value));
var div = document.createElement('div'); var div = document.createElement('div');
......
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