aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2019-02-05 10:42:46 -0600
committerzsloan2019-02-05 10:42:46 -0600
commit85f014695b7873941ad200051606635ff37b2c20 (patch)
treeb5827907dceff6a14945b9b551c06f86e4f2e5be /wqflask
parenta593fb56a01f2015491299af7274270228f9230c (diff)
downloadgenenetwork2-85f014695b7873941ad200051606635ff37b2c20.tar.gz
Fixed issue with getting marker info that affected heatmap and possibly other functions
Added the collection page features (correlation matrix, network graph, third party link-outs, etc) to the search result and correlation result pages
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/data_set.py38
-rw-r--r--wqflask/wqflask/heatmap/heatmap.py4
-rw-r--r--wqflask/wqflask/static/new/javascript/search_results.js59
-rw-r--r--wqflask/wqflask/templates/collections/view.html58
-rw-r--r--wqflask/wqflask/templates/correlation_page.html75
-rw-r--r--wqflask/wqflask/templates/search_result_page.html57
6 files changed, 161 insertions, 130 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 2acb3b61..79f72390 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -171,28 +171,22 @@ class Markers(object):
def __init__(self, name):
json_data_fh = open(locate(name + ".json",'genotype/json'))
- try:
- markers = []
- with open(locate(name + "_snps.txt", 'r')) as bimbam_fh:
+ markers = []
+ with open("%s/%s_snps.txt" % (flat_files('genotype/bimbam'), name), 'r') as bimbam_fh:
+ if len(bimbam_fh.readline().split(", ")) > 2:
+ delimiter = ", "
+ elif len(bimbam_fh.readline().split(",")) > 2:
+ delimiter = ","
+ elif len(bimbam_fh.readline().split("\t")) > 2:
+ delimiter = "\t"
+ else:
+ delimiter = " "
+ for line in bimbam_fh:
marker = {}
- if len(bimbam_fh[0].split(", ")) > 2:
- delimiter = ", "
- elif len(bimbam_fh[0].split(",")) > 2:
- delimiter = ","
- elif len(bimbam_fh[0].split("\t")) > 2:
- delimiter = "\t"
- else:
- delimiter = " "
- for line in bimbam_fh:
- marker['name'] = line.split(delimiter)[0]
- marker['Mb']
- marker['chr'] = line.split(delimiter)[2]
- marker['cM']
- markers.append(marker)
- #try:
- # markers = json.load(json_data_fh)
- except:
- markers = []
+ marker['name'] = line.split(delimiter)[0].rstrip()
+ marker['Mb'] = float(line.split(delimiter)[1].rstrip())/1000000
+ marker['chr'] = line.split(delimiter)[2].rstrip()
+ markers.append(marker)
for marker in markers:
if (marker['chr'] != "X") and (marker['chr'] != "Y"):
@@ -334,8 +328,6 @@ class DatasetGroup(object):
return mapping_id, mapping_names
def get_markers(self):
- logger.debug("self.species is:", self.species)
-
def check_plink_gemma():
if flat_file_exists("mapping"):
MAPPING_PATH = flat_files("mapping")+"/"
diff --git a/wqflask/wqflask/heatmap/heatmap.py b/wqflask/wqflask/heatmap/heatmap.py
index 7b328cb5..ff589693 100644
--- a/wqflask/wqflask/heatmap/heatmap.py
+++ b/wqflask/wqflask/heatmap/heatmap.py
@@ -43,6 +43,9 @@ Redis = Redis()
from flask import Flask, g
+from utility.logger import getLogger
+logger = getLogger(__name__ )
+
class Heatmap(object):
def __init__(self, start_vars, temp_uuid):
@@ -96,6 +99,7 @@ class Heatmap(object):
for trait in self.trait_results.keys():
lodnames.append(trait)
+ self.dataset.group.get_markers()
for marker in self.dataset.group.markers.markers:
chr_pos.append(marker['chr'])
pos.append(marker['Mb'])
diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js
index abcdf7e6..2277a157 100644
--- a/wqflask/wqflask/static/new/javascript/search_results.js
+++ b/wqflask/wqflask/static/new/javascript/search_results.js
@@ -223,6 +223,65 @@ $(function() {
$('#export_form').submit();
};
+ $("#corr_matrix").on("click", function() {
+ traits = $("#trait_table input:checked").map(function() {
+ return $(this).val();
+ }).get();
+ $("#trait_list").val(traits)
+ url = $(this).data("url")
+ return submit_special(url)
+ });
+ $("#network_graph").on("click", function() {
+ traits = $("#trait_table input:checked").map(function() {
+ return $(this).val();
+ }).get();
+ $("#trait_list").val(traits)
+ url = $(this).data("url")
+ return submit_special(url)
+ });
+ $("#wgcna_setup").on("click", function() {
+ traits = $("#trait_table input:checked").map(function() {
+ return $(this).val();
+ }).get();
+ $("#trait_list").val(traits)
+ url = $(this).data("url")
+ return submit_special(url)
+ });
+ $("#ctl_setup").on("click", function() {
+ traits = $("#trait_table input:checked").map(function() {
+ return $(this).val();
+ }).get();
+ $("#trait_list").val(traits)
+ url = $(this).data("url")
+ return submit_special(url)
+ });
+ $("#heatmap").on("click", function() {
+ traits = $("#trait_table input:checked").map(function() {
+ return $(this).val();
+ }).get();
+ $("#trait_list").val(traits)
+ url = $(this).data("url")
+ return submit_special(url)
+ });
+ $("#comp_bar_chart").on("click", function() {
+ traits = $("#trait_table input:checked").map(function() {
+ return $(this).val();
+ }).get();
+ $("#trait_list").val(traits)
+ url = $(this).data("url")
+ return submit_special(url)
+ });
+
+ $("#send_to_webgestalt, #send_to_bnw").on("click", function() {
+ traits = $("#trait_table input:checked").map(function() {
+ return $(this).val();
+ }).get();
+ $("#trait_list").val(traits)
+ url = $(this).data("url")
+ return submit_special(url)
+ });
+
+
$("#select_all").click(select_all);
$("#deselect_all").click(deselect_all);
$("#invert").click(invert);
diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html
index a2b63374..a219b868 100644
--- a/wqflask/wqflask/templates/collections/view.html
+++ b/wqflask/wqflask/templates/collections/view.html
@@ -220,64 +220,6 @@
url = $(this).data("url")
return submit_special(url)
});
-
- $("#corr_matrix").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
- $("#network_graph").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
- $("#wgcna_setup").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
- $("#ctl_setup").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
- $("#heatmap").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
- $("#comp_bar_chart").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
-
- $("#send_to_webgestalt, #send_to_bnw").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
});
</script>
diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html
index 2d4ed2a4..4786e379 100644
--- a/wqflask/wqflask/templates/correlation_page.html
+++ b/wqflask/wqflask/templates/correlation_page.html
@@ -20,31 +20,53 @@
</p>
<div>
- <form id="correlation_form" action="/corr_matrix" method="post">
- {% if uc %}
- <input type="hidden" name="uc_id" id="uc_id" value="{{ uc.id }}" />
- {% endif %}
- <input type="hidden" name="trait_list" id="trait_list" value= "" >
+ <form id="correlation_form" target="_blank" action="/corr_matrix" method="post">
+ <input type="hidden" name="trait_list" id="trait_list" value= "
+ {% for this_trait in trait_list %}
+ {{ this_trait.name }}:{{ this_trait.dataset }},
+ {% endfor %}" >
+
<button id="corr_matrix" class="btn btn-primary submit_special" data-url="/corr_matrix" title="Correlation Matrix" >
Correlation Matrix
</button>
+
<button id="network_graph" class="btn btn-primary submit_special" data-url="/network_graph" title="Network Graph" >
Network Graph
</button>
+
<button id="wgcna_setup" class="btn btn-primary submit_special" data-url="/wgcna_setup" title="WGCNA Analysis" >
WGCNA Analysis
</button>
+
<button id="ctl_setup" class="btn btn-primary submit_special" data-url="/ctl_setup" title="CTL Analysis" >
CTL Analysis
</button>
+
<button id="heatmap" class="btn btn-primary submit_special" data-url="/heatmap" title="Heatmap" >
Heatmap
</button>
+
+ <button id="comp_bar_chart" class="btn btn-primary submit_special" data-url="/comparison_bar_chart" title="Comparison Bar Chart" >
+ Comparison Bar Chart
+ </button>
+
+ <button id="send_to_webgestalt" class="btn btn-primary submit_special" data-url="/webgestalt_page" title="WebGestalt" >
+ WebGestalt
+ </button>
+
+ <button id="send_to_bnw" class="btn btn-primary submit_special" data-url="/bnw_page" title="Bayesian Network" >
+ BNW
+ </button>
+
+ <button id="delete" class="btn btn-danger submit_special" style="margin-left: 15px;" data-url="/collections/delete" title="Delete this collection" >
+ Delete Collection
+ </button>
+
</form>
</div>
<div>
@@ -465,49 +487,6 @@
url = $(this).data("url")
return submit_special(url)
});
-
- $("#corr_matrix").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- console.log($("#trait_list").val(traits))
- url = $(this).data("url")
- //return submit_special(url)
- });
- $("#network_graph").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
- $("#wgcna_setup").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
- $("#ctl_setup").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
- $("#heatmap").on("click", function() {
- traits = $("#trait_table input:checked").map(function() {
- return $(this).val();
- }).get();
- $("#trait_list").val(traits)
- url = $(this).data("url")
- return submit_special(url)
- });
-
});
</script>
{% endblock %}
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index 79a279f8..6fcbcb01 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -47,12 +47,62 @@
<p>To study a record click on its ID below, and to view the whole description {% if dataset.type == "Publish" %}or list of authors {% endif %} hover over the table cell. Check records below and click Add button to add to selection.</p>
<div>
+ <form id="trait_submission_form" target="_blank" action="/corr_matrix" method="post">
+ <input type="hidden" name="trait_list" id="trait_list" value= "
+ {% for this_trait in trait_list %}
+ {{ this_trait.name }}:{{ this_trait.dataset }},
+ {% endfor %}" >
+
+
+ <button id="corr_matrix" class="btn btn-primary submit_special" data-url="/corr_matrix" title="Correlation Matrix" >
+ Correlation Matrix
+ </button>
+
+
+ <button id="network_graph" class="btn btn-primary submit_special" data-url="/network_graph" title="Network Graph" >
+ Network Graph
+ </button>
+
+
+ <button id="wgcna_setup" class="btn btn-primary submit_special" data-url="/wgcna_setup" title="WGCNA Analysis" >
+ WGCNA Analysis
+ </button>
+
+
+ <button id="ctl_setup" class="btn btn-primary submit_special" data-url="/ctl_setup" title="CTL Analysis" >
+ CTL Analysis
+ </button>
+
+
+ <button id="heatmap" class="btn btn-primary submit_special" data-url="/heatmap" title="Heatmap" >
+ Heatmap
+ </button>
+
+ <button id="comp_bar_chart" class="btn btn-primary submit_special" data-url="/comparison_bar_chart" title="Comparison Bar Chart" >
+ Comparison Bar Chart
+ </button>
+
+ <button id="send_to_webgestalt" class="btn btn-primary submit_special" data-url="/webgestalt_page" title="WebGestalt" >
+ WebGestalt
+ </button>
+
+ <button id="send_to_bnw" class="btn btn-primary submit_special" data-url="/bnw_page" title="Bayesian Network" >
+ BNW
+ </button>
+
+ <button id="delete" class="btn btn-danger submit_special" style="margin-left: 15px;" data-url="/collections/delete" title="Delete this collection" >
+ Delete Collection
+ </button>
+
+ </form>
+ </div>
+
+ <div>
<br />
<button class="btn btn-default" id="select_all"><span class="glyphicon glyphicon-ok"></span> Select All</button>
<button class="btn btn-default" id="deselect_all"><span class="glyphicon glyphicon-remove"></span> Deselect All</button>
<button class="btn btn-default" id="invert"><span class="glyphicon glyphicon-resize-vertical"></span> Invert</button>
<button class="btn btn-default" id="add" disabled><span class="glyphicon glyphicon-plus-sign"></span> Add</button>
- <button id="redraw" class="btn btn-default">Reset Columns</button>
<input type="text" id="searchbox" class="form-control" style="width: 200px; display: inline;" placeholder="Search This Table For ...">
<input type="text" id="select_top" class="form-control" style="width: 200px; display: inline;" placeholder="Select Top ...">
<br />
@@ -355,6 +405,11 @@
table.colReorder.reset()
});
+ submit_special = function(url) {
+ $("#trait_submission_form").attr("action", url);
+ return $("#trait_submission_form").submit();
+ };
+
});
</script>
{% endblock %}