aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/marker_regression/marker_regression.py11
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression_gn1.py18
-rwxr-xr-xwqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js2
-rw-r--r--wqflask/wqflask/templates/marker_regression_gn1.html34
-rwxr-xr-xwqflask/wqflask/views.py1
5 files changed, 50 insertions, 16 deletions
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 05bb5b60..c396b14b 100755
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -52,6 +52,8 @@ class MarkerRegression(object):
#tempdata = temp_data.TempData(temp_uuid)
+ self.temp_uuid = temp_uuid #needed to pass temp_uuid to gn1 mapping code (marker_regression_gn1.py)
+
self.json_data = {}
self.json_data['lodnames'] = ['lod.hk']
@@ -76,6 +78,11 @@ class MarkerRegression(object):
self.score_type = "LRS" #ZS: LRS or LOD
self.mapping_scale = "physic"
self.num_perm = 0
+
+ #ZS: This is passed to GN1 code for single chr mapping
+ self.selected_chr = -1
+ if "selected_chr" in start_vars:
+ self.selected_chr = int(start_vars['selected_chr'])
self.dataset.group.get_markers()
if self.mapping_method == "gemma":
@@ -720,7 +727,9 @@ class MarkerRegression(object):
def gen_data(self, temp_uuid):
"""Generates p-values for each marker"""
- pheno_vector = np.array([val == "x" and np.nan or float(val) for val in self.vals])
+
+ print("self.vals is:", self.vals)
+ pheno_vector = np.array([(val == "x" or val == "") and np.nan or float(val) for val in self.vals])
#lmm_uuid = str(uuid.uuid4())
diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
index 1da98c63..a0033bd2 100644
--- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py
+++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
@@ -172,10 +172,16 @@ class MarkerRegression(object):
#helper_functions.get_species_dataset_trait(self, start_vars)
+ self.temp_uuid = start_vars['temp_uuid']
+
self.dataset = start_vars['dataset']
self.this_trait = start_vars['this_trait']
self.species = start_vars['species']
+
+ self.vals = start_vars['vals'] #Needed to put into form for when it is resubmitted for single chr views or remapping
+ self.mapping_method = start_vars['mapping_method'] #Needing for form submission when doing single chr mapping or remapping after changing options
+
self.js_data = start_vars['js_data']
#ZS: Think I can just get all this from dataset object now
@@ -226,9 +232,9 @@ class MarkerRegression(object):
#self.controlLocus = fd.formdata.getvalue('controlLocus', '')
#try:
- # self.selectedChr = int(fd.formdata.getvalue('chromosomes', "-1"))
+ self.selectedChr = int(start_vars['selected_chr'])
#except:
- self.selectedChr = -1
+ # self.selectedChr = -1
#whether include parents and F1 for InbredSet
#fd.parentsf14regression = fd.formdata.getvalue('parentsf14regression')
@@ -1921,10 +1927,12 @@ class MarkerRegression(object):
#startPosX = xLeftOffset
thisLRSColor = self.colorCollection[0]
- if qtlresult['chr'] != previous_chr:
+ if qtlresult['chr'] != previous_chr and self.selectedChr == -1:
previous_chr = qtlresult['chr']
previous_chr_as_int += 1
+ print("ChrLengthDistList:", self.ChrLengthDistList)
+
newStartPosX = (self.ChrLengthDistList[previous_chr_as_int - 1]+self.GraphInterval)*plotXScale
if newStartPosX != oldStartPosX:
startPosX += newStartPosX
@@ -1933,7 +1941,7 @@ class MarkerRegression(object):
#startPosX += (self.ChrLengthDistList[j]+self.GraphInterval)*plotXScale
#for j, _chr in enumerate(self.genotype):
- if 1 == 1:
+ if self.selectedChr == -1 or qtlresult['chr'] == self.selectedChr:
#LRSCoordXY = []
#AdditiveCoordXY = []
#DominanceCoordXY = []
@@ -2120,7 +2128,7 @@ class MarkerRegression(object):
COORDS = "%d,%d,%d,%d" %(chrStartPix, yTopOffset, chrEndPix,yTopOffset +20)
#add by NL 09-03-2010
- HREF = "javascript placeholder"
+ HREF = "javascript:chrView(%d,%s);" % (i,self.ChrLengthMbList)
#HREF = "javascript:changeView(%d,%s);" % (i,self.ChrLengthMbList)
Areas = HT.Area(shape='rect',coords=COORDS,href=HREF)
gifmap.areas.append(Areas)
diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
index 3834e60b..721752dd 100755
--- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
@@ -165,7 +165,7 @@
$("#pylmm_compute").on("click", (function(_this) {
return function() {
var form_data, url;
- $("#progress_bar_container").modal();
+ //$("#progress_bar_container").modal();
url = "/marker_regression";
$('input[name=method]').val("pylmm");
$('input[name=num_perm]').val($('input[name=num_perm_pylmm]').val());
diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html
index e6bc2d65..f5bec6ea 100644
--- a/wqflask/wqflask/templates/marker_regression_gn1.html
+++ b/wqflask/wqflask/templates/marker_regression_gn1.html
@@ -6,22 +6,30 @@
{% endblock %}
{% from "base_macro.html" import header %}
{% block content %}
- {{ header("Mapping",
+ {{ header("Whole Genome Mapping Results",
'{}: {}'.format(this_trait.name, this_trait.description_fmt)) }}
<div class="container">
- <div>
- <h2>
- Whole Genome Mapping
- </h2>
- </div>
+ <form method="post" target="_blank" action="/marker_regression" name="marker_regression" id="marker_regression_form">
+ <input type="hidden" name="temp_uuid" value="{{ temp_uuid }}">
+ <input type="hidden" name="trait_id" value="{{ this_trait.name }}">
+ <input type="hidden" name="dataset" value="{{ dataset.name }}">
+ {% for sample in dataset.group.samplelist %}
+ <input type="hidden" name="value:{{ sample }}" value="{{ vals[loop.index - 1] }}">
+ {% endfor %}
+ <input type="hidden" name="maf">
+ <input type="hidden" name="method" value="{{ mapping_method }}">
+ <input type="hidden" name="selected_chr" value="{{ selectedChr }}">
+ <input type="hidden" name="manhattan_plot">
+ <input type="hidden" name="num_perm">
<div id="chart_container">
<div class="qtlcharts" id="topchart">
{{ gifmap|safe }}
<img src="/static/output/{{ filename }}.jpeg" usemap="#WebQTLImageMap">
</div>
</div>
- <div style="width:45%;">
+ </form>
+ <div style="width:48%;">
<h2>
Results
</h2>
@@ -102,12 +110,12 @@
console.time("Creating table");
$('#qtl_results').dataTable( {
"columns": [
- { "type": "natural", "bSortable": false },
+ { "type": "natural", "sWidth": "10%", "bSortable": false },
{ "type": "natural" },
{ "type": "natural" },
{ "type": "natural" },
{ "type": "natural" },
- { "type": "natural" }
+ { "type": "natural", "sWidth": "30%"}
],
"buttons": [
'csv'
@@ -124,6 +132,14 @@
console.timeEnd("Creating table");
});
+
+ chrView = function(this_chr, chr_mb_list) {
+ $('input[name=selected_chr]').val(this_chr + 1)
+ $('input[name=chr_mb_list]').val(chr_mb_list)
+
+ return $('#marker_regression_form').submit();
+ };
+
</script>
{% endblock %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 2a426eda..9c5a3c92 100755
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -335,6 +335,7 @@ def marker_regression_page():
'trait_id',
'dataset',
'method',
+ 'selected_chr',
'mapping_scale',
'score_type',
'suggestive',