From 8f70b408c6df130ba9bef2b159c32ef0c8d6c327 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 5 Nov 2020 15:21:28 -0600
Subject: Removed html from generate_corr_json since that will be done by the
column definitions after passing the data to DataTables as JSON
---
wqflask/wqflask/correlation/show_corr_results.py | 32 ++++++++----------------
1 file changed, 11 insertions(+), 21 deletions(-)
(limited to 'wqflask')
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index 4c2b64ba..f0187ef9 100644
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -484,30 +484,26 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap
if trait.view == False:
continue
results_dict = {}
- if not for_api:
- results_dict['checkbox'] = ""
- results_dict['index'] = i + 1
- results_dict['trait_id'] = ""+str(trait.name)+""
- else:
- results_dict['trait_id'] = trait.name
+ results_dict['index'] = i + 1
+ results_dict['trait_id'] = trait.name
if target_dataset.type == "ProbeSet":
results_dict['symbol'] = trait.symbol
results_dict['description'] = trait.description_display
results_dict['location'] = trait.location_repr
- results_dict['mean'] = float(trait.mean)
+ if trait.mean and trait.mean != "":
+ results_dict['mean'] = float(trait.mean)
+ else:
+ results_dict['mean'] = "N/A"
if trait.LRS_score_repr != "N/A":
results_dict['lrs_score'] = "%.1f" % float(trait.LRS_score_repr)
else:
results_dict['lrs_score'] = "N/A"
results_dict['lrs_location'] = trait.LRS_location_repr
- if trait.additive != "":
+ if trait.additive and trait.additive != "":
results_dict['additive'] = "%0.3f" % float(trait.additive)
else:
results_dict['additive'] = "N/A"
- if for_api:
- results_dict['sample_r'] = "%0.3f" % float(trait.sample_r)
- else:
- results_dict['sample_r'] = "" + "%0.3f" % float(trait.sample_r) + ""
+ results_dict['sample_r'] = "%0.3f" % float(trait.sample_r)
results_dict['num_overlap'] = trait.num_overlap
results_dict['sample_p'] = "%0.3e" % float(trait.sample_p)
if trait.lit_corr == "" or trait.lit_corr == 0:
@@ -535,22 +531,16 @@ def generate_corr_json(corr_results, this_trait, dataset, target_dataset, for_ap
results_dict['pubmed'] = "N/A"
results_dict['lrs_score'] = trait.LRS_score_repr
results_dict['lrs_location'] = trait.LRS_location_repr
- if trait.additive != "":
+ if trait.additive and trait.additive != "":
results_dict['additive'] = "%0.3f" % float(trait.additive)
else:
results_dict['additive'] = "N/A"
- if for_api:
- results_dict['sample_r'] = "%0.3f" % trait.sample_r
- else:
- results_dict['sample_r'] = "" + "%0.3f" % trait.sample_r + ""
+ results_dict['sample_r'] = "%0.3f" % trait.sample_r
results_dict['num_overlap'] = trait.num_overlap
results_dict['sample_p'] = "%0.3e" % float(trait.sample_p)
else:
results_dict['lrs_location'] = trait.LRS_location_repr
- if for_api:
- results_dict['sample_r'] = "%0.3f" % trait.sample_r
- else:
- results_dict['sample_r'] = "" + "%0.3f" % float(trait.sample_r) + ""
+ results_dict['sample_r'] = "%0.3f" % trait.sample_r
results_dict['num_overlap'] = trait.num_overlap
results_dict['sample_p'] = "%0.3e" % float(trait.sample_p)
--
cgit v1.2.3