aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorAlexander_Kabui2022-08-18 23:44:13 +0300
committerAlexander_Kabui2022-08-23 10:38:10 +0300
commit4b2203ea3510ca13f28cbda3eef19dfe8cde6a0c (patch)
treee2b35e0a0eab25bf62b50fd28305592192fc357d /wqflask
parent7d089d58d9e62fba6d61f17f93148054cf7e6730 (diff)
downloadgenenetwork2-4b2203ea3510ca13f28cbda3eef19dfe8cde6a0c.tar.gz
function to fetch metadata
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/correlation/rust_correlation.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/wqflask/wqflask/correlation/rust_correlation.py b/wqflask/wqflask/correlation/rust_correlation.py
index fc8ab508..c7dc665f 100644
--- a/wqflask/wqflask/correlation/rust_correlation.py
+++ b/wqflask/wqflask/correlation/rust_correlation.py
@@ -15,8 +15,7 @@ from gn3.computations.rust_correlation import parse_tissue_corr_data
from gn3.db_utils import database_connector
-def query_probes_metadata(dataset, results):
-
+def query_probes_metadata(dataset, trait_list):
"""query traits metadata in bulk for probeset"""
with database_connector() as conn:
@@ -43,6 +42,26 @@ def query_probes_metadata(dataset, results):
return cursor.fetchall()
+def get_metadata(dataset, traits):
+
+ return {trait_name: {
+ "name": trait_name,
+ "view": True,
+ "symbol": symbol,
+ "dataset": dataset.name,
+ "dataset_name": dataset.shortname,
+ "mean": mean,
+ "description": description,
+ "additive": additive,
+ "lrs_score": f"{lrs:3.1f}",
+ "location": f"Chr{probe_chr}: {probe_mb:.6f}",
+ "lrs_location": f"Chr{chr_score}: {mb:.6f}"
+
+ } for trait_name, probe_chr, probe_mb, symbol, mean, description,
+ additive, lrs, chr_score, mb
+ in query_probes_metadata(dataset, traits)}
+
+
def chunk_dataset(dataset, steps, name):
results = []
@@ -296,5 +315,6 @@ def compute_correlation_rust(
results, top_a, top_b),
"this_trait": this_trait.name,
"target_dataset": start_vars['corr_dataset'],
+ "traits_metadata": get_metadata(target_dataset, list(results.keys())),
"return_results": n_top
}