diff options
author | zsloan | 2020-04-24 16:06:36 -0500 |
---|---|---|
committer | zsloan | 2020-04-24 16:06:36 -0500 |
commit | be09d207ee4e2705e358102f8bdbcd1da7f70ca2 (patch) | |
tree | b25f8fa1af57be93ef3698e76c0cfd0129346108 /wqflask | |
parent | 2a119affad1830d5a693860279ca2aa2897d84ef (diff) | |
download | genenetwork2-be09d207ee4e2705e358102f8bdbcd1da7f70ca2.tar.gz |
Replaced hard-coded instances of GN2 urls with ones pulled from settings file
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/base/data_set.py | 4 | ||||
-rw-r--r-- | wqflask/base/trait.py | 7 | ||||
-rw-r--r-- | wqflask/utility/tools.py | 2 | ||||
-rw-r--r-- | wqflask/wqflask/ctl/ctl_analysis.py | 4 | ||||
-rw-r--r-- | wqflask/wqflask/do_search.py | 3 | ||||
-rw-r--r-- | wqflask/wqflask/network_graph/network_graph.py | 2 | ||||
-rw-r--r-- | wqflask/wqflask/search_results.py | 3 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/ctl_graph.js | 8 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js | 1 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/network_graph.js | 4 | ||||
-rw-r--r-- | wqflask/wqflask/templates/ctl_results.html | 1 | ||||
-rw-r--r-- | wqflask/wqflask/templates/index_page.html | 4 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/index_page_orig.html | 4 | ||||
-rw-r--r-- | wqflask/wqflask/templates/network_graph.html | 1 |
14 files changed, 26 insertions, 22 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index fae62875..8652e6b7 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -56,7 +56,7 @@ from pprint import pformat as pf from db.gn_server import menu_main from db.call import fetchall,fetchone,fetch1 -from utility.tools import USE_GN_SERVER, USE_REDIS, flat_files, flat_file_exists +from utility.tools import USE_GN_SERVER, USE_REDIS, flat_files, flat_file_exists, GN2_BASE_URL from utility.logger import getLogger logger = getLogger(__name__ ) @@ -94,7 +94,7 @@ Publish or ProbeSet. E.g. """ self.datasets = {} if rebuild: #ZS: May make this the only option - data = json.loads(requests.get("http://gn2.genenetwork.org/api/v_pre1/gen_dropdown").content) + data = json.loads(requests.get(GN2_BASE_URL + "/api/v_pre1/gen_dropdown").content) #data = gen_menu.gen_dropdown_json() else: file_name = "wqflask/static/new/javascript/dataset_menu_structure.json" diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 5525472e..e454c593 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -14,6 +14,7 @@ from base.data_set import create_dataset from db import webqtlDatabaseFunction from utility import webqtlUtil from utility import hmac +from utility.tools import GN2_BASE_URL from wqflask import app @@ -135,9 +136,9 @@ class GeneralTrait(object): alias = 'Not available' if self.symbol: - human_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.upper()) - mouse_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.capitalize()) - other_response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + self.symbol.lower()) + human_response = requests.get(GN2_BASE_URL + "gn3/gene/aliases/" + self.symbol.upper()) + mouse_response = requests.get(GN2_BASE_URL + "gn3/gene/aliases/" + self.symbol.capitalize()) + other_response = requests.get(GN2_BASE_URL + "gn3/gene/aliases/" + self.symbol.lower()) if human_response and mouse_response and other_response: alias_list = json.loads(human_response.content) + json.loads(mouse_response.content) + json.loads(other_response.content) diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 0fbedccb..9354ece6 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -234,6 +234,8 @@ def show_settings(): GN_VERSION = get_setting('GN_VERSION') HOME = get_setting('HOME') WEBSERVER_MODE = get_setting('WEBSERVER_MODE') +GN2_BASE_URL = get_setting('GN2_BASE_URL') +GN2_BRANCH_URL = get_setting('GN2_BRANCH_URL') GN_SERVER_URL = get_setting('GN_SERVER_URL') SERVER_PORT = get_setting_int('SERVER_PORT') SQL_URI = get_setting('SQL_URI') diff --git a/wqflask/wqflask/ctl/ctl_analysis.py b/wqflask/wqflask/ctl/ctl_analysis.py index 6fda02fd..4415b86a 100644 --- a/wqflask/wqflask/ctl/ctl_analysis.py +++ b/wqflask/wqflask/ctl/ctl_analysis.py @@ -20,7 +20,7 @@ from base import data_set from base import trait as TRAIT from utility import helper_functions -from utility.tools import locate +from utility.tools import locate, GN2_BRANCH_URL from rpy2.robjects.packages import importr @@ -56,6 +56,8 @@ class CTL(object): self.edges_list = [] logger.info("Obtained pointers to CTL functions") + self.gn2_url = GN2_BRANCH_URL + def addNode(self, gt): node_dict = { 'data' : {'id' : str(gt.name) + ":" + str(gt.dataset.name), 'sid' : str(gt.name), diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index 05caa100..b0ca5ced 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -13,6 +13,7 @@ import sys # sys.path.append("..") Never in a running webserver from db import webqtlDatabaseFunction +from utility.tools import GN2_BASE_URL import logging from utility.logger import getLogger @@ -919,7 +920,7 @@ def get_aliases(symbol, species): return [] filtered_aliases = [] - response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases/" + symbol_string) + response = requests.get(GN2_BASE_URL + "/gn3/gene/aliases/" + symbol_string) if response: alias_list = json.loads(response.content) diff --git a/wqflask/wqflask/network_graph/network_graph.py b/wqflask/wqflask/network_graph/network_graph.py index a332db46..152e4168 100644 --- a/wqflask/wqflask/network_graph/network_graph.py +++ b/wqflask/wqflask/network_graph/network_graph.py @@ -47,6 +47,7 @@ from utility.TDCell import TDCell from base.trait import GeneralTrait from base import data_set from utility import webqtlUtil, helper_functions, corr_result_helpers +from utility.tools import GN2_BRANCH_URL from db import webqtlDatabaseFunction import utility.webqtlUtil #this is for parallel computing only. from wqflask.correlation import correlation_functions @@ -195,6 +196,7 @@ class NetworkGraph(object): self.nodes_list.append(node_dict) self.elements = json.dumps(self.nodes_list + self.edges_list) + self.gn2_url = GN2_BRANCH_URL groups = [] for sample in self.all_sample_list: diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index 698389ab..8f702d58 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -28,6 +28,7 @@ from flask import render_template, Flask, g from utility import formatting from utility import hmac +from utility.tools import GN2_BASE_URL from utility.type_checking import is_float, is_int, is_str, get_float, get_int, get_string from utility.logger import getLogger @@ -295,7 +296,7 @@ def get_aliases(symbol_list, species): symbols_string = ",".join(updated_symbols) filtered_aliases = [] - response = requests.get("http://gn2.genenetwork.org/gn3/gene/aliases2/" + symbols_string) + response = requests.get(GN2_BASE_URL + "/gn3/gene/aliases2/" + symbols_string) if response: alias_lists = json.loads(response.content) seen = set() diff --git a/wqflask/wqflask/static/new/javascript/ctl_graph.js b/wqflask/wqflask/static/new/javascript/ctl_graph.js index 94bd7e9d..bd950592 100644 --- a/wqflask/wqflask/static/new/javascript/ctl_graph.js +++ b/wqflask/wqflask/static/new/javascript/ctl_graph.js @@ -82,18 +82,12 @@ window.onload=function() { function create_qtips(cy){ cy.nodes().qtip({ content: function(){ - gn_link = '<b>'+'<a href="http://gn2.genenetwork.org/show_trait?trait_id=' + this.data().sid + '&dataset=' + this.data().dataset + '" >'+this.data().id +'</a>'+'</b><br>' + gn_link = '<b>'+'<a href="' + gn2_url + '/show_trait?trait_id=' + this.data().sid + '&dataset=' + this.data().dataset + '" >'+this.data().id +'</a>'+'</b><br>' ncbi_link = '<a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids=' + this.data().geneid + '" >NCBI<a>'+'<br>' omim_link = '<a href="http://www.ncbi.nlm.nih.gov/omim/' + this.data().omim + '" >OMIM<a>'+'<br>' qtip_content = gn_link + ncbi_link + omim_link return qtip_content - //return '<b>'+'<a href="http://gn2.genenetwork.org/show_trait?trait_id=' + this.data().id + '&dataset=' + this.data().dataset + '" >'+this.data().id +'<a>'+'</b>' }, - // content: { - // title: '<b>'+'<a href="http://gn2.genenetwork.org/show_trait?trait_id=' + this.target() + '&dataset=' + this.dataset() + '" >'+this.target() +'<a>'+'</b>', - // text: this.target, - // button: true - // }, position: { my: 'top center', at: 'bottom center' 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 fad600d2..794804f4 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js +++ b/wqflask/wqflask/static/new/javascript/dataset_select_menu_orig.js @@ -74,7 +74,6 @@ redo_dropdown = function(dropdown, items) { this_opt_group = null for (_i = 0, _len = group_family_list.length; _i < _len; _i++) { item = group_family_list[_i]; - console.log("THE ITEM:", item) if (item[2] != "None" && current_family == ""){ current_family = item[2] this_opt_group = $("<optgroup label=\"" + item[2] + "\">") diff --git a/wqflask/wqflask/static/new/javascript/network_graph.js b/wqflask/wqflask/static/new/javascript/network_graph.js index 4d507a18..02c3b817 100644 --- a/wqflask/wqflask/static/new/javascript/network_graph.js +++ b/wqflask/wqflask/static/new/javascript/network_graph.js @@ -85,7 +85,7 @@ window.onload=function() { cy.nodes().qtip({ content: function(){ qtip_content = '' - gn_link = '<b>'+'<a href="http://gn2.genenetwork.org/show_trait?trait_id=' + this.data().id.split(":")[0] + '&dataset=' + this.data().id.split(":")[1] + '" >'+this.data().id +'</a>'+'</b><br>' + gn_link = '<b>'+'<a href="' + gn2_url + '/show_trait?trait_id=' + this.data().id.split(":")[0] + '&dataset=' + this.data().id.split(":")[1] + '" >'+this.data().id +'</a>'+'</b><br>' qtip_content += gn_link if (typeof(this.data().geneid) !== 'undefined'){ ncbi_link = '<a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids=' + this.data().geneid + '" >NCBI<a>'+'<br>' @@ -115,7 +115,7 @@ window.onload=function() { correlation_line = '<b>Sample r: ' + this.data().correlation + '</b><br>' p_value_line = 'Sample p(r): ' + this.data().p_value + '<br>' overlap_line = 'Overlap: ' + this.data().overlap + '<br>' - scatter_plot = '<a href="http://gn2-zach.genenetwork.org/corr_scatter_plot?dataset_1=' + this.data().source.split(":")[1] + '&dataset_2=' + this.data().target.split(":")[1] + '&trait_1=' + this.data().source.split(":")[0] + '&trait_2=' + this.data().target.split(":")[0] + '" >View Scatterplot</a>' + scatter_plot = '<a href="' + gn2_url + '/corr_scatter_plot?dataset_1=' + this.data().source.split(":")[1] + '&dataset_2=' + this.data().target.split(":")[1] + '&trait_1=' + this.data().source.split(":")[0] + '&trait_2=' + this.data().target.split(":")[0] + '" >View Scatterplot</a>' return correlation_line + p_value_line + overlap_line + scatter_plot }, position: { diff --git a/wqflask/wqflask/templates/ctl_results.html b/wqflask/wqflask/templates/ctl_results.html index d85075a9..0108d93a 100644 --- a/wqflask/wqflask/templates/ctl_results.html +++ b/wqflask/wqflask/templates/ctl_results.html @@ -61,6 +61,7 @@ <script> elements_list = {{ elements | safe }} + gn2_url = "{{ gn2_url | safe }}" </script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.js"></script> diff --git a/wqflask/wqflask/templates/index_page.html b/wqflask/wqflask/templates/index_page.html index 0116245d..f8720d39 100644 --- a/wqflask/wqflask/templates/index_page.html +++ b/wqflask/wqflask/templates/index_page.html @@ -219,9 +219,9 @@ <h3>GN1 Mirror and development sites</h3> <ul> - <li><a href="http://www.genenetwork.org/">Main GN1 site at UTHSC</a> (main site)</li> + <li><a href="http://gn1.genenetwork.org/">Main GN1 site at UTHSC</a> (main site)</li> <li><a href="http://genenetwork.helmholtz-hzi.de/">Germany at the HZI</a></li> - <li><a href="http://gn2.genenetwork.org/">Memphis at the U of M</a></li> + <li><a href="http://genenetwork.org/">Memphis at the U of M</a></li> </ul> </section> diff --git a/wqflask/wqflask/templates/index_page_orig.html b/wqflask/wqflask/templates/index_page_orig.html index 963531cb..06b71f53 100755 --- a/wqflask/wqflask/templates/index_page_orig.html +++ b/wqflask/wqflask/templates/index_page_orig.html @@ -254,8 +254,8 @@ </div> <h3>GeneNetwork v2:</h3> <ul> - <li><a href="http://gn2.genenetwork.org/">Main website</a> at UTHSC</li> - <!--<li><a href="http://test-gn2.genenetwork.org/">Testing website</a> at UTHSC</li>--> + <li><a href="http://genenetwork.org/">Main website</a> at UTHSC</li> + <!--<li><a href="http://test-genenetwork.org/">Testing website</a> at UTHSC</li>--> </ul> <h3>GeneNetwork v1:</h3> <ul> diff --git a/wqflask/wqflask/templates/network_graph.html b/wqflask/wqflask/templates/network_graph.html index 4492dd3f..25af7bb1 100644 --- a/wqflask/wqflask/templates/network_graph.html +++ b/wqflask/wqflask/templates/network_graph.html @@ -137,6 +137,7 @@ <script> elements_list = {{ elements | safe }} + gn2_url = "{{ gn2_url | safe }}" </script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.js"></script> |