aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2020-12-15 11:53:40 -0600
committerzsloan2020-12-15 11:53:40 -0600
commit2f84b17bbd632fd7591c2b8c51bb071e6e16d92d (patch)
tree937286c268d70719ca102ccea7ec8a5d9c0d256b /wqflask
parent5a2284984e75a4a25debdfcbdc8c2951a799c4cb (diff)
downloadgenenetwork2-2f84b17bbd632fd7591c2b8c51bb071e6e16d92d.tar.gz
Changed string formatting to use preferable Python 3 syntax and converted LRS scores to LOD scores for the search results page
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/search_results.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index ce836ce2..0d0894a4 100644
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -126,11 +126,14 @@ views.py).
trait_dict['mean'] = "N/A"
trait_dict['additive'] = "N/A"
if this_trait.mean != "" and this_trait.mean != None:
- trait_dict['mean'] = '%.3f' % this_trait.mean
- trait_dict['lrs_score'] = this_trait.LRS_score_repr
+ trait_dict['mean'] = f"{this_trait.mean:.3f}"
+ try:
+ trait_dict['lod_score'] = f"{float(this_trait.LRS_score_repr) / 4.61:.1f}"
+ except:
+ trait_dict['lod_score'] = "N/A"
trait_dict['lrs_location'] = this_trait.LRS_location_repr
if this_trait.additive != "":
- trait_dict['additive'] = '%.3f' % this_trait.additive
+ trait_dict['additive'] = f"{this_trait.additive:.3f}"
elif this_trait.dataset.type == "Geno":
trait_dict['location'] = this_trait.location_repr
elif this_trait.dataset.type == "Publish":
@@ -143,12 +146,15 @@ views.py).
trait_dict['pubmed_text'] = this_trait.pubmed_text
trait_dict['mean'] = "N/A"
if this_trait.mean != "" and this_trait.mean != None:
- trait_dict['mean'] = '%.3f' % this_trait.mean
- trait_dict['lrs_score'] = this_trait.LRS_score_repr
+ trait_dict['mean'] = f"{this_trait.mean:.3f}"
+ try:
+ trait_dict['lod_score'] = f"{float(this_trait.LRS_score_repr) / 4.61:.1f}"
+ except:
+ trait_dict['lod_score'] = "N/A"
trait_dict['lrs_location'] = this_trait.LRS_location_repr
trait_dict['additive'] = "N/A"
if this_trait.additive != "":
- trait_dict['additive'] = '%.3f' % this_trait.additive
+ trait_dict['additive'] = f"{this_trait.additive:.3f}"
# Convert any bytes in dict to a normal utf-8 string
for key in trait_dict.keys():
if isinstance(trait_dict[key], bytes):