diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/base/data_set.py | 7 | ||||
-rw-r--r-- | wqflask/wqflask/marker_regression/display_mapping_results.py | 2 | ||||
-rw-r--r-- | wqflask/wqflask/snp_browser/snp_browser.py | 63 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/css/marker_regression.css | 2 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js | 7 | ||||
-rw-r--r-- | wqflask/wqflask/templates/collections/list.html | 4 | ||||
-rw-r--r-- | wqflask/wqflask/templates/corr_scatterplot.html | 10 | ||||
-rw-r--r-- | wqflask/wqflask/templates/mapping_results.html | 19 | ||||
-rw-r--r-- | wqflask/wqflask/templates/snp_browser.html | 32 |
9 files changed, 117 insertions, 29 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 55782576..2acb3b61 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -109,6 +109,7 @@ Publish or ProbeSet. E.g. else: new_type = "ProbeSet" self.datasets[short_dataset_name] = new_type + # Set LOG_LEVEL_DEBUG=5 to see the following: logger.debugf(5, "datasets",self.datasets) @@ -450,12 +451,14 @@ def datasets(group_name, this_group = None): and InbredSet.Name like %s and ProbeSetFreeze.public > %s and ProbeSetFreeze.confidentiality < 1 - ORDER BY Tissue.Name, ProbeSetFreeze.CreateTime desc, ProbeSetFreeze.AvgId) + ORDER BY Tissue.Name) ''' % (group_name, webqtlConfig.PUBLICTHRESH, group_name, webqtlConfig.PUBLICTHRESH, "'" + group_name + "'", webqtlConfig.PUBLICTHRESH)) - for dataset_item in the_results: + sorted_results = sorted(the_results, key=lambda kv: kv[0]) + + for dataset_item in sorted_results: tissue_name = dataset_item[0] dataset = dataset_item[1] dataset_short = dataset_item[2] diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index e63e4af2..28831937 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -2083,7 +2083,7 @@ class DisplayMappingResults(object): tableIterationsCnt = tableIterationsCnt + 1 this_row = [] #container for the cells of each row - selectCheck = HT.Input(type="checkbox", name="searchResult", value=theGO["GeneSymbol"], Class="checkbox", onClick="highlight(this)") #checkbox for each row + selectCheck = HT.Input(type="checkbox", name="searchResult", value=theGO["GeneSymbol"], Class="checkbox trait_checkbox") #checkbox for each row geneLength = (theGO["TxEnd"] - theGO["TxStart"])*1000.0 tenPercentLength = geneLength*0.0001 diff --git a/wqflask/wqflask/snp_browser/snp_browser.py b/wqflask/wqflask/snp_browser/snp_browser.py index 0e999ba2..0058070c 100644 --- a/wqflask/wqflask/snp_browser/snp_browser.py +++ b/wqflask/wqflask/snp_browser/snp_browser.py @@ -51,11 +51,19 @@ class SnpBrowser(object): if self.species_name.capitalize() == "Rat": self.species_id = 2 - species_ob = species.TheSpecies(species_name=self.species_name) + self.mouse_chr_list = [] + self.rat_chr_list = [] + mouse_species_ob = species.TheSpecies(species_name="Mouse") + for key in mouse_species_ob.chromosomes.chromosomes: + self.mouse_chr_list.append(mouse_species_ob.chromosomes.chromosomes[key].name) + rat_species_ob = species.TheSpecies(species_name="Rat") + for key in rat_species_ob.chromosomes.chromosomes: + self.rat_chr_list.append(rat_species_ob.chromosomes.chromosomes[key].name) - self.chr_list = [] - for key in species_ob.chromosomes.chromosomes: - self.chr_list.append(species_ob.chromosomes.chromosomes[key].name) + if self.species_id == 1: + self.this_chr_list = self.mouse_chr_list + else: + self.this_chr_list = self.rat_chr_list if self.first_run == "true": self.chr = "19" @@ -213,7 +221,7 @@ class SnpBrowser(object): query = rat_query elif self.variant_type == "InDel": - if species_id != 0: + if self.species_id != 0: query = """ SELECT DISTINCT a.Name, a.Chromosome, a.SourceId, a.Mb_start, a.Mb_end, a.Strand, a.Type, a.Size, a.InDelSequence, b.Name @@ -289,7 +297,12 @@ class SnpBrowser(object): domain = [key, ''] if 'Intergenic' in domain: - gene = transcript = exon = function = function_details = '' + if self.gene_name != "": + gene_id = get_gene_id(self.species_id, self.gene_name) + gene = [gene_id, self.gene_name] + else: + gene = "" + transcript = exon = function = function_details = '' if self.redundant == "false" or last_mb != mb: # filter redundant if self.include_record(domain, function, snp_source, conservation_score): info_list = [snp_name, rs, chr, mb, alleles, gene, transcript, exon, domain, function, function_details, snp_source, conservation_score, snp_id] @@ -325,7 +338,7 @@ class SnpBrowser(object): filtered_results.append(info_list) last_mb = mb - elif self.variant == "InDel": + elif self.variant_type == "InDel": # The order of variables is important; this applies to anything from the variant table as indel indel_name, indel_chr, source_id, indel_mb_start, indel_mb_end, indel_strand, indel_type, indel_size, indel_sequence, source_name = result @@ -354,7 +367,7 @@ class SnpBrowser(object): if gene_name and (gene_name not in gene_name_list): gene_name_list.append(gene_name) if len(gene_name_list) > 0: - gene_id_name_dict = get_gene_id_name_dict(gene_name_list) + gene_id_name_dict = get_gene_id_name_dict(self.species_id, gene_name_list) the_rows = [] for result in self.filtered_results: @@ -395,7 +408,7 @@ class SnpBrowser(object): gene_id = gene_id_name_dict[gene[1]] gene_link = webqtlConfig.NCBI_LOCUSID % gene_id else: - gene_link = "http://www.ncbi.nln.nih.gov/entrez/query.fcgi?CMD=search&DB=gene&term=%s" % gene_name + gene_link = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=search&DB=gene&term=%s" % gene_name else: gene_name = "" gene_link = "" @@ -408,13 +421,16 @@ class SnpBrowser(object): if exon: exon = exon[1] # exon[0] is exon_id, exon[1] is exon_rank else: - exon = "1" + exon = "" if domain: domain_1 = domain[0] domain_2 = domain[1] - if domain_1 == "Exon": - domain_1 = domain_1 + " " + exon + if domain_1 == "Intergenic" and self.gene_name != "": + domain_1 = self.gene_name + else: + if domain_1 == "Exon": + domain_1 = domain_1 + " " + exon function_list = [] if function_details: @@ -759,7 +775,24 @@ def get_effect_info(effect_list): return effect_info_dict -def get_gene_id_name_dict(gene_name_list): +def get_gene_id(species_id, gene_name): + query = """ + SELECT + geneId + FROM + GeneList + WHERE + SpeciesId = %s AND geneSymbol = '%s' + """ % (species_id, gene_name) + + result = g.db.execute(query).fetchone() + + if len(result) > 0: + return result + else: + return "" + +def get_gene_id_name_dict(species_id, gene_name_list): gene_id_name_dict = {} if len(gene_name_list) == 0: return "" @@ -772,8 +805,8 @@ def get_gene_id_name_dict(gene_name_list): FROM GeneList WHERE - SpeciesId = 1 AND geneSymbol in (%s) - """ % gene_name_str + SpeciesId = %s AND geneSymbol in (%s) + """ % (species_id, gene_name_str) results = g.db.execute(query).fetchall() diff --git a/wqflask/wqflask/static/new/css/marker_regression.css b/wqflask/wqflask/static/new/css/marker_regression.css index 8d205143..f1a26a83 100644 --- a/wqflask/wqflask/static/new/css/marker_regression.css +++ b/wqflask/wqflask/static/new/css/marker_regression.css @@ -59,7 +59,7 @@ table.dataTable thead th { } table.dataTable tbody td { - padding: 3px 20px 1px 10px; + padding: 4px 20px 2px 10px; } table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td { 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 3f123d6f..fc1f1beb 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js +++ b/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js @@ -108,7 +108,12 @@ $(function() { dataset_info = function() { var dataset, url; accession_id = $('#dataset option:selected').data("id"); - url = "http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=" + accession_id; + if (accession_id != "None") { + url = "http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=" + accession_id; + } else { + name = $('#dataset option:selected').val(); + url = "http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&InfoPageName=" + name; + } return open_window(url, "Dataset Info"); }; $('#dataset_info').click(dataset_info); diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html index 5a2df5e3..83e74613 100644 --- a/wqflask/wqflask/templates/collections/list.html +++ b/wqflask/wqflask/templates/collections/list.html @@ -9,7 +9,7 @@ {% block content %} <!-- Start of body --> {% if g.user_session.logged_in %} - {{ header("Your Collections", + {{ header("Collections owned by {{ g.user_session.user_name }}", 'You have {}.'.format(numify(collections|count, "collection", "collections"))) }} {% else %} {{ header("Your Collections", @@ -17,6 +17,7 @@ {% endif %} <div class="container"> + <!-- <div class="page-header"> {% if g.user_session.logged_in %} <h1>Collections owned by {{ g.user_session.user_name }}</h1> @@ -24,6 +25,7 @@ <h1>Your Collections</h1> {% endif %} </div> + --> <div> <form id="collections_form" action="/delete" method="post"> <input type="hidden" name="uc_id" id="uc_id" value="" /> diff --git a/wqflask/wqflask/templates/corr_scatterplot.html b/wqflask/wqflask/templates/corr_scatterplot.html index e520b4b9..e3d90e30 100644 --- a/wqflask/wqflask/templates/corr_scatterplot.html +++ b/wqflask/wqflask/templates/corr_scatterplot.html @@ -131,8 +131,8 @@ <br> <div id="scatterplot2"></div> <br> - <div class="row" style="width: 70%;"> - <div class="col-xs-3"> + <div class="row" style="width: 70%; overflow: hidden;"> + <div style="float: left;"> <table class="table table-hover table-striped table-bordered" style="width: 80%; margin-left: 60px; text-align: right;"> <thead> <tr><th style="text-align: right;">Statistic</th><th style="text-align: right;">Value</th></tr> @@ -168,7 +168,7 @@ </tbody> </table> </div> - <div class="col-xs-9"> + <div style="padding-left: 40px; overflow: hidden;"> {% if trait_1.dataset.type == "ProbeSet" %} <div> X axis: @@ -227,7 +227,7 @@ <div id="srscatterplot2"></div> <br> <div class="row" style="width: 70%;"> - <div class="col-xs-3"> + <div style="float: left;"> <table class="table table-hover table-striped table-bordered" style="width: 80%; margin-left: 60px; text-align: right;"> <thead> <tr><th style="text-align: right;">Statistic</th><th style="text-align: right;">Value</th></tr> @@ -256,7 +256,7 @@ </tbody> </table> </div> - <div class="col-xs-9"> + <div style="padding-left: 40px; overflow: hidden;"> {% if trait_1.dataset.type == "ProbeSet" %} <div> X axis: diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 3138d855..72d9d0dd 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -215,7 +215,7 @@ <tbody> {% for marker in trimmed_markers %} <tr> - <td align="center" style="padding-right: 0px; padding-left: 0px;"> + <td align="center" style="padding: 1px 0px 1px 0px;"> <input type="checkbox" name="selectCheck" class="checkbox trait_checkbox" value="{{ data_hmac('{}:{}Geno'.format(marker.name, dataset.group.name)) }}"> @@ -269,7 +269,11 @@ {% for row in gene_table_body %} <tr> {% for n in range(row|length) %} + {% if n == 0 %} + <td align="center" style="padding: 1px 0px 1px 0px;">{{ row[n]|safe }}</td> + {% else %} <td>{{ row[n]|safe }}</td> + {% endif %} {% endfor %} </tr> {% endfor %} @@ -339,6 +343,19 @@ } ); $('#interval_analyst').dataTable( { + "columns": [ + { "bSortable": false}, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" }, + { "type": "natural" } + ], "columnDefs": [ { "targets": 0, "sortable": false diff --git a/wqflask/wqflask/templates/snp_browser.html b/wqflask/wqflask/templates/snp_browser.html index 3608d0fe..cbca9d22 100644 --- a/wqflask/wqflask/templates/snp_browser.html +++ b/wqflask/wqflask/templates/snp_browser.html @@ -30,6 +30,7 @@ <select id="species_select" name="species"> <option value="Mouse" {% if species_name == "Mouse" %}selected{% endif %}>Mouse</option> <option value="Rat" {% if species_name == "Rat" %}selected{% endif %}>Rat</option> + <option value="Human" disabled>Human</option> </select> </div> </div> @@ -45,8 +46,8 @@ <div class="form-group row" style="margin-bottom: 5px;"> <label for="chr" style="text-align: right;" class="col-xs-4 col-form-label"><b>Chr:</b></label> <div class="col-xs-8"> - <select name="chr"> - {% for item in chr_list %} + <select id="chr_select" name="chr"> + {% for item in this_chr_list %} <option value="{{ item }}" {% if item == chr %}selected{% endif %}>{{ item }}</option> {% endfor %} </select> @@ -204,6 +205,7 @@ </thead> <tbody> {% for row in table_rows %} + {% if variant_type == "SNP" %} <tr> <td><input type="checkbox" name="trait_check"></td> <td align="right">{{ loop.index }}</td> @@ -224,6 +226,21 @@ <td style="background-color: {{ item[1] }};">{{ item[0] }}</td> {% endfor %} </tr> + {% else %} + <tr> + <td><input type="checkbox" name="trait_check"></td> + <td align="right">{{ loop.index }}</td> + <td>{{ row.indel_name }}</td> + <td>{{ row.indel_type }}</td> + <td>{{ row.indel_chr }}</td> + <td>{{ row.indel_mb_s }}</td> + <td>{{ row.indel_mb_e }}</td> + <td>{{ row.indel_strand }}</td> + <td>{{ row.indel_size }}</td> + <td>{{ row.indel_sequence }}</td> + <td>{{ row.source_name }}</td> + </tr> + {% endif %} {% endfor %} </tbody> </table> @@ -263,6 +280,7 @@ this_species = $(this).val(); $("#strain_select").empty() $("#chosen_strains_select").empty() + $("#chr_select").empty() if (this_species == "Mouse") { {% for strain in strain_lists["mouse"] %} @@ -270,6 +288,11 @@ $("select[name=strains]").append(option); {% endfor %} + {% for chr in mouse_chr_list %} + var option = $('<option></option>').attr("value", "{{ chr }}").text("{{ chr }}"); + $("select[name=chr]").append(option); + {% endfor %} + chosen_strains = $("input[name=chosen_strains_mouse]").val().split(",") } else if (this_species == "Rat") { {% for strain in strain_lists["rat"] %} @@ -277,6 +300,11 @@ $("select[name=strains]").append(option); {% endfor %} + {% for chr in rat_chr_list %} + var option = $('<option></option>').attr("value", "{{ chr }}").text("{{ chr }}"); + $("select[name=chr]").append(option); + {% endfor %} + chosen_strains = $("input[name=chosen_strains_rat]").val().split(",") } |