From a2d45b9c5593e4ecf37850db69d3bcd8c673419d Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Sat, 29 Oct 2016 05:25:37 +0000 Subject: For those case that we have multiple genotypes we would like to add a selector. --- wqflask/base/data_set.py | 6 +++- .../wqflask/marker_regression/marker_regression.py | 3 ++ wqflask/wqflask/show_trait/show_trait.py | 12 ++++++++ .../new/javascript/show_trait_mapping_tools.js | 3 ++ .../wqflask/templates/marker_regression_gn1.html | 3 ++ wqflask/wqflask/templates/show_trait.html | 1 + .../templates/show_trait_mapping_tools.html | 36 ++++++++++++++++++++++ wqflask/wqflask/views.py | 1 + 8 files changed, 64 insertions(+), 1 deletion(-) 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 37ee42a7..543eeede 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,12 +201,14 @@ 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.gen_reaper_results() elif self.mapping_method == "plink": 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..ce8b2ced 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() @@ -1260,6 +1263,15 @@ def get_nearest_marker(this_trait, this_db): else: 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 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 @@ + {% if mapping_method == "reaper" %} + + {% endif %} {% for sample in samples %} 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 @@ +
Values of record {{ this_trait.name }} in the {{ dataset.fullname }} - dataset were compared to all records in the {{ target_dataset.fullname }} +
Values of record {{ this_trait.name }} in the {{ dataset.fullname }} + dataset were compared to all records in the {{ target_dataset.fullname }} dataset. The top {{ return_number }} correlations ranked by the {{ formatted_corr_type }} are displayed. You can resort this list by clicking the headers. Select the Record ID to open the trait data and analysis page. diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 0f5e68d7..f522564d 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -1,8 +1,8 @@ {% extends "base.html" %} {% block title %}Search Results{% endblock %} {% block css %} - - + + {% endblock %} @@ -11,7 +11,7 @@ {{ header("Search Results", 'GeneNetwork found {}.'.format(numify(results|count, "record", "records"))) }} -
To study a record, click on its ID below. Check records below and click Add button to add to selection.
+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.
@@ -94,46 +94,6 @@ {% endfor %} | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- | -{{ loop.index }} | -- - {{ this_trait.name }} - - | - {% if dataset.type == 'ProbeSet' %} -{{ this_trait.symbol }} | -{{ this_trait.description_display }} | -{{ this_trait.location_repr }} | -{{ '%0.3f' % this_trait.mean|float }} | -{{ '%0.3f' % this_trait.LRS_score_repr|float }} | -{{ this_trait.LRS_location_repr }} | -{{ '%0.3f' % this_trait.additive|float }} | - {% elif dataset.type == 'Publish' %} -{{ this_trait.description_display }} | -{{ this_trait.authors }} | -- - {{ this_trait.pubmed_text }} - - | -{{ '%0.3f' % this_trait.LRS_score_repr|float }} | -{{ this_trait.LRS_location_repr }} | -{{ '%0.3f' % this_trait.additive|float }} | - {% elif dataset.type == 'Geno' %} -{{ this_trait.location_repr }} | - {% endif %} -