about summary refs log tree commit diff
diff options
context:
space:
mode:
authorzsloan2022-03-25 20:57:32 +0000
committerzsloan2022-03-25 16:05:30 -0500
commit270aa749638ab917920a77ec9e8d41eb24c80e1a (patch)
tree3cd961fe28d096f0fa9f5c7a5b3d5bb5af715d46
parent155c392984daaa1f43712063c097a1936cf7e4c4 (diff)
downloadgenenetwork2-270aa749638ab917920a77ec9e8d41eb24c80e1a.tar.gz
Fix issues that prevented genotype traits from being added to collections
Some of this was caused by heatmaps supporting code; that code should probably pass the traits differently than the way it does in the "trait_info_str" function
-rw-r--r--wqflask/base/trait.py1
-rw-r--r--wqflask/wqflask/collect.py23
2 files changed, 20 insertions, 4 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index f0749858..ee5dda38 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -94,6 +94,7 @@ class GeneralTrait:
         self.num_overlap = None
         self.strand_probe = None
         self.symbol = None
+        self.abbreviation = None
         self.display_name = self.name
 
         self.LRS_score_repr = "N/A"
diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py
index 815bb7c1..de61323a 100644
--- a/wqflask/wqflask/collect.py
+++ b/wqflask/wqflask/collect.py
@@ -200,18 +200,33 @@ def trait_info_str(trait):
         return (trt.symbol or trt.abbreviation or "N/A")[:20]
 
     def __lrs(trt):
-        return (
-            f"{float(trait.LRS_score_repr):0.3f}" if float(trait.LRS_score_repr) > 0
-            else f"{trait.LRS_score_repr}")
+        if trait.dataset.type == "Geno":
+            return 0
+        else:
+            return (
+                f"{float(trait.LRS_score_repr):0.3f}" if float(trait.LRS_score_repr) > 0
+                else f"{trait.LRS_score_repr}")
+
+    def __lrs_location(trt):
+        if hasattr(trt, "LRS_location_repr"):
+            return trt.LRS_location_repr
+        else:
+            return "N/A"
 
     def __location(trt):
         if hasattr(trt, "location_repr"):
             return trt.location_repr
         return None
 
+    def __mean(trt):
+        if trait.mean:
+            return trt.mean
+        else:
+            return 0
+
     return "{}|||{}|||{}|||{}|||{}|||{:0.3f}|||{}|||{}".format(
         trait.name, trait.dataset.name, __trait_desc(trait), __symbol(trait),
-        __location(trait), trait.mean, __lrs(trait), trait.LRS_location_repr)
+        __location(trait), __mean(trait), __lrs(trait), __lrs_location(trait))
 
 @app.route("/collections/view")
 def view_collection():