From 8cf60da3d6acd18c84381bb51fde9968dc3d75e5 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 31 Jul 2019 14:50:07 -0500 Subject: Fixed header to not have a fixed width, and added min-widths to many pages to avoid them ever looking strange when the window's width is lowered Significnatly improved correlation matrix output Fixed issue where zooming into Mb ranges with GEMMA mapping output often showed no results; this fix is not ideal and is just a way to work around the results currently not being sorted correctly. Later I should fix the sorting --- .../marker_regression/display_mapping_results.py | 3 +- .../static/new/javascript/create_corr_matrix.js | 14 ++- .../static/new/javascript/draw_corr_scatterplot.js | 59 ++++++------ .../packages/bootstrap/css/non-responsive.css | 4 +- wqflask/wqflask/templates/base.html | 14 +-- wqflask/wqflask/templates/collections/list.html | 7 +- wqflask/wqflask/templates/collections/view.html | 2 +- wqflask/wqflask/templates/correlation_matrix.html | 100 +++++++++++++++------ wqflask/wqflask/templates/index_page_orig.html | 2 +- wqflask/wqflask/templates/mapping_results.html | 2 +- wqflask/wqflask/templates/search_result_page.html | 2 +- wqflask/wqflask/templates/show_trait.html | 2 +- 12 files changed, 130 insertions(+), 81 deletions(-) diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index e6924f40..6498f039 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -1873,7 +1873,8 @@ class DisplayMappingResults(object): final_x_pos = Xc-canvas.stringWidth("5",font=symbolFont)/2+1 if final_x_pos > (xLeftOffset + plotWidth): - break + continue + #break ZS: This is temporary until issue with sorting for GEMMA is fixed elif final_x_pos < xLeftOffset: continue else: diff --git a/wqflask/wqflask/static/new/javascript/create_corr_matrix.js b/wqflask/wqflask/static/new/javascript/create_corr_matrix.js index fe89a672..c0c39fbc 100644 --- a/wqflask/wqflask/static/new/javascript/create_corr_matrix.js +++ b/wqflask/wqflask/static/new/javascript/create_corr_matrix.js @@ -1,5 +1,5 @@ -var neg_color_scale = chroma.scale(['#FF0000', '#FFFFFF']).domain([-1, -0.4]); -var pos_color_scale = chroma.scale(['#FFFFFF', '#00FFFF']).domain([0.4, 1]) +var neg_color_scale = chroma.scale(['#91bfdb', '#ffffff']).domain([-1, -0.4]); +var pos_color_scale = chroma.scale(['#ffffff', '#fc8d59']).domain([0.4, 1]) $('.corr_cell').each( function () { corr_value = parseFloat($(this).find('span.corr_value').text()) if (corr_value >= 0.5){ @@ -14,6 +14,11 @@ $('.corr_cell').each( function () { }); $('#short_labels').click( function (){ + if ($('.short_check').css("display") == "none"){ + $('.short_check').css("display", "inline-block") + } else { + $('.short_check').css("display", "none") + } $('.shortName').each( function() { if ($(this).css("display") == "none"){ $(this).css("display", "block"); @@ -25,6 +30,11 @@ $('#short_labels').click( function (){ }); $('#long_labels').click( function (){ + if ($('.long_check').css("display") == "none"){ + $('.long_check').css("display", "inline-block") + } else { + $('.long_check').css("display", "none") + } $('.verboseName').each( function() { if ($(this).css("display") == "none"){ $(this).css("display", "block"); diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index 23f41c66..8fdbad35 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -4,19 +4,33 @@ var srchart; x_val_range = js_data.x_range[1] - js_data.x_range[0] y_val_range = js_data.y_range[1] - js_data.y_range[0] -if (x_val_range < 9 || y_val_range < 9){ - tick_digits = '.1f' -} else if (x_val_range < 2 || y_val_range < 2) { - tick_digits = '.2f' +if (x_val_range >= 2 && x_val_range < 9){ + x_tick_digits = '.1f' +} else if (x_val_range >= 0.8 && x_val_range < 2) { + x_tick_digits = '.2f' +} else if (x_val_range < 0.8) { + x_tick_digits = '.3f' } else { - tick_digits = 'f' + x_tick_digits = 'f' } +if (y_val_range >= 2 && y_val_range < 8){ + y_tick_digits = '.1f' +} else if (y_val_range >= 0.8 && y_val_range < 2) { + y_tick_digits = '.2f' +} else if (y_val_range < 0.8) { + y_tick_digits = '.3f' +} else { + y_tick_digits = 'f' +} + +console.log("y_digits:", y_tick_digits) + var layout = { height: 700, width: 800, margin: { - l: 60, + l: 70, r: 30, t: 90, b: 50 @@ -29,7 +43,7 @@ var layout = { linecolor: 'black', linewidth: 1, ticklen: 4, - tickformat: tick_digits + tickformat: x_tick_digits }, yaxis: { range: [js_data.y_range[0], js_data.y_range[1]], @@ -39,7 +53,8 @@ var layout = { linecolor: 'black', linewidth: 1, ticklen: 4, - tickformat: tick_digits + tickformat: y_tick_digits, + automargin: true }, hovermode: "closest", showlegend: false, @@ -50,19 +65,7 @@ var layout = { xanchor: 'right', y: 1.05, yanchor: 'top', - text: 'r = ' + js_data.r_value.toFixed(3) + ' P = ' + js_data.p_value.toExponential(), - showarrow: false, - font: { - size: 14 - }, - }, { - xref: 'paper', - yref: 'paper', - x: 0, - xanchor: 'left', - y: 1.05, - yanchor: 'top', - text: 'N=' + js_data.num_overlap, + text: 'r = ' + js_data.r_value.toFixed(3) + ', p = ' + js_data.p_value.toExponential(3) + ', n = ' + js_data.num_overlap, showarrow: false, font: { size: 14 @@ -105,19 +108,7 @@ var sr_layout = { xanchor: 'right', y: 1.05, yanchor: 'top', - text: 'r = ' + js_data.srr_value.toFixed(3) + ' P = ' + js_data.srp_value.toExponential(), - showarrow: false, - font: { - size: 14 - }, - }, { - xref: 'paper', - yref: 'paper', - x: 0, - xanchor: 'left', - y: 1.05, - yanchor: 'top', - text: 'N=' + js_data.num_overlap, + text: 'r = ' + js_data.srr_value.toFixed(3) + ', P = ' + js_data.srp_value.toExponential(3) + ', n = ' + js_data.num_overlap, showarrow: false, font: { size: 14 diff --git a/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css b/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css index d352390f..36affd72 100644 --- a/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css +++ b/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css @@ -6,7 +6,7 @@ /* Account for fixed navbar */ body { - min-width: 1200px; + //min-width: 1200px; padding-top: 70px; padding-bottom: 30px; } @@ -28,7 +28,7 @@ body { /* Reset the container */ .container { - width: 1400px; + width: 100%; max-width: none !important; } diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index b1977b7f..80bbd7f5 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -21,10 +21,10 @@ - + -