aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask
diff options
context:
space:
mode:
authorzsloan2015-07-09 19:29:30 +0000
committerzsloan2015-07-09 19:29:30 +0000
commit83ff8ce678f15f2f6003a5800a75166544d7c6fa (patch)
tree63af8dcc71f4f2709ac2af2029a7471fd46597dc /wqflask/wqflask
parent25b1d4c4aad2d44e0ff6bfa5aade1783b7a63120 (diff)
downloadgenenetwork2-83ff8ce678f15f2f6003a5800a75166544d7c6fa.tar.gz
Mapping methods now check for existing genotype files.
Currently we still usually get our samplelists from the genofile. This is dumb because it results in us having a bunch of "dummy" genofiles for certain data sets (seems to be mostly human ones). This means that checking for the genofile alone isn't enough to determine if a mapping method should exist for a given group I wrote some code that will instead get the samplelist from the plink .fam file for some of these groups/datasets (if the .fam file exists). Ideally I would like to remove all of the dummy .geno files, but we can't yet do so because it's currently the only place we seem to be storing the sample list for some groups. I also moved gemma into the plink directory to get it out of the git tree. Since it uses the same files as plink, it doesn't make sense for it to be in its own separate directory
Diffstat (limited to 'wqflask/wqflask')
-rwxr-xr-xwqflask/wqflask/show_trait/show_trait.py28
-rwxr-xr-xwqflask/wqflask/templates/show_trait_mapping_tools.html13
2 files changed, 36 insertions, 5 deletions
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 61305e9b..02472267 100755
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -16,6 +16,7 @@ from base import webqtlConfig
from base import webqtlCaseData
from wqflask.show_trait.SampleList import SampleList
from utility import webqtlUtil, Plot, Bunch, helper_functions
+from utility.tools import pylmm_command, plink_command
from base.trait import GeneralTrait
from base import data_set
from dbFunction import webqtlDatabaseFunction
@@ -23,6 +24,9 @@ from basicStatistics import BasicStatisticsFunctions
from pprint import pformat as pf
+PYLMM_PATH,PYLMM_COMMAND = pylmm_command()
+PLINK_PATH,PLINK_COMMAND = plink_command()
+
###############################################
#
# Todo: Put in security to ensure that user has permission to access confidential data sets
@@ -137,12 +141,36 @@ class ShowTrait(object):
sample_lists = [group.sample_list for group in self.sample_groups]
print("sample_lists is:", pf(sample_lists))
+ self.get_mapping_methods()
+
js_data = dict(sample_group_types = self.sample_group_types,
sample_lists = sample_lists,
attribute_names = self.sample_groups[0].attributes,
temp_uuid = self.temp_uuid)
self.js_data = js_data
+ def get_mapping_methods(self):
+ '''Only display mapping methods when the dataset group's genotype file exists'''
+ def check_plink_gemma():
+ if (os.path.isfile(PLINK_PATH+"/"+self.dataset.group.name+".bed") and
+ os.path.isfile(PLINK_PATH+"/"+self.dataset.group.name+".bim") and
+ os.path.isfile(PLINK_PATH+"/"+self.dataset.group.name+".fam") and
+ os.path.isfile(PLINK_PATH+"/"+self.dataset.group.name+".map")):
+
+ return True
+ else:
+ return False
+
+ def check_pylmm_rqtl():
+ if os.path.isfile(webqtlConfig.GENODIR+self.dataset.group.name+".geno"):
+ return True
+ else:
+ return False
+
+ self.use_plink_gemma = check_plink_gemma()
+ self.use_pylmm_rqtl = check_pylmm_rqtl()
+
+
def read_data(self, include_f1=False):
'''read user input data or from trait data and analysis form'''
diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html
index 1550647a..547da0d0 100755
--- a/wqflask/wqflask/templates/show_trait_mapping_tools.html
+++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html
@@ -1,20 +1,21 @@
<div>
+ {% if use_pylmm_rqtl or use_plink_gemma %}
<div class="col-xs-6">
<div class="tabbable"> <!-- Only required for left/right tabs -->
<ul class="nav nav-pills">
+ {% if use_pylmm_rqtl and not use_plink_gemma %}
<li class="active">
<a href="#pylmm" data-toggle="tab">pyLMM</a>
</li>
<li>
<a href="#rqtl_geno" data-toggle="tab">rqtl</a>
</li>
- {% if dataset.group.species != 'human' %}
<li>
<a href="#interval_mapping" data-toggle="tab">Interval Mapping</a>
</li>
{% endif %}
- {% if dataset.group.species == 'human' %}
+ {% if use_plink_gemma %}
<li>
<a href="#plink" data-toggle="tab">PLINK</a>
</li>
@@ -28,8 +29,8 @@
</ul>
<div class="tab-content">
+ {% if use_pylmm_rqtl %}
<div class="tab-pane active" id="pylmm">
-
<div style="padding: 20px" class="form-horizontal">
<div class="mapping_method_fields form-group">
<label for="mapping_permutations" class="col-xs-2 control-label">Permutations</label>
@@ -160,7 +161,6 @@
</div>
</div>
</div>
- {% if dataset.group.species != 'human' %}
<div class="tab-pane" id="interval_mapping">
<div style="padding: 20px" class="form-horizontal">
<div class="mapping_method_fields form-group">
@@ -214,7 +214,7 @@
</div>
</div>
{% endif %}
- {% if dataset.group.species == 'human' %}
+ {% if use_plink_gemma %}
<div class="tab-pane" id="plink">
<div style="padding: 20px" class="form-horizontal">
<div class="mapping_method_fields form-group">
@@ -272,4 +272,7 @@
<div id="mapping_result_holder_wrapper" style="display:none;">
<div id="mapping_result_holder"></div>
</div>
+ {% else %}
+ Mapping options are disabled for data not matched with genotypes.
+ {% endif %}
</div>