diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/snp_browser/snp_browser.py | 177 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/css/main.css | 45 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/dataset_menu_structure.json | 111 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js | 2 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/show_trait.js | 6 | ||||
-rw-r--r-- | wqflask/wqflask/templates/base.html | 35 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait_details.html | 2 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait_mapping_tools.html | 4 | ||||
-rw-r--r-- | wqflask/wqflask/templates/snp_browser.html | 5 |
9 files changed, 217 insertions, 170 deletions
diff --git a/wqflask/wqflask/snp_browser/snp_browser.py b/wqflask/wqflask/snp_browser/snp_browser.py index 393b8507..0e999ba2 100644 --- a/wqflask/wqflask/snp_browser/snp_browser.py +++ b/wqflask/wqflask/snp_browser/snp_browser.py @@ -1,8 +1,11 @@ from __future__ import absolute_import, print_function, division -from flask import Flask, g +from flask import Flask, g, url_for + +from htmlgen import HTMLgen2 as HT import string +import piddle as pid from utility.logger import getLogger logger = getLogger(__name__ ) @@ -31,99 +34,110 @@ class SnpBrowser(object): self.table_rows = [] def initialize_parameters(self, start_vars): - self.first_run = "true" - self.allele_list = [] - if 'variant' in start_vars: #ZS: Check if not first time loaded (if it has form input) + if 'first_run' in start_vars: self.first_run = "false" + else: + self.first_run = "true" + self.allele_list = [] + + self.variant_type = "SNP" + if 'variant' in start_vars: self.variant_type = start_vars['variant'] + + self.species_name = "Mouse" + self.species_id = 1 + if 'species' in start_vars: self.species_name = start_vars['species'] - if self.species_name.capitalize() == "Mouse": - self.species_id = 1 - elif self.species_name.capitalize() == "Rat": + if self.species_name.capitalize() == "Rat": self.species_id = 2 + + species_ob = species.TheSpecies(species_name=self.species_name) + + self.chr_list = [] + for key in species_ob.chromosomes.chromosomes: + self.chr_list.append(species_ob.chromosomes.chromosomes[key].name) + + if self.first_run == "true": + self.chr = "19" + self.start_mb = 30.1 + self.end_mb = 30.12 + else: + if 'gene_name' in start_vars: + if start_vars['gene_name'] != "": + self.gene_name = start_vars['gene_name'] + else: + self.gene_name = "" + self.chr = start_vars['chr'] + try: + self.start_mb = float(start_vars['start_mb']) + self.end_mb = float(start_vars['end_mb']) + except: + self.start_mb = 0.0 + self.end_mb = 0.0 else: - self.species_id = 0 #Using this to indicate "All Species" - - #ZS: Currently this is just assuming mouse for determining the chromosomes. - # This logic may have to change depending upon what other species are added - self.chr_list = [] - species_ob = species.TheSpecies(species_name="Mouse") - for key in species_ob.chromosomes.chromosomes: - self.chr_list.append(species_ob.chromosomes.chromosomes[key].name) - - if start_vars['gene_name'] != "": - self.gene_name = start_vars['gene_name'] - else: - self.gene_name = "" - self.chr = start_vars['chr'] try: + self.chr = start_vars['chr'] self.start_mb = float(start_vars['start_mb']) self.end_mb = float(start_vars['end_mb']) except: + self.chr = "1" self.start_mb = 0.0 self.end_mb = 0.0 - if 'limit_strains' in start_vars: - self.limit_strains = "true" - else: + self.limit_strains = "true" + if self.first_run == "false": + if 'limit_strains' not in start_vars: self.limit_strains = "false" + else: + if start_vars['limit_strains'] == "false": + self.limit_strains = "false" + + self.chosen_strains_mouse = ["C57BL/6J", + "DBA/2J", + "A/J", + "129S1/SvImJ", + "NOD/ShiLtJ", + "NZO/HlLtJ", + "WSB/EiJ", + "PWK/PhJ", + "CAST/EiJ"] + self.chosen_strains_rat = ["BN", "F344"] + if 'chosen_strains_mouse' in start_vars: self.chosen_strains_mouse = start_vars['chosen_strains_mouse'].split(",") + if 'chosen_strains_rat' in start_vars: self.chosen_strains_rat = start_vars['chosen_strains_rat'].split(",") - if self.species_id == 1: - self.chosen_strains = self.chosen_strains_mouse - elif self.species_id == 2: - self.chosen_strains = self.chosen_strains_rat + if self.species_id == 1: + self.chosen_strains = self.chosen_strains_mouse + else: + self.chosen_strains = self.chosen_strains_rat + self.domain = "All" + if 'domain' in start_vars: self.domain = start_vars['domain'] + self.function = "All" + if 'function' in start_vars: self.function = start_vars['function'] + self.source = "All" + if 'source' in start_vars: self.source = start_vars['source'] + self.criteria = ">=" + if 'criteria' in start_vars: self.criteria = start_vars['criteria'] + self.score = 0.0 + if 'score' in start_vars: self.score = start_vars['score'] - self.redundant = "false" - self.diff_alleles = "false" - if 'redundant' in start_vars: - self.redundant = "true" - if 'diff_alleles' in start_vars: - self.diff_alleles = "true" - - else: #ZS: Default values - self.variant_type = "SNP" - self.species_name = "Mouse" - species_ob = species.TheSpecies(species_name=self.species_name) - self.chr_list = [] - for key in species_ob.chromosomes.chromosomes: - self.chr_list.append(species_ob.chromosomes.chromosomes[key].name) - - self.chr = "19" - self.start_mb = 30.1 - self.end_mb = 30.12 - - self.limit_strains = "true" - - self.chosen_strains_mouse = ["C57BL/6J", - "DBA/2J", - "A/J", - "129S1/SvImJ", - "NOD/ShiLtJ", - "NZO/HlLtJ", - "WSB/EiJ", - "PWK/PhJ", - "CAST/EiJ"] - self.chosen_strains_rat = ["F344"] - self.chosen_strains_all = self.chosen_strains_mouse + self.chosen_strains_rat - - self.chosen_strains = self.chosen_strains_mouse - - self.domain = "All" - self.function = "All" - self.source = "All" - self.criteria = ">=" - self.score = 0.0 - - self.redundant = "false" - self.diff_alleles = "true" + self.redundant = "false" + if self.first_run == "false" and 'redundant' in start_vars: + self.redundant = "true" + self.diff_alleles = "true" + if self.first_run == "false": + if 'diff_alleles' not in start_vars: + self.diff_alleles = "false" + else: + if start_vars['diff_alleles'] == "false": + self.diff_alleles = "false" def get_browser_results(self): self.snp_list = None @@ -567,6 +581,27 @@ class SnpBrowser(object): return domain_satisfied and function_satisfied and source_satisfied and score_satisfied and different_alleles_satisfied + def snp_density_map(self, query, results): + + canvas_width = 900 + canvas_height = 200 + snp_canvas = pid.PILCanvas(size=(canvas_width, canvas_height)) + left_offset, right_offset, top_offset, bottom_offset = (30, 30, 40, 50) + plot_width = canvas_width - left_offset - right_offset + plot_height = canvas_height - top_offset - bottom_offset + y_zero = top_offset + plot_height/2 + + x_scale = plot_width/(self.end_mb - self.start_mb) + + #draw clickable image map + #gifmap = HT.Map + n_click = 80.0 + click_step = plot_width/n_click + click_mb_step = (self.end_mb - self.start_mb)/n_click + + #for i in range(n_click): + # href = url_for('snp_browser', first_run="false", chosen_strains_mouse=self.chosen_strains_mouse, chosen_strains_rat=self.chosen_strains_rat, variant=self.variant_type, species=self.species_name, gene_name=self.gene_name, chr=self.chr, start_mb=self.start_mb, end_mb=self.end_mb, limit_strains=self.limit_strains, domain=self.domain, function=self.function, criteria=self.criteria, score=self.score, diff_alleles=self.diff_alleles) + def get_browser_sample_lists(species_id=1): strain_lists = {} mouse_strain_list = [] diff --git a/wqflask/wqflask/static/new/css/main.css b/wqflask/wqflask/static/new/css/main.css index 880395a7..097cd997 100644 --- a/wqflask/wqflask/static/new/css/main.css +++ b/wqflask/wqflask/static/new/css/main.css @@ -1,11 +1,36 @@ -.security_box { - padding-left: 30px; - padding-right: 30px; -} - -ol { - font-family: Arial; - font-weight: bold; - font-size: 16px; - color: #000082 +@media (max-width: 10px) { + .navbar-header { + float: none; + } + .navbar-toggle { + display: block; + } + .navbar-collapse { + border-top: 1px solid transparent; + box-shadow: inset 0 1px 0 rgba(255,255,255,0.1); + } + .navbar-collapse.collapse { + display: none!important; + } + .navbar-nav { + float: none!important; + margin: 7.5px -15px; + } + .navbar-nav>li { + float: none; + } + .navbar-nav>li>a { + padding-top: 10px; + padding-bottom: 10px; + } + .navbar-text { + float: none; + margin: 15px 0; + } + .navbar-collapse.collapse.in { + display: block!important; + } + .collapsing { + overflow: hidden!important; + } }
\ No newline at end of file diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 1c6791c4..9c806a7f 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -2591,21 +2591,6 @@ ], "Liver mRNA": [ [ - "858", - "EPFLMouseLiverHFDRMA0818", - "EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" - ], - [ - "852", - "NIA-AgBXD-Liv_HFD-0818", - "NIA Aging BXD HFD Liver Affy Clariom S Gene Level (Aug18) RMA **" - ], - [ - "857", - "EPFLMouseLiverCDHFDRMA0818", - "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" - ], - [ "859", "EPFLMouseLiverCDRMA0818", "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" @@ -2626,6 +2611,21 @@ "UCLA BXD Liver Affy M430 2.0 (Jan16) RMA" ], [ + "858", + "EPFLMouseLiverHFDRMA0818", + "EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" + ], + [ + "852", + "NIA-AgBXD-Liv_HFD-0818", + "NIA Aging BXD HFD Liver Affy Clariom S Gene Level (Aug18) RMA **" + ], + [ + "857", + "EPFLMouseLiverCDHFDRMA0818", + "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Aug18) RMA" + ], + [ "430", "EPFLMouseLiverRMA0413", "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" @@ -2641,6 +2641,11 @@ "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" ], [ + "433", + "EPFLMouseLiverBothExRMA0413", + "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" + ], + [ "849", "EPFLMouseLiverCDEx0413", "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" @@ -2651,11 +2656,6 @@ "EPFL/LISP BXD HFC Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" ], [ - "433", - "EPFLMouseLiverBothExRMA0413", - "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level" - ], - [ "700", "UTHSC-VGX_MmBXDHepatocytesRMA1014", "UT-VGX Hepatocytes Affy Mouse Gene 1.0 ST Gene Level (Oct14) RMA" @@ -3672,6 +3672,11 @@ "Retina-RGC-Rheaume": { "Retina Single-cell RNA-Seq": [ [ + "866", + "UConn-RGC-RSeq_log2-0918", + "UConn-Rheaume Retina RGC (Sep18) scRNA-Seq Log2" + ], + [ "865", "UConn-RGC-RSeq_r-0918", "UConn-Rheaume Retina RGC (Sep18) scRNA-Seq Raw" @@ -3680,11 +3685,6 @@ "867", "UConn-RGC-RSeq_s-0918", "UConn-Rheaume Retina RGC (Sep18) scRNA-Seq Siamak" - ], - [ - "866", - "UConn-RGC-RSeq_log2-0918", - "UConn-Rheaume Retina RGC (Sep18) scRNA-Seq Log2" ] ] }, @@ -3712,16 +3712,18 @@ }, "rat": { "HSNIH-Palmer": { + "Infralimbic Cortex mRNA": [ + [ + "861", + "HSNIH-Rat-IL-RSeq-0818", + "HSNIH-Palmer Infralimbic Cortex RNA-Seq (Aug18) rlog" + ] + ], "Lateral Habenula mRNA": [ [ "862", "HSNIH-Rat-LHB-RSeq-0818", "HSNIH-Palmer Lateral Habenula RNA-Seq (Aug18) rlog" - ], - [ - "870", - "HSNIH-Rat-LHB-RSeqlog2-0818", - "HSNIH-Palmer Lateral Habenula RNA-Seq (Aug18) log2" ] ], "Nucleus Accumbens mRNA": [ @@ -3729,11 +3731,13 @@ "860", "HSNIH-Rat-Acbc-RSeq-0818", "HSNIH-Palmer Nucleus Accumbens Core RNA-Seq (Aug18) rlog" - ], + ] + ], + "Orbitofrontal Cortex mRNA": [ [ - "868", - "HSNIH-Rat-Acbc-RSeqlog2-0818", - "HSNIH-Palmer Nucleus Accumbens Core RNA-Seq (Aug18) log2" + "864", + "HSNIH-Rat-VoLo-RSeq-0818", + "HSNIH-Palmer Orbitofrontal Cortex RNA-Seq (Aug18) rlog" ] ], "Phenotypes": [ @@ -3743,32 +3747,7 @@ "HSNIH-Palmer Phenotypes" ] ], - "Prefrontal Cortex mRNA": [ - [ - "869", - "HSNIH-Rat-IL-RSeqlog2-0818", - "HSNIH-Palmer Infralimbic Cortex RNA-Seq (Aug18) log2" - ], - [ - "872", - "HSNIH-Rat-VoLo-RSeqlog2-0818", - "HSNIH-Palmer Orbitofrontal Cortex RNA-Seq (Aug18) log2" - ], - [ - "861", - "HSNIH-Rat-IL-RSeq-0818", - "HSNIH-Palmer Infralimbic Cortex RNA-Seq (Aug18) rlog" - ], - [ - "864", - "HSNIH-Rat-VoLo-RSeq-0818", - "HSNIH-Palmer Orbitofrontal Cortex RNA-Seq (Aug18) rlog" - ], - [ - "871", - "HSNIH-Rat-PL-RSeqlog2-0818", - "HSNIH-Palmer Prelimbic Cortex RNA-Seq (Aug18) log2" - ], + "Prelimbic Cortex mRNA": [ [ "863", "HSNIH-Rat-PL-RSeq-0818", @@ -5532,6 +5511,10 @@ "Phenotypes" ], [ + "Infralimbic Cortex mRNA", + "Infralimbic Cortex mRNA" + ], + [ "Lateral Habenula mRNA", "Lateral Habenula mRNA" ], @@ -5540,8 +5523,12 @@ "Nucleus Accumbens mRNA" ], [ - "Prefrontal Cortex mRNA", - "Prefrontal Cortex mRNA" + "Orbitofrontal Cortex mRNA", + "Orbitofrontal Cortex mRNA" + ], + [ + "Prelimbic Cortex mRNA", + "Prelimbic Cortex mRNA" ] ], "HSNIH-RGSMC": [ diff --git a/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js b/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js index d5ce6f84..3f123d6f 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js +++ b/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js @@ -94,7 +94,7 @@ $(function() { })(this)); open_window = function(url, name) { var options; - options = "menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=1,directories=1,width=900"; + options = "menubar=yes,toolbar=yes,titlebar=yes,location=yes,resizable=yes,status=yes,scrollbars=yes,directories=yes,width=900"; return open(url, name, options).focus(); }; group_info = function() { diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index a3edd0e6..c1b0cef9 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -829,8 +829,10 @@ } } + root.chart_range = [range_bottom, range_top] + total_sample_count = 0 - for (i = 0, i < sample_lists.length; i++) { + for (i = 0, i < sample_lists.length; i++;) { total_sample_count += get_sample_vals(sample_lists[i]).length } @@ -839,7 +841,7 @@ var layout = { yaxis: { - range: [range_bottom, range_top], + range: root.chart_range, }, width: bar_chart_width, height: 600, diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 81c04db5..3d03f3b9 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -22,17 +22,22 @@ <body style="width: 100% !important;"> <!-- Navbar ================================================== --> - <div class="navbar navbar-inverse navbar-static-top pull-left" role="navigation" style="width: 100%;"> - + <div class="navbar navbar-inverse navbar-static-top pull-left" role="navigation" style="width: 100%; white-space: nowrap;"> + <!--<div class="navbar navbar-default" style="width: 100%; white-space: nowrap;">--> <div class="container-fluid" style="width: 100%;"> <!-- Brand and toggle get grouped for better mobile display --> + <!--- <div class="navbar-header"> - <a class="navbar-brand" href="/">GeneNetwork</a> + <a class="navbar-brand" href="/">GeneNetwork</a> </div> + --> <!-- Collect the nav links, forms, and other content for toggling --> <div> <ul class="nav navbar-nav"> + <li class="" style="margin-right: 20px;"> + <a href="/" style="font-weight: bold;">GeneNetwork</a> + </li> <li class=""> <a href="/intro">Intro</a> </li> @@ -55,22 +60,14 @@ <a href="/snp_browser">SNP Browser</a> </li> <li class=""> - <a href="/help">Help</a> - </li> - <li class=""> - <a href="/news">News</a> - </li> - <li class=""> - <a href="/references">References</a> - </li> - <li class=""> - <a href="/policies">Policies</a> - </li> - <li class=""> - <a href="/links">Links</a> - </li> - <li class=""> - <a href="/environments">Environments</a> + <a href="/help" class="dropdow-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Help <span class="caret"></a> + <ul class="dropdown-menu"> + <li><a href="/news">News</a></li> + <li><a href="/references">References</a></li> + <li><a href="/policies">Policies</a></li> + <li><a href="/links">Links</a></li> + <li><a href="/environments">Environments</a></li> + </ul> </li> <li class=""> {% if g.user_session.logged_in %} diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index 1e6d41c2..c1f8f824 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -46,7 +46,7 @@ <tr> <td>Database</td> <td> - <a href="http://genenetwork.org/dbdoc/{{ dataset.name }}.html"> + <a href="http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&InfoPageName={{ dataset.name }}"> {{ dataset.fullname }} </a> </td> diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index c2c201e1..72b3b00b 100644 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -61,11 +61,11 @@ <label style="text-align: right;" class="col-xs-3 control-label">Use LOCO</label> <div style="margin-left:20px;" class="col-xs-6 controls"> <label class="radio-inline"> - <input type="radio" name="use_loco" value="True" checked=""> + <input type="radio" name="use_loco" value="True"> Yes </label> <label class="radio-inline"> - <input type="radio" name="use_loco" value="False"> + <input type="radio" name="use_loco" value="False" checked=""> No </label> </div> diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index 578bd2fc..3608d0fe 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -11,6 +11,7 @@ <div class="container" style="border-style: double; position: relative; width: 950px; padding-top: 10px; padding-right: 40px;"> <form id="snp_browser_form" method="get" action="/snp_browser"> + <input type="hidden" name="first_run" value="{{ first_run }}"> <input type="hidden" name="chosen_strains_mouse" value="{{ chosen_strains_mouse|join(",") }}"> <input type="hidden" name="chosen_strains_rat" value="{{ chosen_strains_rat|join(",") }}"> <div class="col-xs-4" style="padding-left: 0px;"> @@ -18,8 +19,8 @@ <label for="snp_or_indel" style="text-align: right;" class="col-xs-4 col-form-label"><b>Type:</b></label> <div class="col-xs-8"> <select name="variant"> - <option value="SNP" selected>SNP</option> - <option value="InDel">InDel</option> + <option value="SNP" {% if variant_type == "SNP" %}selected{% endif %}>SNP</option> + <option value="InDel" {% if variant_type == "InDel" %}selected{% endif %}>InDel</option> </select> </div> </div> |