about summary refs log tree commit diff
path: root/wqflask/base/trait.py
diff options
context:
space:
mode:
authorzsloan2022-10-18 22:00:32 +0000
committerzsloan2022-10-18 22:00:32 +0000
commit060c50532161cfdbd61096ef02cdee614b886fbb (patch)
tree5877f9b2475f16d3706ca902574863babecbbedf /wqflask/base/trait.py
parentd8309bdbbbdca875fa042ee9bcd7dc6b40e2e9a7 (diff)
downloadgenenetwork2-060c50532161cfdbd61096ef02cdee614b886fbb.tar.gz
Change logic in retrieve_trait_info to account for situations where a marker doesn't have a position in the DB
Diffstat (limited to 'wqflask/base/trait.py')
-rw-r--r--wqflask/base/trait.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 781abf7a..6e835b45 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -550,7 +550,7 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
                         (trait.name, dataset.id,)
                     )
                     trait_qtl = cursor.fetchone()
-                    if trait_qtl:
+                    if any(trait_qtl):
                         trait.locus, trait.lrs, trait.pvalue, trait.mean, trait.additive = trait_qtl
                         if trait.locus:
                             cursor.execute(
@@ -565,7 +565,7 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
                                 trait.locus_chr = result[0]
                                 trait.locus_mb = result[1]
                             else:
-                                trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = ""
+                                trait.locus_chr = trait.locus_mb = ""
                         else:
                             trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = ""
 
@@ -597,9 +597,10 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
                             trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = ""
                     else:
                         trait.locus = trait.lrs = trait.additive = ""
-                if (dataset.type == 'Publish' or dataset.type == "ProbeSet") and str(trait.locus_chr or "") != "" and str(trait.locus_mb or "") != "":
-                    trait.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % (
-                        trait.locus_chr, float(trait.locus_mb))
+                if (dataset.type == 'Publish' or dataset.type == "ProbeSet"):
+                    if str(trait.locus_chr or "") != "" and str(trait.locus_mb or "") != "":
+                        trait.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % (
+                            trait.locus_chr, float(trait.locus_mb))
                     if str(trait.lrs or "") != "":
                         trait.LRS_score_repr = LRS_score_repr = '%3.1f' % trait.lrs
         else: