aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/base/data_set.py6
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression.py3
-rw-r--r--wqflask/wqflask/show_trait/show_trait.py12
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js3
-rw-r--r--wqflask/wqflask/templates/marker_regression_gn1.html3
-rw-r--r--wqflask/wqflask/templates/show_trait.html1
-rw-r--r--wqflask/wqflask/templates/show_trait_mapping_tools.html36
-rw-r--r--wqflask/wqflask/views.py1
8 files changed, 64 insertions, 1 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index fddfce58..918932fa 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -278,6 +278,7 @@ class DatasetGroup(object):
self.incparentsf1 = False
self.allsamples = None
self._datasets = None
+ self.genofile = None
def get_specified_markers(self, markers = []):
self.markers = HumanMarkers(self.name, markers)
@@ -408,7 +409,10 @@ class DatasetGroup(object):
genotype_1 = reaper.Dataset()
# reaper barfs on unicode filenames, so here we ensure it's a string
- full_filename = str(locate(self.name+'.geno','genotype'))
+ if self.genofile:
+ full_filename = str(locate(self.genofile, 'genotype'))
+ else:
+ full_filename = str(locate(self.name + '.geno', 'genotype'))
genotype_1.read(full_filename)
if genotype_1.type == "group" and self.parlist:
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index fef0d8a0..d9dbd0da 100644
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -165,6 +165,7 @@ class MarkerRegression(object):
self.mapping_scale = "morgan"
self.control_marker = start_vars['control_marker']
self.do_control = start_vars['do_control']
+ self.dataset.group.genofile = start_vars['genofile']
self.method = start_vars['mapmethod_rqtl_geno']
self.model = start_vars['mapmodel_rqtl_geno']
if start_vars['pair_scan'] == "true":
@@ -200,6 +201,7 @@ class MarkerRegression(object):
self.control_marker = start_vars['control_marker']
self.do_control = start_vars['do_control']
+ self.dataset.group.genofile = start_vars['genofile']
logger.info("Running qtlreaper")
results, self.json_data, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = qtlreaper_mapping.gen_reaper_results(self.this_trait,
self.dataset,
@@ -216,6 +218,7 @@ class MarkerRegression(object):
#results = self.run_plink()
elif self.mapping_method == "pylmm":
logger.debug("RUNNING PYLMM")
+ self.dataset.group.genofile = start_vars['genofile']
if self.num_perm > 0:
self.run_permutations(str(temp_uuid))
results = self.gen_data(str(temp_uuid))
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index d9617c7c..9a695d8e 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -4,6 +4,7 @@ import string
import os
import cPickle
import uuid
+import json as json
#import pyXLWriter as xl
from collections import OrderedDict
@@ -24,6 +25,7 @@ from basicStatistics import BasicStatisticsFunctions
from pprint import pformat as pf
from utility.tools import flat_files, flat_file_exists
+from utility.tools import get_setting
from utility.logger import getLogger
logger = getLogger(__name__ )
@@ -175,6 +177,7 @@ class ShowTrait(object):
else:
return False
+ self.genofiles = get_genofiles(self.this_trait)
self.use_plink_gemma = check_plink_gemma()
self.use_pylmm_rqtl = check_pylmm_rqtl()
@@ -1261,6 +1264,15 @@ def get_nearest_marker(this_trait, this_db):
return result[0][0]
#return result[0][0], result[1][0]
+def get_genofiles(this_trait):
+ jsonfile = "%s/%s.json" % (get_setting('GENOFILE_META'), this_trait.dataset.group.name)
+ try:
+ f = open(jsonfile)
+ except:
+ return None
+ jsondata = json.load(f)
+ return jsondata['genofile']
+
def get_trait_table_width(sample_groups):
table_width = 35
if sample_groups[0].se_exists():
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 e9db0a12..e7df9228 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js
@@ -168,6 +168,7 @@
//$("#progress_bar_container").modal();
url = "/marker_regression";
$('input[name=method]').val("pylmm");
+ $('input[name=genofile').val($('#genofile_pylmm').val());
$('input[name=num_perm]').val($('input[name=num_perm_pylmm]').val());
$('input[name=manhattan_plot]').val($('input[name=manhattan_plot_pylmm]:checked').val());
form_data = $('#trait_data_form').serialize();
@@ -183,6 +184,7 @@
//$("#progress_bar_container").modal();
url = "/marker_regression";
$('input[name=method]').val("rqtl_geno");
+ $('input[name=genofile').val($('#genofile_rqtl_geno').val());
$('input[name=num_perm]').val($('input[name=num_perm_rqtl_geno]').val());
$('input[name=manhattan_plot]').val($('input[name=manhattan_plot_rqtl]:checked').val());
$('input[name=control_marker]').val($('input[name=control_rqtl_geno]').val());
@@ -242,6 +244,7 @@
//$("#progress_bar_container").modal();
url = "/marker_regression";
$('input[name=method]').val("reaper");
+ $('input[name=genofile').val($('#genofile_reaper').val());
$('input[name=num_perm]').val($('input[name=num_perm_reaper]').val());
$('input[name=control_marker]').val($('input[name=control_reaper]').val());
$('input[name=do_control]').val($('input[name=do_control_reaper]:checked').val());
diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html
index 7454b650..c6112edb 100644
--- a/wqflask/wqflask/templates/marker_regression_gn1.html
+++ b/wqflask/wqflask/templates/marker_regression_gn1.html
@@ -14,6 +14,9 @@
<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 }}">
+ {% if mapping_method == "reaper" %}
+ <input type="hidden" name="genofile" value="{{ dataset.group.genofile }}">
+ {% endif %}
<input type="hidden" name="method" value="{{ mapping_method }}">
{% for sample in samples %}
<input type="hidden" name="value:{{ sample }}" value="{{ vals[loop.index - 1] }}">
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index 59e0185e..d76e8af8 100644
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -39,6 +39,7 @@
</div>
<input type="hidden" name="temp_uuid" id="temp_uuid" value="{{ temp_uuid }}">
+ <input type="hidden" name="genofile" value="">
<div class="container">
<div class="panel-group" id="accordion">
diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html
index 0f293942..149ad864 100644
--- a/wqflask/wqflask/templates/show_trait_mapping_tools.html
+++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html
@@ -32,6 +32,18 @@
{% if use_pylmm_rqtl and not use_plink_gemma and dataset.group.species != "human" %}
<div class="tab-pane active" id="interval_mapping">
<div style="margin-top: 20px" class="form-horizontal">
+ {% if genofiles and genofiles|length>0 %}
+ <div class="mapping_method_fields form-group">
+ <label for="genofiles" class="col-xs-3 control-label">Genotypes</label>
+ <div style="margin-left: 20px;" class="col-xs-8 controls">
+ <select id="genofile_reaper" class="form-control">
+ {% for item in genofiles %}
+ <option value="{{item['location']}}">{{item['title']}}</option>
+ {% endfor %}
+ </select>
+ </div>
+ </div>
+ {% endif %}
<div class="mapping_method_fields form-group">
<label for="mapping_permutations" class="col-xs-3 control-label">Permutations</label>
<div style="margin-left: 20px;" class="col-xs-4 controls">
@@ -114,6 +126,18 @@
</div>
<div class="tab-pane" id="pylmm">
<div style="margin-top: 20px" class="form-horizontal">
+ {% if genofiles and genofiles|length>0 %}
+ <div class="mapping_method_fields form-group">
+ <label for="genofiles" class="col-xs-3 control-label">Genotypes</label>
+ <div style="margin-left: 20px;" class="col-xs-8 controls">
+ <select id="genofile_pylmm" class="form-control">
+ {% for item in genofiles %}
+ <option value="{{item['location']}}">{{item['title']}}</option>
+ {% endfor %}
+ </select>
+ </div>
+ </div>
+ {% endif %}
<div class="mapping_method_fields form-group">
<label for="mapping_permutations" class="col-xs-3 control-label">Permutations</label>
<div style="margin-left: 20px;" class="col-xs-4 controls">
@@ -169,6 +193,18 @@
<div class="tab-pane" id="rqtl_geno">
<div style="margin-top: 20px" class="form-horizontal">
+ {% if genofiles and genofiles|length>0 %}
+ <div class="mapping_method_fields form-group">
+ <label for="genofiles" class="col-xs-3 control-label">Genotypes</label>
+ <div style="margin-left: 20px;" class="col-xs-8 controls">
+ <select id="genofile_rqtl_geno" class="form-control">
+ {% for item in genofiles %}
+ <option value="{{item['location']}}">{{item['title']}}</option>
+ {% endfor %}
+ </select>
+ </div>
+ </div>
+ {% endif %}
<div class="mapping_method_fields form-group">
<label for="mapping_permutations" class="col-xs-3 control-label">Permutations</label>
<div style="margin-left: 20px;" class="col-xs-4 controls">
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index ec5035ce..4f6725b3 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -468,6 +468,7 @@ def marker_regression_page():
'control_marker',
'control_marker_db',
'do_control',
+ 'genofile',
'pair_scan',
'startMb',
'endMb',