aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'gn2/wqflask')
-rw-r--r--gn2/wqflask/external_tools/send_to_geneweaver.py2
-rw-r--r--gn2/wqflask/marker_regression/rqtl_mapping.py8
-rw-r--r--gn2/wqflask/oauth2/session.py7
-rw-r--r--gn2/wqflask/oauth2/toplevel.py1
-rw-r--r--gn2/wqflask/search_results.py5
-rw-r--r--gn2/wqflask/templates/gsearch_gene.html8
6 files changed, 23 insertions, 8 deletions
diff --git a/gn2/wqflask/external_tools/send_to_geneweaver.py b/gn2/wqflask/external_tools/send_to_geneweaver.py
index 76ff7302..8faee78a 100644
--- a/gn2/wqflask/external_tools/send_to_geneweaver.py
+++ b/gn2/wqflask/external_tools/send_to_geneweaver.py
@@ -75,7 +75,7 @@ def test_chip(trait_list):
(dataset.name,)
)
- if result := cursor.fetchone:
+ if result := cursor.fetchone():
chip_name = result[0]
if chip_name:
if chip_name != final_chip_name:
diff --git a/gn2/wqflask/marker_regression/rqtl_mapping.py b/gn2/wqflask/marker_regression/rqtl_mapping.py
index 571935cb..c52add46 100644
--- a/gn2/wqflask/marker_regression/rqtl_mapping.py
+++ b/gn2/wqflask/marker_regression/rqtl_mapping.py
@@ -12,6 +12,8 @@ from urllib.parse import urljoin
import numpy as np
+from gn3.debug import __pk__
+
from gn2.base.webqtlConfig import TMPDIR
from gn2.base.trait import create_trait
from gn2.utility.redis_tools import get_redis_conn
@@ -55,8 +57,10 @@ def run_rqtl(trait_name, vals, samples, dataset, pair_scan, mapping_scale, model
if perm_strata_list:
post_data["pstrata"] = True
- rqtl_output = requests.post(urljoin(GN3_LOCAL_URL, "api/rqtl/compute"),
- data=post_data).json()
+ rqtl_output = __pk__(
+ "R/qtl or Pair-Scan results",
+ requests.post(urljoin(GN3_LOCAL_URL, "api/rqtl/compute"),
+ data=post_data).json())
if num_perm > 0:
return rqtl_output['perm_results'], rqtl_output['suggestive'], rqtl_output['significant'], rqtl_output['results']
else:
diff --git a/gn2/wqflask/oauth2/session.py b/gn2/wqflask/oauth2/session.py
index 78c766a8..883a3228 100644
--- a/gn2/wqflask/oauth2/session.py
+++ b/gn2/wqflask/oauth2/session.py
@@ -98,6 +98,7 @@ def set_masquerading(masq_info):
"masquerading": orig_user
})
+
def unset_masquerading():
"""Restore the original session."""
the_session = session_info()
@@ -120,9 +121,15 @@ def is_token_refreshing():
"""Returns whether the token is being refreshed or not."""
return session_info().get("token_refreshing", False)
+
def set_redirect_url(url):
"""Save the current endpoint object"""
return save_session_info({
**session_info(),
"redirect_url": url
})
+
+
+def clear_redirect_url():
+ """Clear the redirect url from Session"""
+ session_info().pop("redirect_url", None)
diff --git a/gn2/wqflask/oauth2/toplevel.py b/gn2/wqflask/oauth2/toplevel.py
index 425c598e..8dd57243 100644
--- a/gn2/wqflask/oauth2/toplevel.py
+++ b/gn2/wqflask/oauth2/toplevel.py
@@ -82,6 +82,7 @@ def authorisation_code():
"logged_in": True
})
redirect_url = session.session_info().get("redirect_url", "/")
+ session.clear_redirect_url()
return redirect(redirect_url)
return no_token_post("auth/token", json=request_data).either(
diff --git a/gn2/wqflask/search_results.py b/gn2/wqflask/search_results.py
index 1d89e52a..e0138b5b 100644
--- a/gn2/wqflask/search_results.py
+++ b/gn2/wqflask/search_results.py
@@ -28,6 +28,7 @@ from gn2.utility.type_checking import is_str
MAX_SEARCH_RESULTS = 50000 # Max number of search results, passed to Xapian search (this needs to match the value in GN3!)
+
class SearchResultPage:
#maxReturn = 3000
@@ -137,7 +138,7 @@ class SearchResultPage:
if self.dataset.type == "ProbeSet":
trait["hmac"] = (Maybe.apply(hmac)
- .to_arguments(trait['name'], trait['dataset'], Just(hmac_creation(f"{trait['name']}:{trait['dataset']}"))))
+ .to_arguments(trait['name'], trait['dataset'], Just(hmac_creation(f"{trait.data['name']}:{trait.data['dataset']}"))))
elif self.dataset.type == "Publish":
inbredsetcode = trait.pop("inbredsetcode")
if inbredsetcode.map(len) == Just(3):
@@ -146,7 +147,7 @@ class SearchResultPage:
.to_arguments(inbredsetcode, trait["name"]))
trait["hmac"] = (Maybe.apply(hmac)
- .to_arguments(trait['name'], trait['dataset'], Just(hmac_creation(f"{trait['name']}:{trait['dataset']}"))))
+ .to_arguments(trait['name'], trait['dataset'], Just(hmac_creation(f"{trait.data['name']}:{trait.data['dataset']}"))))
trait["authors"] = trait["authors_display"] = (trait.pop("authors").map(
lambda authors:
", ".join(authors[:2] + ["et al."] if len(authors) >=2 else authors)))
diff --git a/gn2/wqflask/templates/gsearch_gene.html b/gn2/wqflask/templates/gsearch_gene.html
index 6cd21e9a..33d12cfc 100644
--- a/gn2/wqflask/templates/gsearch_gene.html
+++ b/gn2/wqflask/templates/gsearch_gene.html
@@ -289,11 +289,13 @@
let header_length = 40;
let max_header_length = 180;
while (header_length <= search_result.length) {
- let next_dot = search_result.indexOf(".", header_length+1);
-
+ let next_dot = search_result.indexOf(".", header_length+1);
+ if (next_dot == -1) {
+ next_dot = search_result.length+1
+ }
if (next_dot > max_header_length) {
let next_comma = search_result.indexOf(",", header_length+1);
- if (next_comma > max_header_length) {
+ if (next_comma > max_header_length || next_comma == -1) {
break;
}
header_length = next_comma;