aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-04-15 19:04:55 +0300
committerFrederick Muriuki Muriithi2023-04-15 19:04:55 +0300
commit2c517dc9b463f63ffef3c17bd56265b168755c6b (patch)
tree312bc0eae282e9125378f044982f3f372862e69a /wqflask
parenta46ad1d468fe5ace7a4503693e2e4d404f87ebf3 (diff)
downloadgenenetwork2-2c517dc9b463f63ffef3c17bd56265b168755c6b.tar.gz
Revert "Fix the way database_connection() is called"
This reverts commit b8b62aea1c7924e2ee7455c6fe8b34eee7cb8e74. We do need to decouple the entire `gn3.db_utils` from the `flask.current_app` object, and as such, the use of `SQL_URI` from the `utility.tools` module in GN2 was on purpose. This is also to help towards fixing issue https://issues.genenetwork.org/issues/bugfix_coupling_current_app_and_db_utils
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/correlation/rust_correlation.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/wqflask/wqflask/correlation/rust_correlation.py b/wqflask/wqflask/correlation/rust_correlation.py
index 097cc45b..67bd5ff5 100644
--- a/wqflask/wqflask/correlation/rust_correlation.py
+++ b/wqflask/wqflask/correlation/rust_correlation.py
@@ -28,7 +28,7 @@ def query_probes_metadata(dataset, trait_list):
if not bool(trait_list) or dataset.type!="ProbeSet":
return []
- with database_connection() as conn:
+ with database_connection(SQL_URI) as conn:
with conn.cursor() as cursor:
query = """
@@ -98,7 +98,7 @@ def chunk_dataset(dataset, steps, name):
ProbeSetXRef.ProbeSetId = ProbeSet.Id
""".format(name)
- with database_connection() as conn:
+ with database_connection(SQL_URI) as conn:
with conn.cursor() as curr:
curr.execute(query)
traits_name_dict = dict(curr.fetchall())
@@ -122,7 +122,7 @@ def compute_top_n_sample(start_vars, dataset, trait_list):
sample_data=json.loads(samples_vals),
dataset_samples=dataset.group.all_samples_ordered())
- with database_connection() as conn:
+ with database_connection(SQL_URI) as conn:
with conn.cursor() as curr:
curr.execute(
"""
@@ -140,7 +140,7 @@ def compute_top_n_sample(start_vars, dataset, trait_list):
if len(trait_list) == 0:
return {}
- with database_connection() as conn:
+ with database_connection(SQL_URI) as conn:
with conn.cursor() as curr:
# fetching strain data in bulk
query = (
@@ -176,7 +176,7 @@ def compute_top_n_lit(corr_results, target_dataset, this_trait) -> dict:
geneid_dict = {trait_name: geneid for (trait_name, geneid)
in geneid_dict.items() if
corr_results.get(trait_name)}
- with database_connection() as conn:
+ with database_connection(SQL_URI) as conn:
return reduce(
lambda acc, corr: {**acc, **corr},
compute_all_lit_correlation(
@@ -251,7 +251,7 @@ def __compute_sample_corr__(
if target_dataset.type == "ProbeSet" and start_vars.get("use_cache") == "true":
- with database_connection() as conn:
+ with database_connection(SQL_URI) as conn:
file_path = fetch_text_file(target_dataset.name, conn)
if file_path:
(sample_vals, target_data) = read_text_file(
@@ -338,7 +338,7 @@ def __compute_lit_corr__(
(this_trait_geneid, geneid_dict, species) = do_lit_correlation(
this_trait, target_dataset)
- with database_connection() as conn:
+ with database_connection(SQL_URI) as conn:
return reduce(
lambda acc, lit: {**acc, **lit},
compute_all_lit_correlation(