Commit 4a23b60f authored by Hoogenboom, Jerry's avatar Hoogenboom, Jerry

FDSTools v1.1.0.dev1: Visualisation fixes

* Samplevis v2.2.0:
  * Fixed incorrect calculation of 'percentage of highest' if the 'sequence'
    with the highest read count within a marker is the aggregated 'Other
    sequences' data. In exceptional cases, this could have resulted in the
    erroneous omission of an allele in the visualisation (graphs and/or
    tables).
* Stuttermodelvis v2.0.3:
  * Fixed bug that caused HTML visualisations with embedded data to fail
    while loading.
  * Fixed glitch where, in HTML visualisations with embedded data and a custom
    title, the custom title was truncated to the last '.' as if it were a file
    name.
* Pipeline v1.0.3:
  * Fixed glitch that caused the 'bgprofiles.html' output file of the
    reference-database analysis to lack a proper title.
* BGRawVis v2.0.1:
  * Fixed glitch where, in HTML visualisations with embedded data and a custom
    title, the custom title was truncated to the last '.' as if it were a file
    name.
  * Changed default save filename in HTML visualisations to 'bgprofiles-raw'.
* Profilevis v2.0.1:
  * Fixed glitch where, in HTML visualisations with embedded data and a custom
    title, the custom title was truncated to the last '.' as if it were a file
    name.
  * Changed default save filename in HTML visualisations to 'bgprofiles'.
parent bbb08573
......@@ -24,7 +24,7 @@ including tools for characterisation and filtering of PCR stutter artefacts and
other systemic noise, and for automatic detection of the alleles in a sample.
"""
__version_info__ = ('1', '0', '1')
__version_info__ = ('1', '1', '0', 'dev1')
__version__ = '.'.join(__version_info__)
usage = __doc__.split("\n\n\n")
......
......@@ -57,7 +57,7 @@ from ..lib import split_quoted_string, DEF_TAG_EXPR, DEF_TAG_FORMAT, get_tag, \
from ConfigParser import RawConfigParser, NoSectionError, NoOptionError
__version__ = "1.0.2"
__version__ = "1.0.3"
# Pattern that matches a long argparse argument name.
......@@ -501,6 +501,7 @@ def run_ref_database_analysis(arg_defs, config):
p_stuttermodel.wait()
# Make background profiles visualisation.
vis_custom_title = config.has_option("vis", "title")
config.set("seqconvert", "infile", prefix + "bgprofiles.txt")
p_seqconvert1 = subprocess.Popen(
get_argv("seqconvert", arg_defs, config), stdout=subprocess.PIPE)
......@@ -515,6 +516,8 @@ def run_ref_database_analysis(arg_defs, config):
config.set("vis", "infile", "-")
config.set("vis", "infile2", prefix + "bgprofiles-raw.txt")
config.set("vis", "outfile", prefix + "bgprofiles.html")
if not vis_custom_title:
config.set("vis", "title", prefix + "bgprofiles")
p_profilevis = subprocess.Popen(
get_argv("vis", arg_defs, config), stdin=p_seqconvert2.stdout)
p_seqconvert2.stdout.close()
......@@ -524,6 +527,8 @@ def run_ref_database_analysis(arg_defs, config):
config.set("vis", "infile", prefix + "stuttermodel.txt")
config.set("vis", "infile2", prefix + "stuttermodel-raw.txt")
config.set("vis", "outfile", prefix + "stuttermodel.html")
if not vis_custom_title:
config.remove_option("vis", "title")
p_stuttermodelvis = subprocess.Popen(get_argv("vis", arg_defs, config))
# Make raw background noise visualisation.
......
......@@ -24,7 +24,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<title>Background Noise Visualisation - FDSTools</title>
<!-- VERSION 2.0.0 -->
<!-- VERSION 2.0.1 -->
<!-- BEGIN_LIBRARIES -->
<script src="https://vega.github.io/vega-editor/vendor/d3.min.js"></script>
<script src="https://vega.github.io/vega/vega.min.js"></script>
......@@ -444,7 +444,7 @@
var graph = false;
var data_format = {};
var data_values = [];
var fileName = "bgprofile";
var fileName = "bgprofiles-raw";
var stamp = 0;
function parse(){
var this_stamp = ++stamp;
......@@ -559,9 +559,9 @@ function setRenderer(value){
function setFileName(value){
if(!value)
value = "bgprofile";
value = "bgprofiles-raw";
fileName = value;
if(value == "bgprofile")
if(value == "bgprofiles-raw")
document.title = "Background Noise Visualisation - FDSTools";
else
document.title = value + " - Background Noise Visualisation - FDSTools";
......@@ -657,6 +657,9 @@ function saveImage(){
}
function onLoadSpec(has_data){
data_format = graph_spec.data[0].format;
graph_spec.data[0].format = null;
if(!has_data){
//Handle files from the file input.
document.getElementById("fileselect").addEventListener('change', function(){
......@@ -683,21 +686,18 @@ function onLoadSpec(has_data){
loadDataset(evt.dataTransfer.files);
}, false);
}
else if(graph_spec.data[0].fdstools_filename){
var rows = document.querySelectorAll(".filenamedisplayrow");
for (var i = 0; i < rows.length; i++)
rows[i].style.display = "table-row";
var cell = document.getElementById("filenamedisplay");
removeChildren(cell);
cell.appendChild(document.createTextNode(graph_spec.data[0].fdstools_filename));
setFileName(graph_spec.data[0].fdstools_filename);
}
//Parse data outside of Vega.
data_format = graph_spec.data[0].format;
graph_spec.data[0].format = null;
if(has_data)
else{
loadProfiles(fileName, graph_spec.data[0].values);
if(graph_spec.data[0].fdstools_filename){
var rows = document.querySelectorAll(".filenamedisplayrow");
for (var i = 0; i < rows.length; i++)
rows[i].style.display = "table-row";
var cell = document.getElementById("filenamedisplay");
removeChildren(cell);
cell.appendChild(document.createTextNode(graph_spec.data[0].fdstools_filename));
setFileName(graph_spec.data[0].fdstools_filename);
}
}
//Update graph when rendering mode or axis scale is changed.
document.getElementById("renderCanvas").addEventListener('change', function(){
......
......@@ -24,7 +24,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<title>Background Noise Profile Visualisation - FDSTools</title>
<!-- VERSION 2.0.0 -->
<!-- VERSION 2.0.1 -->
<!-- BEGIN_LIBRARIES -->
<script src="https://vega.github.io/vega-editor/vendor/d3.min.js"></script>
<script src="https://vega.github.io/vega/vega.min.js"></script>
......@@ -455,7 +455,7 @@
var graph = false;
var data_format = {};
var data_values = [];
var fileName = "bgprofile";
var fileName = "bgprofiles";
var stamp = 0;
function parse(){
var this_stamp = ++stamp;
......@@ -570,9 +570,9 @@ function setRenderer(value){
function setFileName(value){
if(!value)
value = "bgprofile";
value = "bgprofiles";
fileName = value;
if(value == "bgprofile")
if(value == "bgprofiles")
document.title = "Background Noise Profile Visualisation - FDSTools";
else
document.title = value + " - Background Noise Profile Visualisation - FDSTools";
......@@ -701,6 +701,9 @@ function saveImage(){
}
function onLoadSpec(has_data, has_rawdata){
data_format = graph_spec.data[0].format;
graph_spec.data[0].format = null;
if(!has_data){
//Handle files from the file input.
document.getElementById("fileselect").addEventListener('change', function(){
......@@ -710,14 +713,17 @@ function onLoadSpec(has_data, has_rawdata){
for (var i = 0; i < rows.length; i++)
rows[i].style.display = "table-row";
}
else if(graph_spec.data[0].fdstools_filename){
var rows = document.querySelectorAll(".filenamedisplayrow");
for (var i = 0; i < rows.length; i++)
rows[i].style.display = "table-row";
var cell = document.getElementById("filenamedisplay");
removeChildren(cell);
cell.appendChild(document.createTextNode(graph_spec.data[0].fdstools_filename));
setFileName(graph_spec.data[0].fdstools_filename);
else{
loadProfiles(fileName, graph_spec.data[0].values);
if(graph_spec.data[0].fdstools_filename){
var rows = document.querySelectorAll(".filenamedisplayrow");
for (var i = 0; i < rows.length; i++)
rows[i].style.display = "table-row";
var cell = document.getElementById("filenamedisplay");
removeChildren(cell);
cell.appendChild(document.createTextNode(graph_spec.data[0].fdstools_filename));
setFileName(graph_spec.data[0].fdstools_filename);
}
}
if(!has_rawdata){
//Handle files from the file input.
......@@ -745,12 +751,6 @@ function onLoadSpec(has_data, has_rawdata){
}
embeddedFiles = (has_data? 1:0) + (has_rawdata? 2:0);
//Parse data outside of Vega.
data_format = graph_spec.data[0].format;
graph_spec.data[0].format = null;
if(has_data)
loadProfiles(fileName, graph_spec.data[0].values);
//Update graph when rendering mode or axis scale is changed.
document.getElementById("renderCanvas").addEventListener('change', function(){
setRenderer(this.value);
......
{
"fdstools_visversion": "2.1.2",
"fdstools_visversion": "2.2.0",
"width": 600,
"height": 10,
"signals": [
......@@ -155,13 +155,48 @@
]
},
{
"name": "aggr",
"name": "dummy1",
"source": "raw"
},
{
"name": "dummy2",
"source": "raw"
},
{
"name": "dummy3",
"source": "raw"
},
{
"name": "dummy4",
"source": "raw"
},
{
"name": "aggrm",
"source": "raw",
"transform": [
{
"type": "filter",
"test": "datum.sequence != 'Other sequences'"
},
{
"type": "aggregate",
"groupby": ["marker"],
"summarize": {"total_added": ["max"]}
}
]
},
{
"name": "dummy5",
"source": "raw"
},
{
"name": "aggrs",
"source": "raw",
"transform": [
{
"type": "aggregate",
"groupby": ["marker"],
"summarize": {"total_added": ["sum", "max"]}
"summarize": {"total_added": ["sum"]}
}
]
},
......@@ -171,26 +206,39 @@
"transform": [
{
"type": "lookup",
"on": "aggr",
"on": "aggrm",
"onKey": "marker",
"keys": ["marker"],
"as": ["aggrm"],
"default": {"max_total_added": 0}
},
{
"type": "lookup",
"on": "aggrs",
"onKey": "marker",
"keys": ["marker"],
"as": ["aggr"],
"default": {"max_total_added": 0, "sum_total_added": 0}
"as": ["aggrs"],
"default": {"sum_total_added": 0}
},
{
"type": "formula",
"field": "pct_of_max",
"expr": "datum.aggr.max_total_added? (datum.total_added / datum.aggr.max_total_added * 100) : 100"
"expr": "datum.aggrm.max_total_added? (datum.total_added / datum.aggrm.max_total_added * 100) : 100"
},
{
"type": "formula",
"field": "pct_of_sum",
"expr": "datum.aggr.sum_total_added? (datum.total_added / datum.aggr.sum_total_added * 100) : 100"
"expr": "datum.aggrs.sum_total_added? (datum.total_added / datum.aggrs.sum_total_added * 100) : 100"
},
{
"type": "formula",
"field": "strlength",
"expr": "test(/^CE\\d+\\.?\\d*_/, datum.sequence)? parseFloat(substring(datum.sequence, 2, indexof(datum.sequence, '_'))) : 1/0"
},
{
"type": "formula",
"field": "seq_order",
"expr": "(sort_str_by_length && test(/^CE\\d+\\.?\\d*_/, datum.sequence))? parseFloat(substring(datum.sequence, 2, indexof(datum.sequence, '_'))) : 1/0"
"expr": "sort_str_by_length? datum.strlength : 1/0"
},
{
"type": "sort",
......@@ -773,16 +821,24 @@
},
{
"type": "lookup",
"on": "aggr",
"on": "aggrm",
"onKey": "marker",
"keys": ["marker"],
"as": ["aggrm"],
"default": {"max_total_added": 0}
},
{
"type": "lookup",
"on": "aggrs",
"onKey": "marker",
"keys": ["marker"],
"as": ["aggr"],
"default": {"max_total_added": 0, "sum_total_added": 0}
"as": ["aggrs"],
"default": {"sum_total_added": 0}
},
{
"type": "formula",
"field": "threshold",
"expr": "max(allele_amplitude_threshold, allele_orientation_threshold*2, allele_amplitude_pct_threshold*datum.aggr.max_total_added/100, allele_amplitude_markerpct_threshold*datum.aggr.sum_total_added/100)"
"expr": "max(allele_amplitude_threshold, allele_orientation_threshold*2, allele_amplitude_pct_threshold*datum.aggrm.max_total_added/100, allele_amplitude_markerpct_threshold*datum.aggrs.sum_total_added/100)"
},
{
"type": "filter",
......
......@@ -24,7 +24,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<title>Stutter Model Visualisation - FDSTools</title>
<!-- VERSION 2.0.2 -->
<!-- VERSION 2.0.3 -->
<!-- BEGIN_LIBRARIES -->
<script src="https://vega.github.io/vega-editor/vendor/d3.min.js"></script>
<script src="https://vega.github.io/vega/vega.min.js"></script>
......@@ -774,6 +774,9 @@ function saveImage(){
}
function onLoadSpec(has_data, has_rawdata){
data_format = graph_spec.data[0].format;
graph_spec.data[0].format = null;
if(!has_data){
//Handle files from the file input.
document.getElementById("fileselect").addEventListener('change', function(){
......@@ -783,14 +786,17 @@ function onLoadSpec(has_data, has_rawdata){
for (var i = 0; i < rows.length; i++)
rows[i].style.display = "table-row";
}
else if(graph_spec.data[0].fdstools_filename){
var rows = document.querySelectorAll(".filenamedisplayrow");
for (var i = 0; i < rows.length; i++)
rows[i].style.display = "table-row";
var cell = document.getElementById("filenamedisplay");
removeChildren(cell);
cell.appendChild(document.createTextNode(graph_spec.data[0].fdstools_filename));
setFileName(graph_spec.data[0].fdstools_filename);
else{
loadFitFunctions(fileName, graph_spec.data[0].values);
if(graph_spec.data[0].fdstools_filename){
var rows = document.querySelectorAll(".filenamedisplayrow");
for (var i = 0; i < rows.length; i++)
rows[i].style.display = "table-row";
var cell = document.getElementById("filenamedisplay");
removeChildren(cell);
cell.appendChild(document.createTextNode(graph_spec.data[0].fdstools_filename));
setFileName(graph_spec.data[0].fdstools_filename);
}
}
if(!has_rawdata){
//Handle files from the file input.
......@@ -815,12 +821,6 @@ function onLoadSpec(has_data, has_rawdata){
}
embeddedFiles = (has_data? 1:0) + (has_rawdata? 2:0);
//Parse data outside of Vega.
data_format = graph_spec.data[0].format;
graph_spec.data[0].format = null;
if(has_data)
loadFitFunctions(fileName, graph_spec.data[0].values);
//Update graph when rendering mode is changed.
document.getElementById("renderCanvas").addEventListener('change', function(){
setRenderer(this.value);
......@@ -908,13 +908,13 @@ function onLoadSpec(has_data, has_rawdata){
for(i = 0; i < sel.options.length; i++)
if(val == sel.options.item(i).value)
sel.value = val;
document.getElementById("unitFilterRow").setAttribute("class", sel.value == "CUSTOM"? "" : "hidden");
val = getSignalValue("filter_fold");
sel = document.getElementById("foldSelect");
sel.value = "";
for(i = 0; i < sel.options.length; i++)
if(val == sel.options.item(i).value)
sel.value = val;
document.getElementById("unitFilterRow").setAttribute("class", us.value == "CUSTOM"? "" : "hidden");
document.getElementById("markerFilter").value = getSignalValue("filter_marker");
document.getElementById("r2Filter").value = getSignalValue("filter_r2");
document.getElementById("allDataFilter").checked = getSignalValue("show_all_data");
......
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