diff options
author | zsloan | 2019-08-07 11:49:20 -0500 |
---|---|---|
committer | zsloan | 2019-08-07 11:49:20 -0500 |
commit | 52bf76b7238a4b3395e667c0dc8bff5cc409cc58 (patch) | |
tree | 7a6df952e0625d84d2393a03d5f06e26048aa169 /wqflask | |
parent | 256f6cffe7e88e6414914188df5c34899999a151 (diff) | |
download | genenetwork2-52bf76b7238a4b3395e667c0dc8bff5cc409cc58.tar.gz |
Changed rn3 to rn6 for a couple external links on the trait page
Made some text bold on trait page details
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/marker_regression/display_mapping_results.py | 6 | ||||
-rw-r--r-- | wqflask/wqflask/marker_regression/qtlreaper_mapping.py | 3 | ||||
-rw-r--r-- | wqflask/wqflask/marker_regression/run_mapping.py | 87 | ||||
-rw-r--r-- | wqflask/wqflask/search_results.py | 79 | ||||
-rw-r--r-- | wqflask/wqflask/show_trait/show_trait.py | 4 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/show_trait.js | 3 | ||||
-rw-r--r-- | wqflask/wqflask/templates/mapping_results.html | 56 | ||||
-rw-r--r-- | wqflask/wqflask/templates/search_result_page.html | 7 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait_details.html | 24 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 18 |
10 files changed, 181 insertions, 106 deletions
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py index ddf6dd50..ea1ca5ed 100644 --- a/wqflask/wqflask/marker_regression/display_mapping_results.py +++ b/wqflask/wqflask/marker_regression/display_mapping_results.py @@ -146,7 +146,7 @@ class DisplayMappingResults(object): self.dataset = start_vars['dataset'] self.this_trait = start_vars['this_trait'] - self.n_samples = len(start_vars['vals']) + self.n_samples = start_vars['num_vals'] self.species = start_vars['species'] self.genofile_string = "" if 'genofile_string' in start_vars: @@ -168,8 +168,8 @@ class DisplayMappingResults(object): self.mapmodel_rqtl_geno = start_vars['model'] self.pair_scan = start_vars['pair_scan'] - if self.mapping_method != "gemma" and self.mapping_method != "plink": - self.js_data = start_vars['js_data'] + #if self.mapping_method != "gemma" and self.mapping_method != "plink": + self.js_data = start_vars['js_data'] self.trimmed_markers = start_vars['trimmed_markers'] #Top markers to display in table if self.dataset.group.species == "rat": diff --git a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py index b74a1c4d..809d0ce4 100644 --- a/wqflask/wqflask/marker_regression/qtlreaper_mapping.py +++ b/wqflask/wqflask/marker_regression/qtlreaper_mapping.py @@ -95,7 +95,8 @@ def parse_reaper_output(gwa_filename, permu_filename, bootstrap_filename): marker['chr'] = line.split("\t")[2] marker['cM'] = float(line.split("\t")[3]) marker['Mb'] = float(line.split("\t")[4]) - marker['p_value'] = float(line.split("\t")[7]) + if float(line.split("\t")[7]) != 1: + marker['p_value'] = float(line.split("\t")[7]) marker['lrs_value'] = float(line.split("\t")[5]) marker['lod_score'] = marker['lrs_value'] / 4.61 marker['additive'] = float(line.split("\t")[6]) diff --git a/wqflask/wqflask/marker_regression/run_mapping.py b/wqflask/wqflask/marker_regression/run_mapping.py index 676df391..7f6bb0a5 100644 --- a/wqflask/wqflask/marker_regression/run_mapping.py +++ b/wqflask/wqflask/marker_regression/run_mapping.py @@ -85,6 +85,8 @@ class RunMapping(object): self.samples.append(sample) self.vals.append(value) + self.num_vals = start_vars['num_vals'] + #ZS: Check if genotypes exist in the DB in order to create links for markers if "geno_db_exists" in start_vars: self.geno_db_exists = start_vars['geno_db_exists'] @@ -311,14 +313,32 @@ class RunMapping(object): else: self.qtl_results = [] + self.qtl_results_for_browser = [] highest_chr = 1 #This is needed in order to convert the highest chr to X/Y for marker in results: + browser_marker = dict( + chr = str(marker['chr']), + rs = marker['name'], + ps = marker['Mb']*1000000 + ) + if 'p_value' in marker: + browser_marker['p_wald'] = marker['p_value'] + else: + if 'lrs_value' in marker and marker['lrs_value'] > 0: + browser_marker['p_wald'] = -math.log10(marker['lrs_value']/4.16) + elif 'lod_score' in marker and marker['lod_score'] > 0: + browser_marker['p_wald'] = -math.log10(marker['lod_score']) + else: + browser_marker['p_wald'] = 0 + self.qtl_results_for_browser.append(browser_marker) if marker['chr'] > 0 or marker['chr'] == "X" or marker['chr'] == "X/Y": if marker['chr'] > highest_chr or marker['chr'] == "X" or marker['chr'] == "X/Y": highest_chr = marker['chr'] if ('lod_score' in marker.keys()) or ('lrs_value' in marker.keys()): self.qtl_results.append(marker) + browser_files = write_input_for_browser(self.dataset, self.qtl_results_for_browser) + with Bench("Exporting Results"): export_mapping_results(self.dataset, self.this_trait, self.qtl_results, self.mapping_results_path, self.mapping_scale, self.score_type) @@ -330,50 +350,23 @@ class RunMapping(object): self.trimmed_markers = trim_markers_for_table(results) if self.mapping_method != "gemma": - self.json_data['chr'] = [] - self.json_data['pos'] = [] - self.json_data['lod.hk'] = [] - self.json_data['markernames'] = [] - - self.json_data['suggestive'] = self.suggestive - self.json_data['significant'] = self.significant - - #Need to convert the QTL objects that qtl reaper returns into a json serializable dictionary - for index, qtl in enumerate(self.qtl_results): - #if index<40: - # logger.debug("lod score is:", qtl['lod_score']) - if qtl['chr'] == highest_chr and highest_chr != "X" and highest_chr != "X/Y": - #logger.debug("changing to X") - self.json_data['chr'].append("X") - else: - self.json_data['chr'].append(str(qtl['chr'])) - self.json_data['pos'].append(qtl['Mb']) - if 'lrs_value' in qtl.keys(): - self.json_data['lod.hk'].append(str(qtl['lrs_value'])) - else: - self.json_data['lod.hk'].append(str(qtl['lod_score'])) - self.json_data['markernames'].append(qtl['name']) - - #Get chromosome lengths for drawing the interval map plot - chromosome_mb_lengths = {} - self.json_data['chrnames'] = [] - for key in self.species.chromosomes.chromosomes.keys(): - self.json_data['chrnames'].append([self.species.chromosomes.chromosomes[key].name, self.species.chromosomes.chromosomes[key].mb_length]) - chromosome_mb_lengths[key] = self.species.chromosomes.chromosomes[key].mb_length - self.js_data = dict( - result_score_type = self.score_type, - json_data = self.json_data, - this_trait = self.this_trait.name, - data_set = self.dataset.name, - maf = self.maf, - manhattan_plot = self.manhattan_plot, - mapping_scale = self.mapping_scale, - chromosomes = chromosome_mb_lengths, - qtl_results = self.qtl_results, + #result_score_type = self.score_type, + #this_trait = self.this_trait.name, + #data_set = self.dataset.name, + #maf = self.maf, + #manhattan_plot = self.manhattan_plot, + #mapping_scale = self.mapping_scale, + #chromosomes = chromosome_mb_lengths, + #qtl_results = self.qtl_results, num_perm = self.num_perm, perm_results = self.perm_output, + browser_files = browser_files ) + else: + self.js_data = dict( + browser_files = browser_files + ) def run_rqtl_plink(self): # os.chdir("") never do this inside a webserver!! @@ -497,3 +490,17 @@ def trim_markers_for_table(markers): return trimmed_sorted_markers else: return sorted_markers + +def write_input_for_browser(this_dataset, markers): + file_base = this_dataset.group.name + "_" + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) + gwas_filename = file_base + "_GWAS" + annot_filename = file_base + "_ANNOT" + gwas_path = "{}/gn2/".format(TEMPDIR) + gwas_filename + annot_path = "{}/gn2/".format(TEMPDIR) + annot_filename + + with open(gwas_path + ".json", "w") as gwas_file, open(annot_path + ".json", "w") as annot_file: + gwas_file.write(json.dumps(markers)) + annot_file.write(json.dumps([])) + + return [gwas_filename, annot_filename] + #return [gwas_filename, annot_filename]
\ No newline at end of file diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 444e1f40..e74fef80 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -25,7 +25,7 @@ from db import webqtlDatabaseFunction from wqflask import user_manager -from flask import render_template +from flask import render_template, Flask, g from utility import formatting from utility.type_checking import is_float, is_int, is_str, get_float, get_int, get_string @@ -47,6 +47,7 @@ views.py). ########################################### self.uc_id = uuid.uuid4() + self.go_term = None logger.debug("uc_id:", self.uc_id) # contains a unique id logger.debug("kw is:", kw) # dict containing search terms @@ -157,25 +158,31 @@ views.py). combined_where_clause = "" previous_from_clauses = [] #The same table can't be referenced twice in the from clause for i, a_search in enumerate(self.search_terms): - the_search = self.get_search_ob(a_search) - if the_search != None: - get_from_clause = getattr(the_search, "get_from_clause", None) - if callable(get_from_clause): - from_clause = the_search.get_from_clause() - if from_clause in previous_from_clauses: - pass - else: - previous_from_clauses.append(from_clause) - combined_from_clause += from_clause - where_clause = the_search.get_where_clause() - combined_where_clause += "(" + where_clause + ")" - if (i+1) < len(self.search_terms): - if self.and_or == "and": - combined_where_clause += "AND" - else: - combined_where_clause += "OR" + if a_search['key'] == "GO": + self.go_term = a_search['search_term'][0] + gene_list = get_GO_symbols(a_search) + self.search_terms += gene_list + continue else: - self.search_term_exists = False + the_search = self.get_search_ob(a_search) + if the_search != None: + get_from_clause = getattr(the_search, "get_from_clause", None) + if callable(get_from_clause): + from_clause = the_search.get_from_clause() + if from_clause in previous_from_clauses: + pass + else: + previous_from_clauses.append(from_clause) + combined_from_clause += from_clause + where_clause = the_search.get_where_clause() + combined_where_clause += "(" + where_clause + ")" + if (i+1) < len(self.search_terms): + if self.and_or == "and": + combined_where_clause += "AND" + else: + combined_where_clause += "OR" + else: + self.search_term_exists = False if self.search_term_exists: combined_where_clause = "(" + combined_where_clause + ")" final_query = the_search.compile_final_query(combined_from_clause, combined_where_clause) @@ -186,11 +193,19 @@ views.py). self.search_term_exists = False else: for a_search in self.search_terms: - the_search = self.get_search_ob(a_search) - if the_search != None: - self.results.extend(the_search.run()) + logger.debug("TERMS:", self.search_terms) + if a_search['key'] == "GO": + self.go_term = a_search['search_term'][0] + gene_list = get_GO_symbols(a_search) + self.search_terms += gene_list + self.search_terms.pop(0) + continue else: - self.search_term_exists = False + the_search = self.get_search_ob(a_search) + if the_search != None: + self.results.extend(the_search.run()) + else: + self.search_term_exists = False if self.search_term_exists: if the_search != None: @@ -218,9 +233,27 @@ views.py). else: return None +def get_GO_symbols(a_search): + query = """SELECT genes + FROM GORef + WHERE goterm='{0}:{1}'""".format(a_search['key'], a_search['search_term'][0]) + + gene_list = g.db.execute(query).fetchone()[0].strip().split() + + new_terms = [] + for gene in gene_list: + this_term = dict(key=None, + separator=None, + search_term=[gene]) + + new_terms.append(this_term) + + return new_terms + def insert_newlines(string, every=64): """ This is because it is seemingly impossible to change the width of the description column, so I'm just manually adding line breaks """ lines = [] for i in xrange(0, len(string), every): lines.append(string[i:i+every]) return '\n'.join(lines) + diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index f1f5840f..b0a46b32 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -107,7 +107,7 @@ class ShowTrait(object): blatsequence += '%3EProbe_' + string.strip(seqt[1]) + '%0A' + string.strip(seqt[0]) + '%0A' if self.dataset.group.species == "rat": - self.UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('rat', 'rn3', blatsequence) + self.UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('rat', 'rn6', blatsequence) self.UTHSC_BLAT_URL = "" elif self.dataset.group.species == "mouse": self.UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('mouse', 'mm10', blatsequence) @@ -314,7 +314,7 @@ class ShowTrait(object): if chr and transcript_start and transcript_end and kgId: transcript_start = int(transcript_start*1000000) # Convert to bases from megabases transcript_end = int(transcript_end*1000000) - self.ucsc_blat_link = webqtlConfig.UCSC_REFSEQ % ('rn3', kgId, chr, transcript_start, transcript_end) + self.ucsc_blat_link = webqtlConfig.UCSC_REFSEQ % ('rn6', kgId, chr, transcript_start, transcript_end) if self.this_trait.geneid and (self.dataset.group.species == "mouse" or self.dataset.group.species == "rat" or self.dataset.group.species == "human"): self.biogps_link = webqtlConfig.BIOGPS_URL % (self.dataset.group.species, self.this_trait.geneid) diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 48b6da5e..53158885 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -940,6 +940,7 @@ if (js_data.num_values < 256) { root.bar_layout = { title: js_data.trait_id, xaxis: { + type: 'category', titlefont: { size: 16 }, @@ -947,7 +948,7 @@ if (js_data.num_values < 256) { ticklen: 4, tickfont: { size: 16 - } + }, }, yaxis: { title: js_data.unit_type, diff --git a/wqflask/wqflask/templates/mapping_results.html b/wqflask/wqflask/templates/mapping_results.html index 98931166..b8b64761 100644 --- a/wqflask/wqflask/templates/mapping_results.html +++ b/wqflask/wqflask/templates/mapping_results.html @@ -3,9 +3,11 @@ {% block css %} <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" /> <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" /> + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> + <link rel="stylesheet" type="text/css" href="/static/packages/purescript_genome_browser/css/purescript_genetics_browser_v01.css" /> <link rel="stylesheet" type="text/css" href="/static/new/css/marker_regression.css" /> - <link rel="stylesheet" type="text/css" href="/static/new/css/panelutil.css" /> + {% endblock %} {% from "base_macro.html" import header %} {% block content %} @@ -29,6 +31,7 @@ {% for sample in samples %} <input type="hidden" name="value:{{ sample }}" value="{{ vals[loop.index - 1] }}"> {% endfor %} + <input type="hidden" name="num_vals" value="{{ n_samples }}"> <input type="hidden" name="maf"> <input type="hidden" name="use_loco" value="{{ use_loco }}"> <input type="hidden" name="selected_chr" value="{{ selectedChr }}"> @@ -153,11 +156,9 @@ <li id="gn1_map_tab"> <a href="#gn1_map" data-toggle="tab" aria-expanded="true">GN1 Map</a> </li> - {% if mapping_method != "gemma" and mapping_method != "plink" %} - <li id="vector_map_tab"> - <a href="#vector_map" data-toggle="tab" {% if mapping_method != "gemma" and mapping_method != "plink" %}aria-expanded="false"{% else %}aria-expanded="true"{% endif %}>Vector Map</a> + <li id="browser_tab"> + <a href="#browser_holder" data-toggle="tab" aria-expanded="true">Genome Browser</a> </li> - {% endif %} </ul> <div class="tab-content"> <div class="tab-pane active" id="gn1_map"> @@ -177,19 +178,31 @@ {% endif %} </div> </div> - {% if mapping_method != "gemma" and mapping_method != "plink" %} - <div class="tab-pane {% if mapping_method == "gemma" %}active{% endif %}" id="vector_map"> - <div id="chart_container"> - <div class="qtlcharts" id="topchart"></div> - </div> + <div class="tab-pane" id="browser_holder" style="height: 500px;"> + <div id="browser"> + <div id="controls"> + <button id="scrollLeft" type="button" > + <i class="fas fa-arrow-left"></i> + </button> + <button id="scrollRight" type="button" > + <i class="fas fa-arrow-right"></i> + </button> + <button id="zoomOut" type="button" > + <i class="fas fa-search-minus"></i> + </button> + <button id="zoomIn" type="button" > + <i class="fas fa-search-plus"></i> + </button> + <button id="reset" type="button" >Reset</button> + </div> + </div> </div> - {% endif %} </div> </div> </form> {% if selectedChr == -1 %} - <div class="container" style="padding-left: 30px;"> + <div class="container" style="padding-left: 30px; margin-top: 50px; position: relative;"> <h2>Mapping Statistics</h2> <br /> <button class="btn btn-default" id="select_all"><span class="glyphicon glyphicon-ok"></span> Select All</button> @@ -307,20 +320,14 @@ <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.scientific.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script> + <script language="javascript" type="text/javascript" src="/static/packages/purescript_genome_browser/js/purescript-genetics-browser_v01.js"></script> - {% if mapping_method != "gemma" and mapping_method != "plink" %} <script> js_data = {{ js_data | safe }} </script> - {% endif %} <script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script> - {% if mapping_method != "gemma" and mapping_method != "plink" %} - <script language="javascript" type="text/javascript" src="/static/new/javascript/panelutil.js"></script> - <script language="javascript" type="text/javascript" src="/static/new/javascript/chr_lod_chart.js"></script> - <script language="javascript" type="text/javascript" src="/static/new/javascript/lod_chart.js"></script> - <script language="javascript" type="text/javascript" src="/static/new/javascript/create_lodchart.js"></script> - {% endif %} + <script language="javascript" type="text/javascript" src="/static/new/javascript/init_genome_browser.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready( function () { @@ -332,7 +339,8 @@ { "type": "natural", "width": "8%" }, { "type": "natural", "width": "25%" }, { "type": "natural" }, - { "type": "natural", "width": "8%" }, + { "type": "natural" }, + { "type": "natural" }, { "type": "natural" }{% if 'additive' in marker %}, { "type": "natural" }{% endif %}{% if 'dominance' in marker and dataset.group.genetic_type != "riset" %}, { "type": "natural" }{% endif %} @@ -438,6 +446,12 @@ return $('#marker_regression_form').submit(); } + $('#browser_tab').click(function() { + $('#gn1_map_options').css("display", "none") + }) + $('#gn1_map_tab').click(function() { + $('#gn1_map_options').css("display", "block") + }) </script> {% endblock %} diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 2dded69f..8dfa37a8 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -15,6 +15,9 @@ <!-- Need to customize text more for other types of searches --> <p><b>Search Results:</b> We searched <a href="http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&{% if dataset.accession_id != 'None' %}GN_AccessionId={{ dataset.accession_id }}{% else %}InfoPageName={{ dataset.name }}{% endif %}">{{ dataset.fullname }}</a> to find all records + {% if go_term is not none %} + with <u>Gene Ontology ID</u> <strong>GO:{{ go_term }}</strong>. + {% else %} {% for word in search_terms %} {% if word.key|lower == "rif" %} with <u>GeneRIF</u> containing <strong>{{ word.search_term[0] }}</strong>{% if loop.last %}.{% else %} and {% endif %} @@ -40,9 +43,13 @@ {% if word.search_term[0] == "*" %} in the dataset.{% else %}{% if loop.first %}that match:<br>{% endif %}<b>"{{ word.search_term[0] }}"</b>{% if loop.last %}{% else %} and {% endif %}{% endif %} {% endif %} {% endfor %} + {% endif %} <br> {{ results|count }} records are shown below. </p> + {% if go_term is not none %} + <p><b>The associated genes include:</b><br><br>{% for word in search_terms %}{{ word.search_term[0] }}{% endfor %}</p> + {% endif %} <!--<p>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.</p>--> diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index 7714a1ab..bb0b62fe 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -1,40 +1,40 @@ <table class="table"> <tr> - <td width="150px">Species and Group</td> + <td width="150px"><b>Species and Group</b></td> <td>{{ this_trait.dataset.group.species }}, {{ this_trait.dataset.group.name }}</td> </tr> {% if this_trait.dataset.type == 'Publish' %} <tr> - <td>Phenotype</td> + <td><b>Phenotype</b></td> <td><div style="width:40%;">{{ this_trait.description_fmt }}</div></td> </tr> <tr> - <td>Authors</td> + <td><b>Authors</b></td> <td><div style="width:40%;">{{ this_trait.authors }}</div></td> </tr> <tr> - <td>Title</td> + <td><b>Title</b></td> <td><div style="width:40%;">{{ this_trait.title }}</div></td> </tr> <tr> - <td>Journal</td> + <td><b>Journal</b></td> <td>{{ this_trait.journal }} ({% if this_trait.pubmed_id %}<a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids={{ this_trait.pubmed_id }}&dop=Abstract" target="_blank" title="PubMed">{{ this_trait.year }}</a>{% else %}{{ this_trait.year }}{% endif %})</td> </tr> {% else %} <tr> - <td>Tissue</td> + <td><b>Tissue</b></td> <td>{{ this_trait.dataset.tissue }}</td> </tr> {% endif %} {% if this_trait.dataset.type == 'ProbeSet' %} {% if this_trait.symbol != None %} <tr> - <td>Gene Symbol</td> + <td><b>Gene Symbol</b></td> <td>{{ this_trait.symbol }}</td> </tr> {% endif %} <tr> - <td>Aliases</td> + <td><b>Aliases</b></td> <td>Wikidata: {{ this_trait.wikidata_alias_fmt|replace(",",";") }}</td> </tr> {% if this_trait.alias_fmt != "Not Available" %} @@ -46,12 +46,12 @@ {% endif %} {% if this_trait.dataset.type != 'Publish' %} <tr> - <td>Location</td> + <td><b>Location</b></td> <td>{{ this_trait.location_fmt }}</td> </tr> {% endif %} <tr> - <td>Database</td> + <td><b>Database</b></td> <td> <a href="http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&InfoPageName={{ dataset.name }}" target="_blank"> {{ dataset.fullname }} @@ -60,7 +60,7 @@ </tr> {% if this_trait.probe_set_specificity %} <tr> - <td>Target Score</td> + <td><b>Target Score</b></td> <td> <a href="http://genenetwork.org/blatInfo.html" target="_blank" title="Values higher than 2 for the specificity are good"> BLAT Specificity @@ -75,7 +75,7 @@ {% endif %} {% if this_trait.pubmed_id or this_trait.geneid or this_trait.omim or this_trait.symbol %} <tr> - <td>Resource Links</td> + <td><b>Resource Links</b></td> <td> {% if pubmed_link %} <a href="{{ pubmed_link }}" target="_blank" title="PubMed"> diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 7b585b03..aa64a910 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -639,7 +639,8 @@ def mapping_results_page(): 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno', 'temp_trait', - 'reaper_version' + 'reaper_version', + 'num_vals' ) start_vars = {} for key, value in initial_start_vars.iteritems(): @@ -670,8 +671,8 @@ def mapping_results_page(): if template_vars.no_results: rendered_template = render_template("mapping_error.html") else: - if template_vars.mapping_method != "gemma" and template_vars.mapping_method != "plink": - template_vars.js_data = json.dumps(template_vars.js_data, + #if template_vars.mapping_method != "gemma" and template_vars.mapping_method != "plink": + template_vars.js_data = json.dumps(template_vars.js_data, default=json_default_handler, indent=" ") @@ -808,6 +809,17 @@ def get_temp_data(): temp_uuid = request.args['key'] return flask.jsonify(temp_data.TempData(temp_uuid).get_all()) +@app.route("/browser_input", methods=('GET',)) +def browser_inputs(): + """ Returns JSON from tmp directory for the purescript genome browser""" + + filename = request.args['filename'] + + with open("{}/gn2/".format(TEMPDIR) + filename + ".json", "r") as the_file: + file_contents = json.load(the_file) + + return flask.jsonify(file_contents) + ########################################################################## def json_default_handler(obj): |