diff options
6 files changed, 41 insertions, 39 deletions
diff --git a/wqflask/wqflask/static/new/javascript/biodalliance.js b/wqflask/wqflask/static/new/javascript/biodalliance.js index 849c9f67..51ee8f39 100644 --- a/wqflask/wqflask/static/new/javascript/biodalliance.js +++ b/wqflask/wqflask/static/new/javascript/biodalliance.js @@ -1,13 +1,15 @@ "use strict"; -var bd_browser = null; -var bd_data = {}; + +var BD = {}; +BD.browser = null; +BD.data = {}; var getChrLen = function(chr) { return js_data[chr * 1]; }; -var createBDBrowser = function(chr, start, end, speciesName, sources) { +BD.createBrowser = function(chr, start, end, speciesName, sources) { console.log("creating BD browser"); var b = new Browser({ chr: chr, @@ -30,32 +32,27 @@ var createBDBrowser = function(chr, start, end, speciesName, sources) { return b; }; -var showBDButton = function() { +BD.showButton = function() { $('#open_bd').show(); $('#close_bd').hide(); }; -var hideBDButton = function() { +BD.hideButton = function() { $('#close_bd').show(); $('#open_bd').hide(); }; -var setBDData = function(chr, length) { - // bd_data = { chr: chr, length: length }; - bd_data.chr = chr; - bd_data.length = length; -}; - -var setBDSpecies = function(species) { - bd_data.species = species; +BD.putData = function(data) { + for (var key in data) { + BD.data[key] = data[key]; + } }; - -var openBDBrowser = function() { +BD.openBrowser = function() { console.log("opening browser"); - if (!bd_browser) { - bd_browser = createBDBrowser(bd_data.chr, 0, bd_data.length * 1000000, bd_data.species, + if (!BD.browser) { + BD.browser = BD.createBrowser(BD.data.chr, 0, BD.data.length * 1000000, BD.data.species, [{name: 'Genome', twoBitURI: 'http://www.biodalliance.org/datasets/GRCm38/mm10.2bit', desc: 'Mouse reference genome build GRCm38', @@ -68,8 +65,8 @@ var openBDBrowser = function() { }] ); } else { - bd_browser.setLocation(bd_data.chr, 0, bd_data.length * 1000000); + BD.browser.setLocation(BD.data.chr, 0, BD.data.length * 1000000); } - bd_browser.maxViewWidth = bd_data.length * 1000000; + BD.browser.maxViewWidth = BD.data.length * 1000000; }; diff --git a/wqflask/wqflask/static/new/javascript/chr_lod_chart.coffee b/wqflask/wqflask/static/new/javascript/chr_lod_chart.coffee index d3c1ee7d..173f8186 100644 --- a/wqflask/wqflask/static/new/javascript/chr_lod_chart.coffee +++ b/wqflask/wqflask/static/new/javascript/chr_lod_chart.coffee @@ -273,7 +273,8 @@ class Chr_Lod_Chart $("#return_to_full_view").hide()
$('#topchart').remove()
$('#chart_container').append('<div class="qtlcharts" id="topchart"></div>')
- hideBDButton()
+ BD.hideButton()
+ $('#bd_container').hide()
create_lod_chart()
show_marker_in_table: (marker_info) ->
diff --git a/wqflask/wqflask/static/new/javascript/chr_lod_chart.js b/wqflask/wqflask/static/new/javascript/chr_lod_chart.js index 0032858f..01bb4601 100644 --- a/wqflask/wqflask/static/new/javascript/chr_lod_chart.js +++ b/wqflask/wqflask/static/new/javascript/chr_lod_chart.js @@ -260,7 +260,8 @@ Chr_Lod_Chart = (function() { $("#return_to_full_view").hide(); $('#topchart').remove(); $('#chart_container').append('<div class="qtlcharts" id="topchart"></div>'); - hideBDButton(); + BD.hideButton(); + $('#bd_container').hide(); return create_lod_chart(); }; diff --git a/wqflask/wqflask/static/new/javascript/lod_chart.coffee b/wqflask/wqflask/static/new/javascript/lod_chart.coffee index 2da2e5bb..a65df84f 100644 --- a/wqflask/wqflask/static/new/javascript/lod_chart.coffee +++ b/wqflask/wqflask/static/new/javascript/lod_chart.coffee @@ -123,8 +123,8 @@ lodchart = () -> .on("click", (d) -> console.log("d is:", d) redraw_plot(d) - setBDData(d[0], d[1]) - showBDButton() + BD.putData({chr: d[0], length: d[1]}); + BD.showButton() ) # x-axis labels diff --git a/wqflask/wqflask/static/new/javascript/lod_chart.js b/wqflask/wqflask/static/new/javascript/lod_chart.js index c6d1045c..f1df6bd8 100644 --- a/wqflask/wqflask/static/new/javascript/lod_chart.js +++ b/wqflask/wqflask/static/new/javascript/lod_chart.js @@ -118,8 +118,11 @@ lodchart = function() { }).attr("stroke", "none").on("click", function(d) { console.log("d is:", d); redraw_plot(d); - setBDData(d[0], d[1]); - return showBDButton(); + BD.putData({ + chr: d[0], + length: d[1] + }); + return BD.showButton(); }); xaxis = g.append("g").attr("class", "x axis"); xaxis.selectAll("empty").data(data.chrnames).enter().append("text").text(function(d) { diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html index efb80494..8e2af3cb 100644 --- a/wqflask/wqflask/templates/marker_regression_gn1.html +++ b/wqflask/wqflask/templates/marker_regression_gn1.html @@ -161,17 +161,17 @@ {% if mapping_method != "gemma" %} <div class="tab-pane {% if mapping_method == "gemma" %}active{% endif %}" id="vector_map"> <div id="chart_container"> - <div id="return_to_full_view" style="display:none"> - Return to full view - </div> - - <div id="open_bd" style="display:none"> - Open BioDalliance view - </div> - - <div id="close_bd" style="display:none"> - Return to vector map - </div> + <ul class="nav nav-tabs"> + <li id="return_to_full_view" class="btn btn-default buttons-html5" style="display:none"> + Return to full view + </li> + <li id="open_bd" class="btn btn-default buttons-html5" style="display:none"> + Open BioDalliance view + </li> + <li id="close_bd" class="btn btn-default buttons-html5" style="display:none"> + Return to vector map + </li> + </ul> <div class="qtlcharts" id="topchart"></div> @@ -285,13 +285,13 @@ <script language="javascript" type="text/javascript" src="/static/new/javascript/lod_chart.js"></script> <script language="javascript" type="text/javascript" src="/static/new/javascript/create_lodchart.js"></script> - <script language="javascript" type="text/javascript" src="/dalliance/dalliance-all.js"></script> + <script language="javascript" type="text/javascript" src="/dalliance/build/dalliance-all.js"></script> <script language="javascript" type="text/javascript" src="/static/new/javascript/biodalliance.js"></script> {% endif %} <script type="text/javascript" charset="utf-8"> $(document).ready( function () { - setBDSpecies("{{ dataset.group.species }}"); + BD.putData({species: "{{ dataset.group.species }}" }); console.time("Creating table"); $('#qtl_results').dataTable( { @@ -355,7 +355,7 @@ $('#topchart').hide(); $('#bd_container').show(); - openBDBrowser(); + BD.openBrowser(); }) }); |