about summary refs log tree commit diff
path: root/wqflask/base
diff options
context:
space:
mode:
authorBonfaceKilz2020-10-12 14:24:29 +0300
committerBonfaceKilz2020-10-12 14:24:29 +0300
commit276e0381d62b07525e0ebd28528e59be8230c954 (patch)
tree287758f0efa03f76d87a4debb1a50d5e6f806547 /wqflask/base
parent16cd94dfa0e892576f1c566948b775b954f7f508 (diff)
parent58c3815571f83db0296dc099f1e4c6ff69619f64 (diff)
downloadgenenetwork2-276e0381d62b07525e0ebd28528e59be8230c954.tar.gz
Merge branch 'testing' into build/python3-migration
Diffstat (limited to 'wqflask/base')
-rw-r--r--wqflask/base/data_set.py40
-rw-r--r--wqflask/base/trait.py15
2 files changed, 12 insertions, 43 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 295f5c48..0d4ac24b 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -150,10 +150,12 @@ Publish or ProbeSet. E.g.
             "geno": "Geno",
         }
 
+        group_name = name
         if t in ['pheno', 'other_pheno']:
-            name = name.replace("Publish", "")
+            group_name = name.replace("Publish", "")
 
-        if bool(len(g.db.execute(sql_query_mapping[t].format(name)).fetchone())):
+        results = g.db.execute(sql_query_mapping[t].format(group_name)).fetchone()
+        if results:
             self.datasets[name] = dataset_name_mapping[t]
             self.redis_instance.set("dataset_structure", json.dumps(self.datasets))
             return True
@@ -1154,40 +1156,6 @@ class TempDataSet(DataSet):
         self.fullname = 'Temporary Storage'
         self.shortname = 'Temp'
 
-    @staticmethod
-    def handle_pca(desc):
-        if 'PCA' in desc:
-            # Todo: Modernize below lines
-            desc = desc[desc.rindex(':')+1:].strip()
-        else:
-            desc = desc[:desc.index('entered')].strip()
-        return desc
-
-    def get_desc(self):
-        query = 'SELECT description FROM Temp WHERE Name=%s' % self.name
-        logger.sql(query)
-        g.db.execute(query)
-        desc = g.db.fetchone()[0]
-        desc = self.handle_pca(desc)
-        return desc
-
-    def retrieve_sample_data(self, trait):
-        query = """
-                SELECT
-                        Strain.Name, TempData.value, TempData.SE, TempData.NStrain, TempData.Id
-                FROM
-                        TempData, Temp, Strain
-                WHERE
-                        TempData.StrainId = Strain.Id AND
-                        TempData.Id = Temp.DataId AND
-                        Temp.name = '%s'
-                Order BY
-                        Strain.Name
-                """ % escape(trait.name)
-
-        logger.sql(query)
-        results = g.db.execute(query).fetchall()
-
 
 def geno_mrna_confidentiality(ob):
     dataset_table = ob.type + "Freeze"
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index a493cfbf..cfc02f8b 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -132,7 +132,7 @@ class GeneralTrait(object):
 
     @property
     def description_fmt(self):
-        '''Return a text formated description'''
+        """Return a text formated description"""
         if self.dataset.type == 'ProbeSet':
             if self.description:
                 formatted = self.description
@@ -153,7 +153,7 @@ class GeneralTrait(object):
 
     @property
     def alias_fmt(self):
-        '''Return a text formatted alias'''
+        """Return a text formatted alias"""
 
         alias = 'Not available'
         if getattr(self, "alias", None):
@@ -164,7 +164,7 @@ class GeneralTrait(object):
 
     @property
     def wikidata_alias_fmt(self):
-        '''Return a text formatted alias'''
+        """Return a text formatted alias"""
 
         alias = 'Not available'
         if self.symbol:
@@ -194,12 +194,12 @@ class GeneralTrait(object):
 
     @property
     def location_fmt(self):
-        '''Return a text formatted location
+        """Return a text formatted location
 
         While we're at it we set self.location in case we need it
         later (do we?)
 
-        '''
+        """
 
         if self.chr and self.mb:
             self.location = 'Chr %s @ %s Mb' % (self.chr, self.mb)
@@ -542,7 +542,7 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
 
             if (str(description_display or "") != "" and
                 description_display != 'N/A' and
-                str(target_string or "") != "" and target_string != 'None'):
+                    str(target_string or "") != "" and target_string != 'None'):
                 description_display = description_display + '; ' + target_string.strip()
 
             # Save it for the jinja2 template
@@ -631,7 +631,8 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
                 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))
+                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: