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 @@ +
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" %}
+ {% if genofiles and genofiles|length>0 %} +
+ +
+ +
+
+ {% endif %}
@@ -114,6 +126,18 @@
+ {% if genofiles and genofiles|length>0 %} +
+ +
+ +
+
+ {% endif %}
@@ -169,6 +193,18 @@
+ {% if genofiles and genofiles|length>0 %} +
+ +
+ +
+
+ {% endif %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 33fab84d..406f8930 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -452,6 +452,7 @@ def marker_regression_page(): 'control_marker', 'control_marker_db', 'do_control', + 'genofile', 'pair_scan', 'startMb', 'endMb', -- cgit v1.2.3 From a5feb593a1fb541278ec213909c4e37239934796 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 31 Oct 2016 20:30:22 +0000 Subject: Fix spacing --- wqflask/wqflask/marker_regression/marker_regression.py | 2 +- wqflask/wqflask/show_trait/show_trait.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 4d622f21..d9dbd0da 100644 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -201,7 +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'] + 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, diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index ce8b2ced..9a695d8e 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -1263,7 +1263,7 @@ 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: -- cgit v1.2.3 From b1a255c0990641fb4b4b8682eae3589bf0d3abb3 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 31 Oct 2016 21:02:53 +0000 Subject: Use existing GENODIR - the metadata can be stored there, next to the .geno files. --- wqflask/wqflask/show_trait/show_trait.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 9a695d8e..8aff5482 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -1265,7 +1265,7 @@ def get_nearest_marker(this_trait, this_db): #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) + jsonfile = "%s/%s.json" % (webqtlConfig.GENODIR, this_trait.dataset.group.name) try: f = open(jsonfile) except: -- cgit v1.2.3 From 717677b0c09f6ba08268db12d4889503cc2606d9 Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 2 Nov 2016 20:00:04 +0000 Subject: Added Scroller functionality to regular (but not global) search, which increases table load speed In order to implement Scroller (and make table look nicer), all rows are the same height and excess description/authors text is shown in a tooltip Increased table width for non-Geno DBs Fixed issue where Genotype traits did not fetch their location_repr (text for displaying location), causing that column to be blank in searches Fixed issue causing Correlation Matrix cells to not be colored corresponding with their correlation and also increased cell font a little Fixed issue where dataset link in the Correlation Page did not correctly point to corresponding GN1 page --- wqflask/base/data_set.py | 17 ++- wqflask/base/trait.py | 103 +++++++++++++++-- wqflask/wqflask/search_results.py | 6 +- .../static/new/javascript/create_corr_matrix.js | 79 +++++++------ .../packages/bootstrap/css/non-responsive.css | 2 +- wqflask/wqflask/templates/correlation_matrix.html | 4 +- wqflask/wqflask/templates/correlation_page.html | 4 +- wqflask/wqflask/templates/search_result_page.html | 126 ++++++++++++--------- 8 files changed, 229 insertions(+), 112 deletions(-) diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index fddfce58..04436a2e 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -271,7 +271,8 @@ class DatasetGroup(object): self.f1list = None self.parlist = None self.get_f1_parent_strains() - #logger.debug("parents/f1s: {}:{}".format(self.parlist, self.f1list)) + + self.accession_id = self.get_accession_id() self.species = webqtlDatabaseFunction.retrieve_species(self.name) @@ -279,6 +280,20 @@ class DatasetGroup(object): self.allsamples = None self._datasets = None + def get_accession_id(self): + results = g.db.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where + InbredSet.Name = %s and + PublishFreeze.InbredSetId = InbredSet.Id and + InfoFiles.InfoPageName = PublishFreeze.Name and + PublishFreeze.public > 0 and + PublishFreeze.confidentiality < 1 order by + PublishFreeze.CreateTime desc""", (self.name)).fetchone() + + if results != None: + return str(results[0]) + else: + return "None" + def get_specified_markers(self, markers = []): self.markers = HumanMarkers(self.name, markers) diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 276c624a..8788d983 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -91,16 +91,27 @@ class GeneralTrait(object): additive=self.additive ) elif self.dataset.type == "Publish": - return dict(name=self.name, - dataset=self.dataset.name, - description=self.description_display, - authors=self.authors, - pubmed_text=self.pubmed_text, - pubmed_link=self.pubmed_link, - lrs_score=self.LRS_score_repr, - lrs_location=self.LRS_location_repr, - additive=self.additive - ) + if self.pubmed_id: + return dict(name=self.name, + dataset=self.dataset.name, + description=self.description_display, + authors=self.authors, + pubmed_text=self.pubmed_text, + pubmed_link=self.pubmed_link, + lrs_score=self.LRS_score_repr, + lrs_location=self.LRS_location_repr, + additive=self.additive + ) + else: + return dict(name=self.name, + dataset=self.dataset.name, + description=self.description_display, + authors=self.authors, + pubmed_text=self.pubmed_text, + lrs_score=self.LRS_score_repr, + lrs_location=self.LRS_location_repr, + additive=self.additive + ) elif self.dataset.type == "Geno": return dict(name=self.name, dataset=self.dataset.name, @@ -109,6 +120,62 @@ class GeneralTrait(object): else: return dict() + def jsonable_table_row(self, index, search_type): + """Return a list suitable for json and intended to be displayed in a table + + Actual turning into json doesn't happen here though""" + + if self.dataset.type == "ProbeSet": + if self.mean == "": + mean = "N/A" + else: + mean = "%.3f" % round(float(self.additive), 2) + if self.additive == "": + additive = "N/A" + else: + additive = "%.3f" % round(float(self.additive), 2) + return ['', + index, + ''+str(self.name)+'', + self.symbol, + self.description_display, + self.location_repr, + mean, + self.LRS_score_repr, + self.LRS_location_repr, + additive] + elif self.dataset.type == "Publish": + if self.additive == "": + additive = "N/A" + else: + additive = "%.2f" % round(float(self.additive), 2) + if self.pubmed_id: + return ['', + index, + ''+str(self.name)+'', + self.description_display, + self.authors, + '' + self.pubmed_text + '', + self.LRS_score_repr, + self.LRS_location_repr, + additive] + else: + return ['', + index, + ''+str(self.name)+'', + self.description_display, + self.authors, + self.pubmed_text, + self.LRS_score_repr, + self.LRS_location_repr, + additive] + elif self.dataset.type == "Geno": + return ['', + index, + ''+str(self.name)+'', + self.location_repr] + else: + return dict() def get_name(self): stringy = "" @@ -418,7 +485,7 @@ class GeneralTrait(object): self.description_display = description_display #XZ: trait_location_value is used for sorting - trait_location_repr = 'N/A' + self.location_repr = 'N/A' trait_location_value = 1000000 if self.chr and self.mb: @@ -438,6 +505,18 @@ class GeneralTrait(object): self.location_repr = 'Chr%s: %.6f' % (self.chr, float(self.mb)) self.location_value = trait_location_value + elif self.dataset.type == "Geno": + self.location_repr = 'N/A' + trait_location_value = 1000000 + + if self.chr and self.mb: + #Checks if the chromosome number can be cast to an int (i.e. isn't "X" or "Y") + #This is so we can convert the location to a number used for sorting + trait_location_value = convert_location_to_value(self.chr, self.mb) + + #ZS: Put this in function currently called "convert_location_to_value" + self.location_repr = 'Chr%s: %.6f' % (self.chr, float(self.mb)) + self.location_value = trait_location_value if get_qtl_info: #LRS and its location @@ -459,7 +538,7 @@ class GeneralTrait(object): logger.sql(query) trait_qtl = g.db.execute(query).fetchone() if trait_qtl: - self.locus, self.lrs, self.pvalue, self.mean, self.additive= trait_qtl + self.locus, self.lrs, self.pvalue, self.mean, self.additive = trait_qtl if self.locus: query = """ select Geno.Chr, Geno.Mb from Geno, Species diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index a924c7c9..cae6868e 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -86,12 +86,13 @@ views.py). """ self.trait_list = [] + json_trait_list = [] species = webqtlDatabaseFunction.retrieve_species(self.dataset.group.name) # result_set represents the results for each search term; a search of # "shh grin2b" would have two sets of results, one for each term logger.debug("self.results is:", pf(self.results)) - for result in self.results: + for index, result in enumerate(self.results): if not result: continue @@ -101,6 +102,9 @@ views.py). trait_id = result[0] this_trait = GeneralTrait(dataset=self.dataset, name=trait_id, get_qtl_info=True, get_sample_info=False) self.trait_list.append(this_trait) + json_trait_list.append(this_trait.jsonable_table_row(index + 1)) + + self.json_trait_list = json.dumps(json_trait_list) #def get_group_species_tree(self): # self.species_groups = collections.default_dict(list) diff --git a/wqflask/wqflask/static/new/javascript/create_corr_matrix.js b/wqflask/wqflask/static/new/javascript/create_corr_matrix.js index adb91295..a34fc408 100644 --- a/wqflask/wqflask/static/new/javascript/create_corr_matrix.js +++ b/wqflask/wqflask/static/new/javascript/create_corr_matrix.js @@ -1,48 +1,47 @@ // Generated by CoffeeScript 1.8.0 -var get_data, get_options, root; +// var get_data, get_options, root; -root = typeof exports !== "undefined" && exports !== null ? exports : this; +// root = typeof exports !== "undefined" && exports !== null ? exports : this; -$(function() { - var chartOpts, data, mychart; - console.log("js_data:", js_data); - chartOpts = get_options(); - data = get_data(); - console.log(data); - return mychart = corr_matrix(data, chartOpts); -}); +// $(function() { + // var chartOpts, data, mychart; + // console.log("js_data:", js_data); + // chartOpts = get_options(); + // data = get_data(); + // console.log(data); + // return mychart = corr_matrix(data, chartOpts); +// }); -get_options = function() { - var chartOpts; - chartOpts = { - cortitle: "Correlation Matrix", - scattitle: "Scatterplot", - h: 450, - w: 450, - margin: { - left: 100, - top: 40, - right: 5, - bottom: 70, - inner: 5 - } - }; - return chartOpts; -}; - -get_data = function() { - var data; - data = {}; - data["var"] = js_data.traits; - data.group = js_data.groups; - data.indID = js_data.samples; - data.dat = js_data.sample_data; - data.corr = js_data.corr_results; - data.cols = js_data.cols; - data.rows = js_data.rows; - return data; -}; +// get_options = function() { + // var chartOpts; + // chartOpts = { + // cortitle: "Correlation Matrix", + // scattitle: "Scatterplot", + // h: 450, + // w: 450, + // margin: { + // left: 100, + // top: 40, + // right: 5, + // bottom: 70, + // inner: 5 + // } + // }; + // return chartOpts; +// }; +// get_data = function() { + // var data; + // data = {}; + // data["var"] = js_data.traits; + // data.group = js_data.groups; + // data.indID = js_data.samples; + // data.dat = js_data.sample_data; + // data.corr = js_data.corr_results; + // data.cols = js_data.cols; + // data.rows = js_data.rows; + // return data; +// }; var neg_color_scale = chroma.scale(['#FF0000', 'white']).domain([-1, -0.4]); var pos_color_scale = chroma.scale(['white', 'aqua']).domain([0.4, 1]) diff --git a/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css b/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css index 076b6dae..9da73a8f 100644 --- a/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css +++ b/wqflask/wqflask/static/packages/bootstrap/css/non-responsive.css @@ -28,7 +28,7 @@ body { /* Reset the container */ .container { - width: 1200px; + width: 1400px; max-width: none !important; } diff --git a/wqflask/wqflask/templates/correlation_matrix.html b/wqflask/wqflask/templates/correlation_matrix.html index 593c7bea..d847614a 100644 --- a/wqflask/wqflask/templates/correlation_matrix.html +++ b/wqflask/wqflask/templates/correlation_matrix.html @@ -36,7 +36,7 @@ {% if result[0].name == trait.name %} n
{{ result[2] }}
{% else %} - {{ '%0.3f' % result[1] }}
{{ result[2] }}
+ {{ '%0.3f' % result[1] }}
{{ result[2] }}
{% endif %} {% endfor %} @@ -85,6 +85,7 @@ {% block js %} @@ -98,5 +99,6 @@ + {% endblock %} diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html index c5b4477b..dab196cb 100644 --- a/wqflask/wqflask/templates/correlation_page.html +++ b/wqflask/wqflask/templates/correlation_page.html @@ -14,8 +14,8 @@

Correlation Table

-

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"))) }} -

+
@@ -44,7 +44,7 @@ {% endfor %}

-

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.


@@ -79,7 +79,7 @@ -->
- +
@@ -94,46 +94,6 @@ {% endfor %} - - - {% for this_trait in trait_list %} - - - - - {% if dataset.type == 'ProbeSet' %} - - - - - - - - {% elif dataset.type == 'Publish' %} - - - - - - - {% elif dataset.type == 'Geno' %} - - {% endif %} - - {% endfor %} - {% if trait_list|length > 20 %} @@ -171,6 +131,10 @@ + + + + + + + + + + - + {% endblock %} + diff --git a/wqflask/wqflask/templates/ctl_setup.html b/wqflask/wqflask/templates/ctl_setup.html index a05379a8..992494dd 100644 --- a/wqflask/wqflask/templates/ctl_setup.html +++ b/wqflask/wqflask/templates/ctl_setup.html @@ -11,7 +11,13 @@ Please make sure you select enough traits to perform CTL. Your collection needs to contain at least 2 different traits. You provided {{request.form['trait_list'].split(',')|length}} traits as input. {% else %} -

CTL analysis parameters

+

CTL analysis

+ CTL analysis is published as open source software, if you are using this method in your publications, please cite:

+ Arends D, Li Y, Brockmann GA, Jansen RC, Williams RW, Prins P
+ Correlation trait locus (CTL) mapping: Phenotype network inference subject to genotype.
+ The Journal of Open Source Software (2016)
+ http://joss.theoj.org/papers/10.21105/joss.00087 +

{{(request.form['trait_list'].split(',')|length)}} traits as input -- cgit v1.2.3 From 3fc1902c20d37038e06e94f02a7ff0bb288e0e4d Mon Sep 17 00:00:00 2001 From: DannyArends Date: Mon, 7 Nov 2016 17:16:10 +0100 Subject: Adding functions addNode and addEdge, to separate out the cytoscape graph creation from the main CTL analysis code --- wqflask/wqflask/ctl/ctl_analysis.py | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/wqflask/wqflask/ctl/ctl_analysis.py b/wqflask/wqflask/ctl/ctl_analysis.py index e21b8500..3d2d7a37 100644 --- a/wqflask/wqflask/ctl/ctl_analysis.py +++ b/wqflask/wqflask/ctl/ctl_analysis.py @@ -79,6 +79,26 @@ class CTL(object): self.edges_list = [] print("Obtained pointers to CTL functions") + def addNode(self, gt): + node_dict = { 'data' : {'id' : str(gt.name) + ":" + str(gt.dataset.name), + 'sid' : str(gt.name), + 'dataset' : str(gt.dataset.name), + 'label' : gt.name, + 'symbol' : gt.symbol, + 'geneid' : gt.geneid, + 'omim' : gt.omim } } + self.nodes_list.append(node_dict) + + def addEdge(self, gtS, gtT, significant, x): + edge_data = {'id' : str(gtS.symbol) + '_' + significant[1][x] + '_' + str(gtT.symbol), + 'source' : str(gtS.name) + ":" + str(gtS.dataset.name), + 'target' : str(gtT.name) + ":" + str(gtT.dataset.name), + 'lod' : significant[3][x], + 'color' : "#ff0000", + 'width' : significant[3][x] } + edge_dict = { 'data' : edge_data } + self.edges_list.append(edge_dict) + def run_analysis(self, requestform): print("Starting CTL analysis on dataset") self.trait_db_list = [trait.strip() for trait in requestform['trait_list'].split(',')] @@ -162,7 +182,7 @@ class CTL(object): self.r_lineplot(res, significance = significance) r_dev_off() - n = 2 + n = 2 # We start from 2, since R starts from 1 :) for trait in self.trait_db_list: # Create the QTL like CTL plots self.results['imgurl' + str(n)] = webqtlUtil.genRandStr("CTL_") + ".png" @@ -175,23 +195,7 @@ class CTL(object): # Flush any output from R sys.stdout.flush() - # Create the interactive graph for cytoscape visualization (Nodes) - # TODO DA : make this a function - for trait in self.trait_db_list: - if trait != "": - ts = trait.split(':') - gt = TRAIT.GeneralTrait(name = ts[0], dataset_name = ts[1]) - node_dict = { 'data' : {'id' : str(gt.name) + ":" + str(gt.dataset.name), - 'sid' : str(gt.name), - 'dataset' : str(gt.dataset.name), - 'label' : gt.name, - 'symbol' : gt.symbol, - 'geneid' : gt.geneid, - 'omim' : gt.omim } } - self.nodes_list.append(node_dict) - - # Create the interactive graph for cytoscape visualization (Edges) - # TODO DA : make this a function + # Create the interactive graph for cytoscape visualization (Nodes and Edges) print(type(significant)) if not type(significant) == ri.RNULLType: for x in range(len(significant[0])): @@ -200,16 +204,12 @@ class CTL(object): tsT = significant[2][x].split(':') # Target gtS = TRAIT.GeneralTrait(name = tsS[0], dataset_name = tsS[1]) # Retrieve Source info from the DB gtT = TRAIT.GeneralTrait(name = tsT[0], dataset_name = tsT[1]) # Retrieve Target info from the DB - edge_data = {'id' : str(gtS.symbol) + '_' + significant[1][x] + '_' + str(gtT.symbol), - 'source' : str(gtS.name) + ":" + str(gtS.dataset.name), - 'target' : str(gtT.name) + ":" + str(gtT.dataset.name), - 'lod' : significant[3][x], - 'color' : "#ff0000", - 'width' : significant[3][x] } - edge_dict = { 'data' : edge_data } - self.edges_list.append(edge_dict) - significant[0][x] = gtS.symbol + " (" + gtS.name + ")" - significant[2][x] = gtT.symbol + " (" + gtT.name + ")" + self.addNode(gtS) + self.addNode(gtT) + self.addEdge(gtS, gtT, significant, x) + + significant[0][x] = gtS.symbol + " (" + gtS.name + ")" # Update the trait name for the displayed table + significant[2][x] = gtT.symbol + " (" + gtT.name + ")" # Update the trait name for the displayed table self.elements = json.dumps(self.nodes_list + self.edges_list) -- cgit v1.2.3 From fa2ce04bf512cf393b504c50510af450c14459b9 Mon Sep 17 00:00:00 2001 From: DannyArends Date: Tue, 8 Nov 2016 18:48:50 +0100 Subject: Adding the joss badge --- wqflask/wqflask/templates/ctl_setup.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wqflask/wqflask/templates/ctl_setup.html b/wqflask/wqflask/templates/ctl_setup.html index 992494dd..a7ad5759 100644 --- a/wqflask/wqflask/templates/ctl_setup.html +++ b/wqflask/wqflask/templates/ctl_setup.html @@ -16,7 +16,7 @@ Arends D, Li Y, Brockmann GA, Jansen RC, Williams RW, Prins P
Correlation trait locus (CTL) mapping: Phenotype network inference subject to genotype.
The Journal of Open Source Software (2016)
- http://joss.theoj.org/papers/10.21105/joss.00087 + Published in

{{(request.form['trait_list'].split(',')|length)}} traits as input -- cgit v1.2.3 From e6528ba528d14320322bcf9694c52879dedc418b Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Tue, 8 Nov 2016 20:09:36 +0000 Subject: README --- doc/README.org | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/README.org b/doc/README.org index 9c57953d..b38ea664 100644 --- a/doc/README.org +++ b/doc/README.org @@ -116,6 +116,12 @@ git clone --branch gn-deploy --recursive https://github.com/genenetwork/guix gui cd guix-gn-deploy #+end_src bash +To test whether this is working try: + +#+begin_src bash +#+end_src bash + + ** Step 3: Authorize the GN Guix server GN2 has its own GNU Guix binary distribution server. To trust it you have @@ -165,13 +171,16 @@ And install with #+begin_src bash env GUIX_PACKAGE_PATH=~/genenetwork/guix-bioinformatics/ \ guix package -i genenetwork2 \ - --substitute-urls="http://guix.genenetwork.org https://mirror.guixsd.org" \ - --fallback + --substitute-urls="http://guix.genenetwork.org" #+end_src Note: the order of the substitute url's may make a difference in speed (put the one first that is fastest for your location and time of day). +Note: if your system starts building or gives an error it may well be +Step 3 did not succeed. The installation should actually be smooth at +this point and only do binary installs (no compiling). + After installation you should be able to run genenetwork2 after updating the Guix suggested environment vars. Check the output of -- cgit v1.2.3 From 7b83c8c46977942acb271e7f1cf187d00bc7ff5a Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 11 Nov 2016 16:13:24 +0000 Subject: Fixed problem that caused checkboxes to not work with Scroller search results pages Improved the way the table width is set for search results page --- wqflask/base/trait.py | 14 +++-- wqflask/wqflask/templates/search_result_page.html | 67 ++++++++++++++++++++--- 2 files changed, 67 insertions(+), 14 deletions(-) diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 11a91d1d..c8c503e2 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -23,6 +23,8 @@ from flask import Flask, g, request from utility.logger import getLogger logger = getLogger(__name__ ) +from wqflask import user_manager + def print_mem(stage=""): mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss print("{}: {}".format(stage, mem/1024)) @@ -134,7 +136,7 @@ class GeneralTrait(object): additive = "N/A" else: additive = "%.3f" % round(float(self.additive), 2) - return ['', + return ['', index, ''+str(self.name)+'', self.symbol, @@ -150,7 +152,7 @@ class GeneralTrait(object): else: additive = "%.2f" % round(float(self.additive), 2) if self.pubmed_id: - return ['', + return ['', index, ''+str(self.name)+'', self.description_display, @@ -160,7 +162,7 @@ class GeneralTrait(object): self.LRS_location_repr, additive] else: - return ['', + return ['', index, ''+str(self.name)+'', self.description_display, @@ -170,7 +172,7 @@ class GeneralTrait(object): self.LRS_location_repr, additive] elif self.dataset.type == "Geno": - return ['', + return ['', index, ''+str(self.name)+'', self.location_repr] @@ -486,7 +488,7 @@ class GeneralTrait(object): #XZ: trait_location_value is used for sorting self.location_repr = 'N/A' - trait_location_value = 1000000 + self.location_value = 1000000 if self.chr and self.mb: #Checks if the chromosome number can be cast to an int (i.e. isn't "X" or "Y") @@ -507,7 +509,7 @@ class GeneralTrait(object): elif self.dataset.type == "Geno": self.location_repr = 'N/A' - trait_location_value = 1000000 + self.location_value = 1000000 if self.chr and self.mb: #Checks if the chromosome number can be cast to an int (i.e. isn't "X" or "Y") diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index f522564d..f8565042 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -2,7 +2,7 @@ {% block title %}Search Results{% endblock %} {% block css %} - + {% endblock %} @@ -11,7 +11,7 @@ {{ header("Search Results", 'GeneNetwork found {}.'.format(numify(results|count, "record", "records"))) }} -
+
@@ -78,8 +78,8 @@ {% endif %} --> -
-
- {{ loop.index }} - - {{ this_trait.name }} - - {{ 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 }}{{ 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 }}{{ this_trait.location_repr }}
+
+
@@ -122,7 +122,7 @@ {% endblock %} {% block js %} - + @@ -144,10 +144,45 @@ } }); + function change_buttons() { + buttons = ["#add", "#remove"]; + num_checked = $('.trait_checkbox:checked').length; + if (num_checked === 0) { + for (_i = 0, _len = buttons.length; _i < _len; _i++) { + button = buttons[_i]; + $(button).prop("disabled", true); + } + } else { + for (_j = 0, _len2 = buttons.length; _j < _len2; _j++) { + button = buttons[_j]; + $(button).prop("disabled", false); + } + } + //}); + if ($(this).is(":checked")) { + if (!$(this).closest('tr').hasClass('selected')) { + $(this).closest('tr').addClass('selected') + } + } + else { + if ($(this).closest('tr').hasClass('selected')) { + $(this).closest('tr').removeClass('selected') + } + } + } + console.time("Creating table"); {% if dataset.type == 'ProbeSet' %} //ZS: Need to make sort by symbol, also need to make sure blank symbol fields at the bottom and symbols starting with numbers below letters $('#trait_table').DataTable( { + "drawCallback": function( settings ) { + $('#trait_table tr').click(function(event) { + if (event.target.type !== 'checkbox') { + $(':checkbox', this).trigger('click'); + } + }); + $('.trait_checkbox:checkbox').on("change", change_buttons); + }, "createdRow": function ( row, data, index ) { $('td', row).eq(1).attr('align', 'right'); $('td', row).eq(1).attr('data-export', index+1); @@ -187,7 +222,7 @@ "iDisplayLength": -1, "deferRender": true, "bSortClasses": false, - "scrollY": "700px", + "scrollY": true, "scrollCollapse": false, "scroller": true, "paging": false @@ -195,6 +230,14 @@ {% elif dataset.type == 'Publish' %} $('#trait_table').DataTable( { + "drawCallback": function( settings ) { + $('#trait_table tr').click(function(event) { + if (event.target.type !== 'checkbox') { + $(':checkbox', this).trigger('click'); + } + }); + $('.trait_checkbox:checkbox').on("change", change_buttons); + }, "createdRow": function ( row, data, index ) { $('td', row).eq(1).attr('align', 'right'); $('td', row).eq(1).attr('data-export', index+1); @@ -234,13 +277,21 @@ "autoWidth": false, "deferRender": true, "bSortClasses": false, - "scrollY": "700px", + "scrollY": true, "scrollCollapse": true, "scroller": true, "paging": false } ); {% elif dataset.type == 'Geno' %} $('#trait_table').DataTable( { + "drawCallback": function( settings ) { + $('#trait_table tr').click(function(event) { + if (event.target.type !== 'checkbox') { + $(':checkbox', this).trigger('click'); + } + }); + $('.trait_checkbox:checkbox').on("change", change_buttons); + }, "createdRow": function ( row, data, index ) { $('td', row).eq(1).attr('align', 'right'); $('td', row).eq(1).attr('data-export', index+1); @@ -260,7 +311,7 @@ "autoWidth": false, "deferRender": true, "bSortClasses": false, - "scrollY": "700px", + "scrollY": true, "scrollCollapse": true, "scroller": true, "paging": false -- cgit v1.2.3 From 21f8d536207c851545b7b3eb31df685bc636b20a Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 11 Nov 2016 16:36:20 +0000 Subject: Fixed error causing correlation matrix page to not work with 2 traits (related to factor loadings table) Also improved factor loads table to show only two factors when there are two traits Fixed error related to get_traits_from_collections.js being called in collections/list before jquery is defined --- wqflask/wqflask/correlation_matrix/show_corr_matrix.py | 6 +++++- .../static/new/javascript/get_traits_from_collection.js | 12 +++++------- wqflask/wqflask/templates/collections/list.html | 7 +++---- wqflask/wqflask/templates/correlation_matrix.html | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index 70e21917..630980c7 100644 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -207,7 +207,11 @@ class CorrelationMatrix(object): print("before loop:", self.loadings[0]) for i in range(len(self.trait_list)): loadings_row = [] - for j in range(3): + if len(self.trait_list) > 2: + the_range = 3 + else: + the_range = 2 + for j in range(the_range): position = i + len(self.trait_list)*j loadings_row.append(self.loadings[0][position]) loadings_array.append(loadings_row) diff --git a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js index a73eafe4..bcd83889 100644 --- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js +++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js @@ -226,10 +226,8 @@ back_to_collections = function() { return $('#collections_holder').colorbox.resize(); }; -$(function() { - console.log("inside get_traits_from_collection"); - $(document).on("click", ".collection_line", collection_click); - $(document).on("click", "#submit", submit_click); - $(document).on("click", ".trait", trait_click); - return $(document).on("click", "#back_to_collections", back_to_collections); -}); +console.log("inside get_traits_from_collection"); +$(".collection_line").on("click", collection_click); +$("#submit").on("click", submit_click); +$(".trait").on("click", trait_click); +$("#back_to_collections").on("click", back_to_collections); \ No newline at end of file diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html index 23e976e9..e38b32a0 100644 --- a/wqflask/wqflask/templates/collections/list.html +++ b/wqflask/wqflask/templates/collections/list.html @@ -54,10 +54,6 @@ {% endfor %}
- - {# if "color_by_trait" in params #} - - {# endif #}
@@ -78,6 +74,9 @@ + {% if "color_by_trait" in params %} + + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index f7b450c1..cafa8b93 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -3,6 +3,7 @@ {% block css %} + {% endblock %} {% block content %} @@ -125,9 +126,8 @@ - - - + + + +{% endblock %} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 4f6725b3..4f46a904 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -50,6 +50,7 @@ from wqflask.correlation_matrix import show_corr_matrix from wqflask.correlation import corr_scatter_plot from wqflask.wgcna import wgcna_analysis from wqflask.ctl import ctl_analysis +from wqflask.submit_trait import get_species_groups from utility import temp_data from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL,GN_VERSION @@ -294,6 +295,11 @@ def environments(): doc = docs.Docs("environments") return render_template("docs.html", **doc.__dict__) +@app.route("/submit_trait") +def submit_trait(): + species_and_groups = get_species_groups() + return render_template("submit_trait.html", **{'species_and_groups' : species_and_groups, 'gn_server_url' : GN_SERVER_URL, 'version' : GN_VERSION}) + @app.route('/export_trait_excel', methods=('POST',)) def export_trait_excel(): """Excel file consisting of the sample data from the trait data and analysis page""" @@ -440,6 +446,57 @@ def heatmap_page(): def mapping_results_container_page(): return render_template("mapping_results_container.html") +@app.route("/loading", methods=('POST',)) +def loading_page(): + initial_start_vars = request.form + logger.debug("Marker regression called with initial_start_vars:", initial_start_vars.items()) + temp_uuid = initial_start_vars['temp_uuid'] + wanted = ( + 'trait_id', + 'dataset', + 'method', + 'trimmed_markers', + 'selected_chr', + 'chromosomes', + 'mapping_scale', + 'score_type', + 'suggestive', + 'significant', + 'num_perm', + 'permCheck', + 'perm_output', + 'num_bootstrap', + 'bootCheck', + 'bootstrap_results', + 'LRSCheck', + 'maf', + 'manhattan_plot', + 'control_marker', + 'control_marker_db', + 'do_control', + 'genofile', + 'pair_scan', + 'startMb', + 'endMb', + 'graphWidth', + 'lrsMax', + 'additiveCheck', + 'showSNP', + 'showGenes', + 'viewLegend', + 'haplotypeAnalystCheck', + 'mapmethod_rqtl_geno', + 'mapmodel_rqtl_geno' + ) + start_vars = {} + for key, value in initial_start_vars.iteritems(): + if key in wanted or key.startswith(('value:')): + start_vars[key] = value + + rendered_template = render_template("loading.html", **start_vars) + + return rendered_template + @app.route("/marker_regression", methods=('POST',)) def marker_regression_page(): initial_start_vars = request.form -- cgit v1.2.3 From f2e3407585862581b82680e8521b1e4d944f558a Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 6 Feb 2017 20:01:03 +0000 Subject: Fixed appearance of several tables (search, mapping results, sample data) Temporarily removed second sample table for CFW traits Fixed location of global search bar to work with wider screens --- wqflask/base/data_set.py | 143 ++--- wqflask/utility/helper_functions.py | 20 + wqflask/utility/tools.py | 1 + .../marker_regression/marker_regression_gn1.py | 22 +- wqflask/wqflask/show_trait/show_trait.py | 593 +-------------------- .../new/javascript/dataset_menu_structure.json | 215 ++++---- .../new/javascript/show_trait_mapping_tools.js | 10 +- .../packages/DataTables/css/jquery.dataTables.css | 2 +- wqflask/wqflask/submit_trait.py | 24 - wqflask/wqflask/templates/base.html | 4 +- wqflask/wqflask/templates/data_sharing.html | 2 +- wqflask/wqflask/templates/gsearch_gene.html | 10 +- wqflask/wqflask/templates/links.html | 2 +- wqflask/wqflask/templates/loading.html | 32 +- .../wqflask/templates/marker_regression_gn1.html | 88 ++- wqflask/wqflask/templates/policies.html | 2 +- wqflask/wqflask/templates/reference.html | 2 +- wqflask/wqflask/templates/search_result_page.html | 26 +- wqflask/wqflask/templates/show_trait.html | 8 +- wqflask/wqflask/templates/show_trait_details.html | 2 +- .../wqflask/templates/show_trait_edit_data.html | 6 +- .../templates/show_trait_mapping_tools.html | 16 +- wqflask/wqflask/templates/submit_trait.html | 44 +- wqflask/wqflask/views.py | 24 +- 24 files changed, 404 insertions(+), 894 deletions(-) delete mode 100644 wqflask/wqflask/submit_trait.py diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 94b38e13..30c8e996 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -273,6 +273,7 @@ class DatasetGroup(object): self.get_f1_parent_strains() self.accession_id = self.get_accession_id() + self.mapping_id, self.mapping_names = self.get_mapping_methods() self.species = webqtlDatabaseFunction.retrieve_species(self.name) @@ -295,6 +296,20 @@ class DatasetGroup(object): else: return "None" + def get_mapping_methods(self): + + mapping_id = g.db.execute("select MappingMethodId from InbredSet where Name= '%s'" % self.name).fetchone()[0] + if mapping_id == "1": + mapping_names = ["QTLReaper", "PYLMM", "R/qtl"] + elif mapping_id == "2": + mapping_names = ["GEMMA"] + elif mapping_id == "4": + mapping_names = ["PLINK"] + else: + mapping_names = [] + + return mapping_id, mapping_names + def get_specified_markers(self, markers = []): self.markers = HumanMarkers(self.name, markers) @@ -317,69 +332,6 @@ class DatasetGroup(object): self.markers = marker_class(self.name) - def datasets(self): - key = "group_dataset_menu:v2:" + self.name - logger.debug("key is2:", key) - dataset_menu = [] - logger.debug("[tape4] webqtlConfig.PUBLICTHRESH:", webqtlConfig.PUBLICTHRESH) - logger.debug("[tape4] type webqtlConfig.PUBLICTHRESH:", type(webqtlConfig.PUBLICTHRESH)) - the_results = fetchall(''' - (SELECT '#PublishFreeze',PublishFreeze.FullName,PublishFreeze.Name - FROM PublishFreeze,InbredSet - WHERE PublishFreeze.InbredSetId = InbredSet.Id - and InbredSet.Name = '%s' - and PublishFreeze.public > %s) - UNION - (SELECT '#GenoFreeze',GenoFreeze.FullName,GenoFreeze.Name - FROM GenoFreeze, InbredSet - WHERE GenoFreeze.InbredSetId = InbredSet.Id - and InbredSet.Name = '%s' - and GenoFreeze.public > %s) - UNION - (SELECT Tissue.Name, ProbeSetFreeze.FullName,ProbeSetFreeze.Name - FROM ProbeSetFreeze, ProbeFreeze, InbredSet, Tissue - WHERE ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id - and ProbeFreeze.TissueId = Tissue.Id - and ProbeFreeze.InbredSetId = InbredSet.Id - and InbredSet.Name like %s - and ProbeSetFreeze.public > %s - ORDER BY Tissue.Name, ProbeSetFreeze.CreateTime desc, ProbeSetFreeze.AvgId) - ''' % (self.name, webqtlConfig.PUBLICTHRESH, - self.name, webqtlConfig.PUBLICTHRESH, - "'" + self.name + "'", webqtlConfig.PUBLICTHRESH)) - - #for tissue_name, dataset in itertools.groupby(the_results, itemgetter(0)): - for dataset_item in the_results: - tissue_name = dataset_item[0] - dataset = dataset_item[1] - dataset_short = dataset_item[2] - if tissue_name in ['#PublishFreeze', '#GenoFreeze']: - dataset_menu.append(dict(tissue=None, datasets=[(dataset, dataset_short)])) - else: - dataset_sub_menu = [item[1:] for item in dataset] - - tissue_already_exists = False - tissue_position = None - for i, tissue_dict in enumerate(dataset_menu): - if tissue_dict['tissue'] == tissue_name: - tissue_already_exists = True - tissue_position = i - break - - if tissue_already_exists: - #logger.debug("dataset_menu:", dataset_menu[i]['datasets']) - dataset_menu[i]['datasets'].append((dataset, dataset_short)) - else: - dataset_menu.append(dict(tissue=tissue_name, - datasets=[(dataset, dataset_short)])) - - if USE_REDIS: - Redis.set(key, pickle.dumps(dataset_menu, pickle.HIGHEST_PROTOCOL)) - Redis.expire(key, 60*5) - self._datasets = dataset_menu - - return self._datasets - def get_f1_parent_strains(self): try: # NL, 07/27/2010. ParInfo has been moved from webqtlForm.py to webqtlUtil.py; @@ -456,6 +408,71 @@ class DatasetGroup(object): return genotype +def datasets(group_name, this_group = None): + key = "group_dataset_menu:v2:" + group_name + logger.debug("key is2:", key) + dataset_menu = [] + logger.debug("[tape4] webqtlConfig.PUBLICTHRESH:", webqtlConfig.PUBLICTHRESH) + logger.debug("[tape4] type webqtlConfig.PUBLICTHRESH:", type(webqtlConfig.PUBLICTHRESH)) + the_results = fetchall(''' + (SELECT '#PublishFreeze',PublishFreeze.FullName,PublishFreeze.Name + FROM PublishFreeze,InbredSet + WHERE PublishFreeze.InbredSetId = InbredSet.Id + and InbredSet.Name = '%s' + and PublishFreeze.public > %s) + UNION + (SELECT '#GenoFreeze',GenoFreeze.FullName,GenoFreeze.Name + FROM GenoFreeze, InbredSet + WHERE GenoFreeze.InbredSetId = InbredSet.Id + and InbredSet.Name = '%s' + and GenoFreeze.public > %s) + UNION + (SELECT Tissue.Name, ProbeSetFreeze.FullName,ProbeSetFreeze.Name + FROM ProbeSetFreeze, ProbeFreeze, InbredSet, Tissue + WHERE ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id + and ProbeFreeze.TissueId = Tissue.Id + and ProbeFreeze.InbredSetId = InbredSet.Id + and InbredSet.Name like %s + and ProbeSetFreeze.public > %s + ORDER BY Tissue.Name, ProbeSetFreeze.CreateTime desc, ProbeSetFreeze.AvgId) + ''' % (group_name, webqtlConfig.PUBLICTHRESH, + group_name, webqtlConfig.PUBLICTHRESH, + "'" + group_name + "'", webqtlConfig.PUBLICTHRESH)) + + #for tissue_name, dataset in itertools.groupby(the_results, itemgetter(0)): + for dataset_item in the_results: + tissue_name = dataset_item[0] + dataset = dataset_item[1] + dataset_short = dataset_item[2] + if tissue_name in ['#PublishFreeze', '#GenoFreeze']: + dataset_menu.append(dict(tissue=None, datasets=[(dataset, dataset_short)])) + else: + dataset_sub_menu = [item[1:] for item in dataset] + + tissue_already_exists = False + tissue_position = None + for i, tissue_dict in enumerate(dataset_menu): + if tissue_dict['tissue'] == tissue_name: + tissue_already_exists = True + tissue_position = i + break + + if tissue_already_exists: + #logger.debug("dataset_menu:", dataset_menu[i]['datasets']) + dataset_menu[i]['datasets'].append((dataset, dataset_short)) + else: + dataset_menu.append(dict(tissue=tissue_name, + datasets=[(dataset, dataset_short)])) + + if USE_REDIS: + Redis.set(key, pickle.dumps(dataset_menu, pickle.HIGHEST_PROTOCOL)) + Redis.expire(key, 60*5) + + if this_group != None: + this_group._datasets = dataset_menu + return this_group._datasets + else: + return dataset_menu class DataSet(object): """ diff --git a/wqflask/utility/helper_functions.py b/wqflask/utility/helper_functions.py index 377f6b26..cf16879f 100644 --- a/wqflask/utility/helper_functions.py +++ b/wqflask/utility/helper_functions.py @@ -5,6 +5,9 @@ from base import data_set from base.species import TheSpecies from wqflask import user_manager + +from flask import Flask, g + import logging logger = logging.getLogger(__name__ ) @@ -41,3 +44,20 @@ def get_trait_db_obs(self, trait_db_list): name=trait_name, cellid=None) self.trait_list.append((trait_ob, dataset_ob)) + +def get_species_groups(): + + species_query = "SELECT SpeciesId, MenuName FROM Species" + species_ids_and_names = g.db.execute(species_query).fetchall() + + species_and_groups = [] + for species_id, species_name in species_ids_and_names: + this_species_groups = {} + this_species_groups['species'] = species_name + groups_query = "SELECT InbredSetName FROM InbredSet WHERE SpeciesId = %s" % (species_id) + groups = [group[0] for group in g.db.execute(groups_query).fetchall()] + + this_species_groups['groups'] = groups + species_and_groups.append(this_species_groups) + + return species_and_groups diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 8db9ac6e..c28c617a 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -212,6 +212,7 @@ USE_REDIS = get_setting_bool('USE_REDIS') USE_GN_SERVER = get_setting_bool('USE_GN_SERVER') GENENETWORK_FILES = get_setting('GENENETWORK_FILES') +TEMP_TRAITS = get_setting('TEMP_TRAITS') PYLMM_COMMAND = pylmm_command() GEMMA_COMMAND = gemma_command() diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py index 9ff431a2..814ffb30 100644 --- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py +++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py @@ -986,9 +986,25 @@ class MarkerRegression(object): except: return + previous_chr = 1 + previous_chr_as_int = 0 + if self.plotScale == "physic": + this_chr = str(self.ChrList[self.selectedChr][0]) + else: + this_chr = str(self.ChrList[self.selectedChr][1]+1) + # for i, qtlresult in enumerate(self.qtlresults): + # if Chr == this_chr: + # if Mb < self.startMb or Mb > self.endMb: + # return + # else: + # locPixel = xLeftOffset + (Mb-self.startMb)*plotXScale + # break + # elif self.selectedChr == -1: + # if str(qtlresult['chr']) != Chr: + if self.plotScale == 'physic': if self.selectedChr > -1: - if self.genotype[0].name != Chr or Mb < self.startMb or Mb > self.endMb: + if this_chr != Chr or Mb < self.startMb or Mb > self.endMb: return else: locPixel = xLeftOffset + (Mb-self.startMb)*plotXScale @@ -2019,6 +2035,8 @@ class MarkerRegression(object): AdditiveCoordXY = [] DominanceCoordXY = [] + symbolFont = pid.Font(ttf="fnt_bs", size=5,bold=0) #ZS: For Manhattan Plot + previous_chr = 1 previous_chr_as_int = 0 lineWidth = 1 @@ -2122,7 +2140,7 @@ class MarkerRegression(object): # Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRS_LOD_Max if self.manhattan_plot == True: - canvas.drawEllipse(Xc-1, Yc-1, Xc+1, Yc+1, fillColor=pid.black) + canvas.drawString("5", Xc-canvas.stringWidth("5",font=symbolFont)/2+1,Yc+2,color=pid.black, font=symbolFont) else: LRSCoordXY.append((Xc, Yc)) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 13ae933f..3e145e40 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -48,60 +48,23 @@ class ShowTrait(object): helper_functions.get_species_dataset_trait(self, kw) else: self.temp_trait = True - self.create_temp_trait() + self.trait_vals = kw['trait_paste'].split() + self.temp_group = kw['group'] + self.temp_species = kw['species'] + #self.create_temp_trait() #self.dataset.group.read_genotype_file() - # Todo: Add back in the ones we actually need from below, as we discover we need them - hddn = OrderedDict() - - ## Some fields, like method, are defaulted to None; otherwise in IE the field can't be changed using jquery - #hddn = OrderedDict( - # FormID = fmID, - # group = fd.group, - # submitID = '', - # scale = 'physic', - # additiveCheck = 'ON', - # showSNP = 'ON', - # showGenes = 'ON', - # method = None, - # parentsf14regression = 'OFF', - # stats_method = '1', - # chromosomes = '-1', - # topten = '', - # viewLegend = 'ON', - # intervalAnalystCheck = 'ON', - # valsHidden = 'OFF', - # database = '', - # criteria = None, - # MDPChoice = None, - # bootCheck = None, - # permCheck = None, - # applyVarianceSE = None, - # sampleNames = '_', - # sampleVals = '_', - # sampleVars = '_', - # otherStrainNames = '_', - # otherStrainVals = '_', - # otherStrainVars = '_', - # extra_attributes = '_', - # other_extra_attributes = '_', - # export_data = None - # ) - #if this_trait: # if this_trait.dataset and this_trait.dataset.type and this_trait.dataset.type == 'ProbeSet': # self.cursor.execute("SELECT h2 from ProbeSetXRef WHERE DataId = %d" % # this_trait.mysqlid) # heritability = self.cursor.fetchone() - #self.dispTraitInformation(kw, "", hddn, self.this_trait) #Display trait information + function buttons - - self.build_correlation_tools(self.this_trait) + self.build_correlation_tools() #Get nearest marker for composite mapping - logger.debug("self.dataset.type:", self.dataset.type) if hasattr(self.this_trait, 'locus_chr') and self.this_trait.locus_chr != "" and self.dataset.type != "Geno" and self.dataset.type != "Publish": self.nearest_marker = get_nearest_marker(self.this_trait, self.dataset) #self.nearest_marker1 = get_nearest_marker(self.this_trait, self.dataset)[0] @@ -113,6 +76,9 @@ class ShowTrait(object): self.make_sample_lists(self.this_trait) + # Todo: Add back in the ones we actually need from below, as we discover we need them + hddn = OrderedDict() + if self.dataset.group.allsamples: hddn['allsamples'] = string.join(self.dataset.group.allsamples, ' ') @@ -147,7 +113,6 @@ class ShowTrait(object): else: self.sample_group_types['samples_primary'] = self.dataset.group.name sample_lists = [group.sample_list for group in self.sample_groups] - # logger.debug("sample_lists is:", pf(sample_lists)) self.get_mapping_methods() @@ -183,275 +148,11 @@ class ShowTrait(object): 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''' - - #if incf1 == None: - # incf1 = [] - - #if not self.genotype: - # self.dataset.read_genotype_file() - if not samplelist: - if include_f1: - samplelist = self.f1list + self.samplelist - else: - samplelist = self.samplelist - - traitfiledata = getattr(self, "traitfile", None) - traitpastedata = getattr(self, "traitpaste", None) - variancefiledata = getattr(self, "variancefile", None) - variancepastedata = getattr(self, "variancepaste", None) - Nfiledata = getattr(self, "Nfile", None) - - #### Todo: Rewrite below when we get to someone submitting their own trait ##### - - def to_float(item): - try: - return float(item) - except ValueError: - return None - - logger.debug("bottle samplelist is:", samplelist) - if traitfiledata: - tt = traitfiledata.split() - values = map(webqtlUtil.StringAsFloat, tt) - elif traitpastedata: - tt = traitpastedata.split() - values = map(webqtlUtil.StringAsFloat, tt) - else: - logger.debug("mapping formdataasfloat") - #values = map(self.FormDataAsFloat, samplelist) - values = [to_float(getattr(self, key)) for key in samplelist] - logger.debug("rocket values is:", values) - - - if len(values) < len(samplelist): - values += [None] * (len(samplelist) - len(values)) - elif len(values) > len(samplelist): - values = values[:len(samplelist)] - logger.debug("now values is:", values) - - - if variancefiledata: - tt = variancefiledata.split() - variances = map(webqtlUtil.StringAsFloat, tt) - elif variancepastedata: - tt = variancepastedata.split() - variances = map(webqtlUtil.StringAsFloat, tt) - else: - variances = map(self.FormVarianceAsFloat, samplelist) - - if len(variances) < len(samplelist): - variances += [None]*(len(samplelist) - len(variances)) - elif len(variances) > len(samplelist): - variances = variances[:len(samplelist)] - - if Nfiledata: - tt = string.split(Nfiledata) - nsamples = map(webqtlUtil.IntAsFloat, tt) - if len(nsamples) < len(samplelist): - nsamples += [None]*(len(samplelist) - len(nsamples)) - else: - nsamples = map(self.FormNAsFloat, samplelist) - - ##values, variances, nsamples is obsolete - self.allTraitData = {} - for i, _sample in enumerate(samplelist): - if values[i] != None: - self.allTraitData[_sample] = webqtlCaseData( - _sample, values[i], variances[i], nsamples[i]) - logger.debug("allTraitData is:", pf(self.allTraitData)) - - - def dispBasicStatistics(self, fd, this_trait): - - #XZ, June 22, 2011: The definition and usage of primary_samples, other_samples, specialStrains, all_samples are not clear and hard to understand. But since they are only used in this function for draw graph purpose, they will not hurt the business logic outside. As of June 21, 2011, this function seems work fine, so no hurry to clean up. These parameters and code in this function should be cleaned along with fd.f1list, fd.parlist, fd.samplelist later. - - # This should still be riset here - Sam - Nov. 2012 - if fd.genotype.type == "riset": - samplelist = fd.f1list + fd.samplelist - else: - samplelist = fd.f1list + fd.parlist + fd.samplelist - - other_samples = [] #XZ: sample that is not of primary group - specialStrains = [] #XZ: This might be replaced by other_samples / ZS: It is just other samples without parent/f1 samples. - all_samples = [] - primary_samples = [] #XZ: sample of primary group, e.g., BXD, LXS - - #self.MDP_menu = HT.Select(name='stats_mdp', Class='stats_mdp') - self.MDP_menu = [] # We're going to use the same named data structure as in the old version - # but repurpose it for Jinja2 as an array - - for sample in this_trait.data.keys(): - sampleName = sample.replace("_2nd_", "") - if sample not in samplelist: - if this_trait.data[sampleName].value != None: - if sample.find('F1') < 0: - specialStrains.append(sample) - if (this_trait.data[sampleName].value != None) and (sample not in (fd.f1list + fd.parlist)): - other_samples.append(sample) #XZ: at current stage, other_samples doesn't include parent samples and F1 samples of primary group - else: - if (this_trait.data[sampleName].value != None) and (sample not in (fd.f1list + fd.parlist)): - primary_samples.append(sample) #XZ: at current stage, the primary_samples is the same as fd.samplelist / ZS: I tried defining primary_samples as fd.samplelist instead, but in some cases it ended up including the parent samples (1436869_at BXD) - - if len(other_samples) > 3: - other_samples.sort(key=webqtlUtil.natsort_key) - primary_samples.sort(key=webqtlUtil.natsort_key) - primary_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + primary_samples #XZ: note that fd.f1list and fd.parlist are added. - all_samples = primary_samples + other_samples - other_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + other_samples #XZ: note that fd.f1list and fd.parlist are added. - logger.debug("ac1") # This is the one used for first sall3 - self.MDP_menu.append(('All Cases','0')) - self.MDP_menu.append(('%s Only' % fd.group, '1')) - self.MDP_menu.append(('Non-%s Only' % fd.group, '2')) - - else: - if (len(other_samples) > 0) and (len(primary_samples) + len(other_samples) > 3): - logger.debug("ac2") - self.MDP_menu.append(('All Cases','0')) - self.MDP_menu.append(('%s Only' % fd.group,'1')) - self.MDP_menu.append(('Non-%s Only' % fd.group,'2')) - all_samples = primary_samples - all_samples.sort(key=webqtlUtil.natsort_key) - all_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + all_samples - primary_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + primary_samples - else: - logger.debug("ac3") - all_samples = samplelist - - other_samples.sort(key=webqtlUtil.natsort_key) - all_samples = all_samples + other_samples - - if (len(other_samples)) > 0 and (len(primary_samples) + len(other_samples) > 4): - #One set of vals for all, selected sample only, and non-selected only - vals1 = [] - vals2 = [] - vals3 = [] - - #Using all samples/cases for values - #for sample_type in (all_samples, primary_samples, other_samples): - for sampleNameOrig in all_samples: - sampleName = sampleNameOrig.replace("_2nd_", "") - - logger.debug("* type of this_trait:", type(this_trait)) - logger.debug(" name:", this_trait.__class__.__name__) - logger.debug(" this_trait:", this_trait) - logger.debug(" type of this_trait.data[sampleName]:", type(this_trait.data[sampleName])) - logger.debug(" name:", this_trait.data[sampleName].__class__.__name__) - logger.debug(" this_trait.data[sampleName]:", this_trait.data[sampleName]) - thisval = this_trait.data[sampleName].value - logger.debug(" thisval:", thisval) - thisvar = this_trait.data[sampleName].variance - logger.debug(" thisvar:", thisvar) - thisValFull = [sampleName, thisval, thisvar] - logger.debug(" thisValFull:", thisValFull) - - vals1.append(thisValFull) - - #Using just the group sample - for sampleNameOrig in primary_samples: - sampleName = sampleNameOrig.replace("_2nd_", "") - - thisval = this_trait.data[sampleName].value - thisvar = this_trait.data[sampleName].variance - thisValFull = [sampleName,thisval,thisvar] - - vals2.append(thisValFull) - - #Using all non-group samples only - for sampleNameOrig in other_samples: - sampleName = sampleNameOrig.replace("_2nd_", "") - - thisval = this_trait.data[sampleName].value - thisvar = this_trait.data[sampleName].variance - thisValFull = [sampleName,thisval,thisvar] - - vals3.append(thisValFull) - - vals_set = [vals1,vals2,vals3] - + def build_correlation_tools(self): + if self.temp_trait == True: + this_group = self.temp_group else: - vals = [] - - #Using all samples/cases for values - for sampleNameOrig in all_samples: - sampleName = sampleNameOrig.replace("_2nd_", "") - - thisval = this_trait.data[sampleName].value - thisvar = this_trait.data[sampleName].variance - thisValFull = [sampleName,thisval,thisvar] - - vals.append(thisValFull) - - vals_set = [vals] - - self.stats_data = [] - for i, vals in enumerate(vals_set): - if i == 0 and len(vals) < 4: - stats_container = HT.Div(id="stats_tabs", style="padding:10px;", Class="ui-tabs") #Needed for tabs; notice the "stats_script_text" below referring to this element - stats_container.append(HT.Div(HT.Italic("Fewer than 4 case data were entered. No statistical analysis has been attempted."))) - break - elif (i == 1 and len(primary_samples) < 4): - stats_container = HT.Div(id="stats_tabs%s" % i, Class="ui-tabs") - #stats_container.append(HT.Div(HT.Italic("Fewer than 4 " + fd.group + " case data were entered. No statistical analysis has been attempted."))) - elif (i == 2 and len(other_samples) < 4): - stats_container = HT.Div(id="stats_tabs%s" % i, Class="ui-tabs") - stats_container.append(HT.Div(HT.Italic("Fewer than 4 non-" + fd.group + " case data were entered. No statistical analysis has been attempted."))) - else: - continue - if len(vals) > 4: - stats_tab_list = [HT.Href(text="Basic Table", url="#statstabs-1", Class="stats_tab"),HT.Href(text="Probability Plot", url="#statstabs-5", Class="stats_tab"), - HT.Href(text="Bar Graph (by name)", url="#statstabs-3", Class="stats_tab"), HT.Href(text="Bar Graph (by rank)", url="#statstabs-4", Class="stats_tab"), - HT.Href(text="Box Plot", url="#statstabs-2", Class="stats_tab")] - - if this_trait.dataset: - if this_trait.cellid: - self.stats_data.append(BasicStatisticsFunctions.basicStatsTable(vals=vals, trait_type=this_trait.dataset.type, cellid=this_trait.cellid)) - else: - self.stats_data.append(BasicStatisticsFunctions.basicStatsTable(vals=vals, trait_type=this_trait.dataset.type)) - else: - self.stats_data.append(BasicStatisticsFunctions.basicStatsTable(vals=vals)) - - #normalplot_div = HT.Div(id="statstabs-5") - #normalplot_container = HT.Paragraph() - #normalplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - - try: - plotTitle = this_trait.symbol - plotTitle += ": " - plotTitle += this_trait.name - except: - plotTitle = str(this_trait.name) - - #normalplot_img = BasicStatisticsFunctions.plotNormalProbability(vals=vals, group=fd.group, title=plotTitle, specialStrains=specialStrains) - #normalplot.append(HT.TR(HT.TD(normalplot_img))) - #normalplot.append(HT.TR(HT.TD(HT.BR(),HT.BR(),"This plot evaluates whether data are \ - #normally distributed. Different symbols represent different groups.",HT.BR(),HT.BR(), - #"More about ", HT.Href(url="http://en.wikipedia.org/wiki/Normal_probability_plot", - # target="_blank", text="Normal Probability Plots"), " and more about interpreting these plots from the ", HT.Href(url="/glossary.html#normal_probability", target="_blank", text="glossary")))) - - #boxplot_div = HT.Div(id="statstabs-2") - #boxplot_container = HT.Paragraph() - #boxplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - #boxplot_img, boxplot_link = BasicStatisticsFunctions.plotBoxPlot(vals) - #boxplot.append(HT.TR(HT.TD(boxplot_img, HT.P(), boxplot_link, align="left"))) - - #barName_div = HT.Div(id="statstabs-3") - #barName_container = HT.Paragraph() - #barName = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - #barName_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, group=fd.group, vals=vals, type="name") - - #barRank_div = HT.Div(id="statstabs-4") - #barRank_container = HT.Paragraph() - #barRank = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - #barRank_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, group=fd.group, vals=vals, type="rank") - - - def build_correlation_tools(self, this_trait): - - #species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, group=fd.group) - - this_group = self.dataset.group.name + this_group = self.dataset.group.name # We're checking a string here! assert isinstance(this_group, basestring), "We need a string type thing here" @@ -459,11 +160,15 @@ class ShowTrait(object): this_group = 'BXD' if this_group: - dataset_menu = self.dataset.group.datasets() + #dataset_menu = self.dataset.group.datasets() + if self.temp_trait == True: + dataset_menu = data_set.datasets(this_group) + else: + dataset_menu = data_set.datasets(this_group, self.dataset.group) dataset_menu_selected = None if len(dataset_menu): - if this_trait and this_trait.dataset: - dataset_menu_selected = this_trait.dataset.name + if self.this_trait and self.this_trait.dataset: + dataset_menu_selected = self.this_trait.dataset.name return_results_menu = (100, 200, 500, 1000, 2000, 5000, 10000, 15000, 20000) return_results_menu_selected = 500 @@ -474,260 +179,6 @@ class ShowTrait(object): return_results_menu_selected = return_results_menu_selected,) - def build_mapping_tools(self, this_trait): - - - #_Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, group=fd.group) - - this_group = fd.group - if this_group[:3] == 'BXD': - this_group = 'BXD' - - #check boxes - one for regular interval mapping, the other for composite - permCheck1= HT.Input(type='checkbox', Class='checkbox', name='permCheck1',checked="on") - bootCheck1= HT.Input(type='checkbox', Class='checkbox', name='bootCheck1',checked=0) - permCheck2= HT.Input(type='checkbox', Class='checkbox', name='permCheck2',checked="on") - bootCheck2= HT.Input(type='checkbox', Class='checkbox', name='bootCheck2',checked=0) - optionbox1 = HT.Input(type='checkbox', Class='checkbox', name='parentsf14regression1',checked=0) - optionbox2 = HT.Input(type='checkbox', Class='checkbox', name='parentsf14regression2',checked=0) - optionbox3 = HT.Input(type='checkbox', Class='checkbox', name='parentsf14regression3',checked=0) - applyVariance1 = HT.Input(name='applyVarianceSE1',type='checkbox', Class='checkbox') - applyVariance2 = HT.Input(name='applyVarianceSE2',type='checkbox', Class='checkbox') - - IntervalMappingButton=HT.Input(type='button' ,name='interval',value=' Compute ', Class="button") - CompositeMappingButton=HT.Input(type='button' ,name='composite',value=' Compute ', Class="button") - MarkerRegressionButton=HT.Input(type='button',name='marker', value=' Compute ', Class="button") - - chrText = HT.Span("Chromosome:", Class="ffl fwb fs12") - - # updated by NL 5-28-2010 - # Interval Mapping - chrMenu = HT.Select(name='chromosomes1') - chrMenu.append(("All",-1)) - for i in range(len(fd.genotype)): - if len(fd.genotype[i]) > 1: - chrMenu.append((fd.genotype[i].name, i)) - - #Menu for Composite Interval Mapping - chrMenu2 = HT.Select(name='chromosomes2') - chrMenu2.append(("All",-1)) - for i in range(len(fd.genotype)): - if len(fd.genotype[i]) > 1: - chrMenu2.append((fd.genotype[i].name, i)) - - if fd.genotype.Mbmap: - scaleText = HT.Span("Mapping Scale:", Class="ffl fwb fs12") - scaleMenu1 = HT.Select(name='scale1', - onChange="checkUncheck(window.document.dataInput.scale1.value, window.document.dataInput.permCheck1, window.document.dataInput.bootCheck1)") - scaleMenu1.append(("Megabase",'physic')) - scaleMenu1.append(("Centimorgan",'morgan')) - scaleMenu2 = HT.Select(name='scale2', - onChange="checkUncheck(window.document.dataInput.scale2.value, window.document.dataInput.permCheck2, window.document.dataInput.bootCheck2)") - scaleMenu2.append(("Megabase",'physic')) - scaleMenu2.append(("Centimorgan",'morgan')) - - controlText = HT.Span("Control Locus:", Class="ffl fwb fs12") - controlMenu = HT.Input(type="text", name="controlLocus", Class="controlLocus") - - if fd.genotype.Mbmap: - intMappingMenu = HT.TableLite( - HT.TR(HT.TD(chrText), HT.TD(chrMenu, colspan="3")), - HT.TR(HT.TD(scaleText), HT.TD(scaleMenu1)), - cellspacing=0, width="263px", cellpadding=2) - compMappingMenu = HT.TableLite( - HT.TR(HT.TD(chrText), HT.TD(chrMenu2, colspan="3")), - HT.TR(HT.TD(scaleText), HT.TD(scaleMenu2)), - HT.TR(HT.TD(controlText), HT.TD(controlMenu)), - cellspacing=0, width="325px", cellpadding=2) - else: - intMappingMenu = HT.TableLite( - HT.TR(HT.TD(chrText), HT.TD(chrMenu, colspan="3")), - cellspacing=0, width="263px", cellpadding=2) - compMappingMenu = HT.TableLite( - HT.TR(HT.TD(chrText), HT.TD(chrMenu2, colspan="3")), - HT.TR(HT.TD(controlText), HT.TD(controlMenu)), - cellspacing=0, width="325px", cellpadding=2) - - directPlotButton = "" - directPlotButton = HT.Input(type='button',name='', value=' Compute ',\ - onClick="dataEditingFunc(this.form,'directPlot');",Class="button") - directPlotSortText = HT.Span(HT.Bold("Sort by: "), Class="ffl fwb fs12") - directPlotSortMenu = HT.Select(name='graphSort') - directPlotSortMenu.append(('LRS Full',0)) - directPlotSortMenu.append(('LRS Interact',1)) - directPlotPermuText = HT.Span("Permutation Test (n=500)", Class="ffl fs12") - directPlotPermu = HT.Input(type='checkbox', Class='checkbox',name='directPermuCheckbox', checked="on") - pairScanReturnText = HT.Span(HT.Bold("Return: "), Class="ffl fwb fs12") - pairScanReturnMenu = HT.Select(name='pairScanReturn') - pairScanReturnMenu.append(('top 50','50')) - pairScanReturnMenu.append(('top 100','100')) - pairScanReturnMenu.append(('top 200','200')) - pairScanReturnMenu.append(('top 500','500')) - - pairScanMenus = HT.TableLite( - HT.TR(HT.TD(directPlotSortText), HT.TD(directPlotSortMenu)), - HT.TR(HT.TD(pairScanReturnText), HT.TD(pairScanReturnMenu)), - cellspacing=0, width="232px", cellpadding=2) - - markerSuggestiveText = HT.Span(HT.Bold("Display LRS greater than:"), Class="ffl fwb fs12") - markerSuggestive = HT.Input(name='suggestive', size=5, maxlength=8) - displayAllText = HT.Span(" Display all LRS ", Class="ffl fs12") - displayAll = HT.Input(name='displayAllLRS', type="checkbox", Class='checkbox') - useParentsText = HT.Span(" Use Parents ", Class="ffl fs12") - useParents = optionbox2 - applyVarianceText = HT.Span(" Use Weighted ", Class="ffl fs12") - - markerMenu = HT.TableLite( - HT.TR(HT.TD(markerSuggestiveText), HT.TD(markerSuggestive)), - HT.TR(HT.TD(displayAll,displayAllText)), - HT.TR(HT.TD(useParents,useParentsText)), - HT.TR(HT.TD(applyVariance2,applyVarianceText)), - cellspacing=0, width="263px", cellpadding=2) - - - mapping_row = HT.TR() - mapping_container = HT.Div(id="mapping_tabs", Class="ui-tabs") - - mapping_tab_list = [HT.Href(text="Interval", url="#mappingtabs-1"), HT.Href(text="Marker Regression", url="#mappingtabs-2"), HT.Href(text="Composite", url="#mappingtabs-3"), HT.Href(text="Pair-Scan", url="#mappingtabs-4")] - mapping_tabs = HT.List(mapping_tab_list) - mapping_container.append(mapping_tabs) - - interval_div = HT.Div(id="mappingtabs-1") - interval_container = HT.Span() - - intervalTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - intTD = HT.TD(valign="top",NOWRAP='ON', Class="fs12 fwn") - intTD.append(intMappingMenu,HT.BR()) - - intTD.append(permCheck1,'Permutation Test (n=2000)',HT.BR(), - bootCheck1,'Bootstrap Test (n=2000)', HT.BR(), optionbox1, 'Use Parents', HT.BR(), - applyVariance1,'Use Weighted', HT.BR(), HT.BR(),IntervalMappingButton, HT.BR(), HT.BR()) - intervalTable.append(HT.TR(intTD), HT.TR(HT.TD(HT.Span(HT.Href(url='/glossary.html#intmap', target='_blank', text='Interval Mapping'), - ' computes linkage maps for the entire genome or single',HT.BR(),' chromosomes.', - ' The ',HT.Href(url='/glossary.html#permutation', target='_blank', text='Permutation Test'),' estimates suggestive and significant ',HT.BR(),' linkage scores. \ - The ',HT.Href(url='/glossary.html#bootstrap', target='_blank', text='Bootstrap Test'), ' estimates the precision of the QTL location.' - ,Class="fs12"), HT.BR(), valign="top"))) - - interval_container.append(intervalTable) - interval_div.append(interval_container) - mapping_container.append(interval_div) - - # Marker Regression - - marker_div = HT.Div(id="mappingtabs-2") - marker_container = HT.Span() - - markerTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - markerTD = HT.TD(valign="top",NOWRAP='ON', Class="fs12 fwn") - markerTD.append(markerMenu,HT.BR()) - - markerTD.append(MarkerRegressionButton,HT.BR(),HT.BR()) - - markerTable.append(HT.TR(markerTD),HT.TR(HT.TD(HT.Span(HT.Href(url='/glossary.html#',target='_blank',text='Marker regression'), - ' computes and displays LRS values for individual markers.',HT.BR(), - 'This function also lists additive effects (phenotype units per allele) and', HT.BR(), - 'dominance deviations for some datasets.', HT.BR(),Class="fs12"), HT.BR(), valign="top"))) - - marker_container.append(markerTable) - marker_div.append(marker_container) - mapping_container.append(marker_div) - - # Composite interval mapping - composite_div = HT.Div(id="mappingtabs-3") - composite_container = HT.Span() - - compositeTable = HT.TableLite(cellspacing=0, cellpadding=3, width="100%") - compTD = HT.TD(valign="top",NOWRAP='ON', Class="fs12 fwn") - compTD.append(compMappingMenu,HT.BR()) - - compTD.append(permCheck2, 'Permutation Test (n=2000)',HT.BR(), - bootCheck2,'Bootstrap Test (n=2000)', HT.BR(), - optionbox3, 'Use Parents', HT.BR(), HT.BR(), CompositeMappingButton, HT.BR(), HT.BR()) - compositeTable.append(HT.TR(compTD), HT.TR(HT.TD(HT.Span(HT.Href(url='/glossary.html#Composite',target='_blank',text='Composite Interval Mapping'), - " allows you to control for a single marker as",HT.BR()," a cofactor. ", - "To find a control marker, run the ",HT.Bold("Marker Regression")," function."), - HT.BR(), valign="top"))) - - composite_container.append(compositeTable) - composite_div.append(composite_container) - mapping_container.append(composite_div) - - # Pair Scan - - pairscan_div = HT.Div(id="mappingtabs-4") - pairscan_container = HT.Span() - - pairScanTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - pairScanTD = HT.TD(NOWRAP='ON', Class="fs12 fwn") - pairScanTD.append(pairScanMenus,HT.BR()) - pairScanTD.append(directPlotPermu, directPlotPermuText, HT.BR(), HT.BR(), - directPlotButton,HT.BR(),HT.BR()) - pairScanTable.append(HT.TR(pairScanTD), HT.TR(HT.TD(HT.Span(HT.Href(url='/glossary.html#Pair_Scan', target="_blank", text='Pair-Scan'), - ' searches for pairs of chromosomal regions that are',HT.BR(), - 'involved in two-locus epistatic interactions.'), HT.BR(), valign="top"))) - - pairscan_container.append(pairScanTable) - pairscan_div.append(pairscan_container) - mapping_container.append(pairscan_div) - - mapping_row.append(HT.TD(mapping_container)) - - # Treat Interval Mapping and Marker Regression and Pair Scan as a group for displaying - #disable Interval Mapping and Marker Regression and Pair Scan for human and the dataset doesn't have genotype file - mappingMethodId = webqtlDatabaseFunction.getMappingMethod(cursor=self.cursor, groupName=this_group) - - mapping_script = HT.Script(language="Javascript") - mapping_script_text = """$(function() { $("#mapping_tabs").tabs(); });""" - mapping_script.append(mapping_script_text) - - submitTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%", Class="target2") - - if not mappingMethodId: - if int(mappingMethodId) == 1: - submitTable.append(mapping_row) - submitTable.append(mapping_script) - elif int(mappingMethodId) == 4: - # NL; 09-26-2011 testing for Human Genome Association function - mapping_row=HT.TR() - mapping_container = HT.Div(id="mapping_tabs", Class="ui-tabs") - - mapping_tab_list = [HT.Href(text="Genome Association", url="#mappingtabs-1")] - mapping_tabs = HT.List(mapping_tab_list) - mapping_container.append(mapping_tabs) - - # Genome Association - markerSuggestiveText = HT.Span(HT.Bold("P Value:"), Class="ffl fwb fs12") - - markerSuggestive = HT.Input(name='pValue', value='0.001', size=10, maxlength=20,onClick="this.value='';",onBlur="if(this.value==''){this.value='0.001'};") - markerMenu = HT.TableLite(HT.TR(HT.TD(markerSuggestiveText), HT.TD(markerSuggestive),HT.TD(HT.Italic('   (e.g. 0.001 or 1e-3 or 1E-3 or 3)'))),cellspacing=0, width="400px", cellpadding=2) - MarkerRegressionButton=HT.Input(type='button',name='computePlink', value='  Compute Using PLINK  ', onClick= "validatePvalue(this.form);", Class="button") - - marker_div = HT.Div(id="mappingtabs-1") - marker_container = HT.Span() - markerTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - markerTD = HT.TD(valign="top",NOWRAP='ON', Class="fs12 fwn") - markerTD.append(markerMenu,HT.BR()) - markerTD.append(MarkerRegressionButton,HT.BR(),HT.BR()) - markerTable.append(HT.TR(markerTD)) - - marker_container.append(markerTable) - marker_div.append(marker_container) - - mapping_container.append(marker_div) - mapping_row.append(HT.TD(mapping_container)) - submitTable.append(mapping_row) - submitTable.append(mapping_script) - else: - submitTable.append(HT.TR(HT.TD(HT.Div(HT.Italic("mappingMethodId %s has not been implemented for this dataset yet." % mappingMethodId), id="mapping_tabs", Class="ui-tabs")))) - submitTable.append(mapping_script) - - else: - submitTable.append(HT.TR(HT.TD(HT.Div(HT.Italic("Mapping options are disabled for data not matched with genotypes."), id="mapping_tabs", Class="ui-tabs")))) - submitTable.append(mapping_script) - - title4Body.append(submitTable) - - def make_sample_lists(self, this_trait): all_samples_ordered = self.dataset.group.all_samples_ordered() @@ -753,7 +204,7 @@ class ShowTrait(object): logger.debug("primary_samples is: ", pf(primary_samples)) logger.debug("other_sample_names2:", other_sample_names) - if other_sample_names and self.dataset.group.species != "human": + if other_sample_names and self.dataset.group.species != "human" and self.dataset.group.name != "CFW": parent_f1_samples = None if self.dataset.group.parlist and self.dataset.group.f1list: parent_f1_samples = self.dataset.group.parlist + self.dataset.group.f1list @@ -814,9 +265,9 @@ def get_genofiles(this_trait): return jsondata['genofile'] def get_trait_table_width(sample_groups): - table_width = 30 + table_width = 20 if sample_groups[0].se_exists(): - table_width += 10 + table_width += 15 if (table_width + len(sample_groups[0].attributes)*10) > 100: table_width = 100 else: diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 06586372..ad4d9419 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -116,15 +116,15 @@ "B30_K_1206_M", "Barley1 Leaf MAS 5.0 SCRI (Dec06)" ], - [ - "126", - "B30_K_1206_Rn", - "Barley1 Leaf gcRMAn SCRI (Dec06)" - ], [ "125", "B30_K_1206_R", "Barley1 Leaf gcRMA SCRI (Dec06)" + ], + [ + "126", + "B30_K_1206_Rn", + "Barley1 Leaf gcRMAn SCRI (Dec06)" ] ], "Phenotypes": [ @@ -1339,15 +1339,15 @@ "HLC_0311", "GSE9588 Human Liver Normal (Mar11) Both Sexes" ], - [ - "383", - "HLCM_0311", - "GSE9588 Human Liver Normal (Mar11) Males" - ], [ "384", "HLCF_0311", "GSE9588 Human Liver Normal (Mar11) Females" + ], + [ + "383", + "HLCM_0311", + "GSE9588 Human Liver Normal (Mar11) Males" ] ], "Phenotypes": [ @@ -1525,15 +1525,15 @@ "NCI_Agil_Mam_Tum_RMA_0409", "NCI Mammary LMT miRNA v2 (Apr09) RMA" ], - [ - "37", - "MA_M_0704_R", - "NCI Mammary mRNA M430 (July04) RMA" - ], [ "36", "MA_M_0704_M", "NCI Mammary mRNA M430 (July04) MAS5" + ], + [ + "37", + "MA_M_0704_R", + "NCI Mammary mRNA M430 (July04) RMA" ] ] }, @@ -1590,15 +1590,15 @@ ] ], "Liver mRNA": [ - [ - "39", - "LVF2_M_0704_R", - "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) RMA" - ], [ "38", "LVF2_M_0704_M", "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) MAS5" + ], + [ + "39", + "LVF2_M_0704_R", + "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) RMA" ] ], "Phenotypes": [ @@ -1620,11 +1620,6 @@ }, "B6D2F2": { "Brain mRNA": [ - [ - "76", - "BRF2_M_0805_M", - "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5" - ], [ "78", "BRF2_M_0805_P", @@ -1635,20 +1630,25 @@ "BRF2_M_0805_R", "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) RMA" ], + [ + "76", + "BRF2_M_0805_M", + "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5" + ], [ "33", "BRF2_M_0304_P", "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) PDNN" ], - [ - "32", - "BRF2_M_0304_R", - "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) RMA" - ], [ "31", "BRF2_M_0304_M", "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) MAS5" + ], + [ + "32", + "BRF2_M_0304_R", + "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) RMA" ] ], "Genotypes": [ @@ -1726,11 +1726,6 @@ ] ], "Striatum mRNA": [ - [ - "84", - "SA_M2_0905_R", - "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) RMA" - ], [ "83", "SA_M2_0905_M", @@ -1740,21 +1735,26 @@ "85", "SA_M2_0905_P", "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) PDNN" + ], + [ + "84", + "SA_M2_0905_R", + "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) RMA" ] ] }, "BHF2": { "Adipose mRNA": [ - [ - "196", - "UCLA_BHF2_ADIPOSE_MALE", - "UCLA BHF2 Adipose Male mlratio" - ], [ "197", "UCLA_BHF2_ADIPOSE_FEMALE", "UCLA BHF2 Adipose Female mlratio" ], + [ + "196", + "UCLA_BHF2_ADIPOSE_MALE", + "UCLA BHF2 Adipose Male mlratio" + ], [ "165", "UCLA_BHF2_ADIPOSE_0605", @@ -1762,16 +1762,16 @@ ] ], "Brain mRNA": [ - [ - "198", - "UCLA_BHF2_BRAIN_MALE", - "UCLA BHF2 Brain Male mlratio" - ], [ "199", "UCLA_BHF2_BRAIN_FEMALE", "UCLA BHF2 Brain Female mlratio" ], + [ + "198", + "UCLA_BHF2_BRAIN_MALE", + "UCLA BHF2 Brain Male mlratio" + ], [ "166", "UCLA_BHF2_BRAIN_0605", @@ -1786,16 +1786,16 @@ ] ], "Liver mRNA": [ - [ - "200", - "UCLA_BHF2_LIVER_MALE", - "UCLA BHF2 Liver Male mlratio" - ], [ "201", "UCLA_BHF2_LIVER_FEMALE", "UCLA BHF2 Liver Female mlratio" ], + [ + "200", + "UCLA_BHF2_LIVER_MALE", + "UCLA BHF2 Liver Male mlratio" + ], [ "167", "UCLA_BHF2_LIVER_0605", @@ -1999,6 +1999,11 @@ "BR_U_1105_P", "UTHSC Brain mRNA U74Av2 (Nov05) PDNN" ], + [ + "81", + "BR_U_0805_P", + "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" + ], [ "80", "BR_U_0805_M", @@ -2009,11 +2014,6 @@ "BR_U_0805_R", "UTHSC Brain mRNA U74Av2 (Aug05) RMA" ], - [ - "81", - "BR_U_0805_P", - "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" - ], [ "42", "CB_M_0204_P", @@ -2080,11 +2080,6 @@ "Eye_M2_0908_R_ND", "Eye M430v2 WT Gpnmb (Sep08) RMA" ], - [ - "278", - "Eye_M2_0908_R_MT", - "Eye M430v2 Mutant Tyrp1 (Sep08) RMA" - ], [ "382", "Eye_M2_0908_WTWT", @@ -2095,6 +2090,11 @@ "Eye_M2_0908_R_WT", "Eye M430v2 WT Tyrp1 (Sep08) RMA" ], + [ + "278", + "Eye_M2_0908_R_MT", + "Eye M430v2 Mutant Tyrp1 (Sep08) RMA" + ], [ "400", "DBA2J-ONH-1212", @@ -2351,15 +2351,15 @@ "MA_M2_0806_P", "Mouse Kidney M430v2 Sex Balanced (Aug06) PDNN" ], - [ - "116", - "MA_M2_0706_P", - "Mouse Kidney M430v2 (Jul06) PDNN" - ], [ "115", "MA_M2_0706_R", "Mouse Kidney M430v2 (Jul06) RMA" + ], + [ + "116", + "MA_M2_0706_P", + "Mouse Kidney M430v2 (Jul06) PDNN" ] ], "Liver Metabolome": [ @@ -2520,16 +2520,16 @@ ] ], "Neocortex mRNA": [ - [ - "375", - "DevNeocortex_ILM6.2P14RInv_1111", - "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov11) RankInv" - ], [ "374", "DevNeocortex_ILM6.2P3RInv_1111", "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov11) RankInv" ], + [ + "375", + "DevNeocortex_ILM6.2P14RInv_1111", + "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov11) RankInv" + ], [ "284", "HQFNeoc_1210v2_RankInv", @@ -2545,15 +2545,15 @@ "HQFNeoc_0208_RankInv", "HQF BXD Neocortex ILM6v1.1 (Feb08) RankInv" ], - [ - "274", - "DevNeocortex_ILM6.2P3RInv_1110", - "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov10) RankInv" - ], [ "275", "DevNeocortex_ILM6.2P14RInv_1110", "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov10) RankInv" + ], + [ + "274", + "DevNeocortex_ILM6.2P3RInv_1110", + "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov10) RankInv" ] ], "Nucleus Accumbens mRNA": [ @@ -2760,11 +2760,6 @@ ] ], "Ventral Tegmental Area mRNA": [ - [ - "229", - "VCUEtOH_0609_R", - "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" - ], [ "228", "VCUSal_0609_R", @@ -2774,6 +2769,11 @@ "230", "VCUEtvsSal_0609_R", "VCU BXD VTA Et vs Sal M430 2.0 (Jun09) RMA" + ], + [ + "229", + "VCUEtOH_0609_R", + "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" ] ] }, @@ -2851,6 +2851,11 @@ }, "CFW": { "Hippocampus mRNA": [ + [ + "811", + "UCSD_CFW_HIP_RNA-Seq_log2_0117", + "UCSD CFW Hippocampus (Jan17) RNA-Seq Log2 Z-score" + ], [ "808", "UCSD_CFW_HIP_RNA-Seq_0117", @@ -2865,6 +2870,11 @@ ] ], "Prefrontal Cortex mRNA": [ + [ + "813", + "UCSD_CFW_PFC_RNA-Seq_log2_0117", + "UCSD CFW Prefrontal Cortex (Jan17) RNA-Seq Log2 Z-score" + ], [ "810", "UCSD_CFW_PFC_RNA-Seq_0117", @@ -2872,6 +2882,11 @@ ] ], "Striatum mRNA": [ + [ + "812", + "UCSD_CFW_STR_RNA-Seq_log2_0117", + "UCSD CFW Striatum (Jan17) RNA-Seq Log2 Z-score" + ], [ "809", "UCSD_CFW_SPL_RNA-Seq_0117", @@ -3007,15 +3022,15 @@ ] ], "Hippocampus mRNA": [ - [ - "100", - "HC_M2CB_1205_R", - "Hippocampus Consortium M430v2 CXB (Dec05) RMA" - ], [ "99", "HC_M2CB_1205_P", "Hippocampus Consortium M430v2 CXB (Dec05) PDNN" + ], + [ + "100", + "HC_M2CB_1205_R", + "Hippocampus Consortium M430v2 CXB (Dec05) RMA" ] ], "Phenotypes": [ @@ -3081,16 +3096,6 @@ ] ], "Hippocampus mRNA": [ - [ - "219", - "Illum_LXS_Hipp_NON_1008", - "Hippocampus Illumina NON (Oct08) RankInv beta" - ], - [ - "212", - "Illum_LXS_Hipp_RSE_1008", - "Hippocampus Illumina RSE (Oct08) RankInv beta" - ], [ "214", "Illum_LXS_Hipp_NOE_1008", @@ -3106,6 +3111,16 @@ "Illum_LXS_Hipp_NOS_1008", "Hippocampus Illumina NOS (Oct08) RankInv beta" ], + [ + "219", + "Illum_LXS_Hipp_NON_1008", + "Hippocampus Illumina NON (Oct08) RankInv beta" + ], + [ + "212", + "Illum_LXS_Hipp_RSE_1008", + "Hippocampus Illumina RSE (Oct08) RankInv beta" + ], [ "143", "Illum_LXS_Hipp_loess0807", @@ -3196,15 +3211,15 @@ ] ], "Hippocampus mRNA": [ - [ - "273", - "UMUTAffyExon_0209_RMA_MDP", - "UMUTAffy Hippocampus Exon (Feb09) RMA MDP" - ], [ "272", "HC_M2_0606_MDP", "Hippocampus Consortium M430v2 (Jun06) RMA MDP" + ], + [ + "273", + "UMUTAffyExon_0209_RMA_MDP", + "UMUTAffy Hippocampus Exon (Feb09) RMA MDP" ] ], "Liver mRNA": [ 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 c1c25a58..d6cd8134 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -166,7 +166,7 @@ return function() { var form_data, url; //$("#progress_bar_container").modal(); - url = "/marker_regression"; + url = "/loading"; $('input[name=method]').val("pylmm"); $('input[name=genofile]').val($('#genofile_pylmm').val()); $('input[name=num_perm]').val($('input[name=num_perm_pylmm]').val()); @@ -182,7 +182,7 @@ return function() { var form_data, url; //$("#progress_bar_container").modal(); - url = "/marker_regression"; + url = "/loading"; $('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()); @@ -212,7 +212,7 @@ return function() { var form_data, url; //$("#static_progress_bar_container").modal(); - url = "/marker_regression"; + url = "/loading"; $('input[name=method]').val("plink"); $('input[name=maf]').val($('input[name=maf_plink]').val()); form_data = $('#trait_data_form').serialize(); @@ -227,7 +227,7 @@ var form_data, url; console.log("RUNNING GEMMA"); //$("#static_progress_bar_container").modal(); - url = "/marker_regression"; + url = "/loading"; $('input[name=method]').val("gemma"); $('input[name=maf]').val($('input[name=maf_gemma]').val()); form_data = $('#trait_data_form').serialize(); @@ -242,7 +242,7 @@ var form_data, url; console.log("In interval mapping"); //$("#progress_bar_container").modal(); - url = "/marker_regression"; + url = "/loading"; $('input[name=method]').val("reaper"); $('input[name=genofile]').val($('#genofile_reaper').val()); $('input[name=num_perm]').val($('input[name=num_perm_reaper]').val()); diff --git a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css index 87f602dc..40e58ac8 100644 --- a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css +++ b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css @@ -81,7 +81,7 @@ table.dataTable tbody tr.selected { table.dataTable tbody th, table.dataTable tbody td { font: 12px Arial, Sans-serif; - padding: 4px 5px 4px 0px; + padding: 4px 16px 4px 0px; } table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td { border-top: 1px solid #ddd; diff --git a/wqflask/wqflask/submit_trait.py b/wqflask/wqflask/submit_trait.py deleted file mode 100644 index 4ab9a4be..00000000 --- a/wqflask/wqflask/submit_trait.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function, division - -from flask import Flask, g - -from pprint import pformat as pf - -def get_species_groups(): - - species_query = "SELECT SpeciesId, MenuName FROM Species" - - species_ids_and_names = g.db.execute(species_query).fetchall() - - - species_and_groups = [] - for species_id, species_name in species_ids_and_names: - this_species_groups = {} - this_species_groups['species'] = species_name - groups_query = "SELECT InbredSetName FROM InbredSet WHERE SpeciesId = %s" % (species_id) - groups = [group[0] for group in g.db.execute(groups_query).fetchall()] - - this_species_groups['groups'] = groups - species_and_groups.append(this_species_groups) - - return species_and_groups \ No newline at end of file diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 210c5708..ec55ebeb 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -81,10 +81,10 @@
-
+
-
+
- {{ loop.index }} + + {{ loop.index }} {{ this_trait.name }} {{ this_trait.dataset.group.species }} {{ this_trait.dataset.group.name }} @@ -82,7 +82,7 @@ Mean Max LRS ? Max LRS Location - Additive Effect ? + Additive ? @@ -145,7 +145,7 @@ { "type": "natural", "width": "4%" }, { "type": "natural", "width": "5%" }, { "type": "natural", "width": "7%" }, - { "type": "natural", "width": "7%" } + { "type": "natural", "width": "5%" } ], "columnDefs": [ { diff --git a/wqflask/wqflask/templates/links.html b/wqflask/wqflask/templates/links.html index 80d752e6..6ff7fc6c 100644 --- a/wqflask/wqflask/templates/links.html +++ b/wqflask/wqflask/templates/links.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}Forgot Password{% endblock %} +{% block title %}Links{% endblock %} {% block content %} diff --git a/wqflask/wqflask/templates/loading.html b/wqflask/wqflask/templates/loading.html index bc2627a0..cede0e86 100644 --- a/wqflask/wqflask/templates/loading.html +++ b/wqflask/wqflask/templates/loading.html @@ -1,14 +1,26 @@ -{% extends "base.html" %} -{% block title %}Loading Mapping Results{% endblock %} -{% block content %} - -
-
+Loading Mapping Results + + + + + + + {% for key, value in start_vars.iteritems() %} + + {% endfor %} +
+
+
+

Loading Mapping Results...

+
+
+
+
+
-{% endblock %} -{% block js %} + + -{% endblock %} \ No newline at end of file + \ No newline at end of file diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html index c6112edb..de901ff5 100644 --- a/wqflask/wqflask/templates/marker_regression_gn1.html +++ b/wqflask/wqflask/templates/marker_regression_gn1.html @@ -71,7 +71,7 @@ LRS ? @@ -121,7 +121,7 @@ *
Gene Track *
- {% if plotScale != "morgan" %} + {% if plotScale != "morgan" and mapping_method != "gemma" %} Haplotype Analyst *
{% endif %} Legend @@ -173,10 +173,10 @@ {% if selectedChr == -1 %} -
+

Results

-
-
+
+
@@ -200,33 +200,33 @@ {% for marker in trimmed_markers %} - - {% if LRS_LOD == "LOD" %} + {% if LRS_LOD == "LOD" or LRS_LOD == "-log(p)" %} {% if 'lod_score' in marker %} - + {% else %} - + {% endif %} {% else %} {% if 'lod_score' in marker %} - + {% else %} - + {% endif %} {% endif %} - - + + {% if 'additive' in marker %} - + {% endif %} {% if 'dominance' in marker %} - + {% endif %} {% endfor %} @@ -237,8 +237,8 @@ {% else %}

Interval Analyst

-
-
+ {{ loop.index }} {{ marker.name }}{{ '%0.2f' | format(marker.lod_score|float) }}{{ '%0.2f' | format(marker.lod_score|float) }}{{ '%0.2f' | format(marker.lrs_value|float / 4.16) }}{{ '%0.2f' | format(marker.lrs_value|float / 4.16) }}{{ '%0.2f' | format(marker.lod_score|float * 4.16) }}{{ '%0.2f' | format(marker.lod_score|float * 4.16) }}{{ '%0.2f' | format(marker.lrs_value|float) }}{{ '%0.2f' | format(marker.lrs_value|float) }}{{marker.chr}}{{ '%0.6f' | format(marker.Mb|float) }}{{marker.chr}}{{ '%0.6f' | format(marker.Mb|float) }}{{ '%0.3f' | format(marker.additive|float) }}{{ '%0.3f' | format(marker.additive|float) }}{{ '%0.2f' | format(marker.dominance|float) }}{{ '%0.2f' | format(marker.dominance|float) }}
+
+
{% for header in gene_table_header %} @@ -274,12 +274,8 @@ - - - -