about summary refs log tree commit diff
path: root/wqflask/base
diff options
context:
space:
mode:
authorzsloan2019-06-18 15:39:36 -0500
committerzsloan2019-06-18 15:39:36 -0500
commit172bf33d20d6f42650b415571c1185af4cbd22c5 (patch)
tree1adbb9c70c1512786a3c84d3e87b5f2271a62cdd /wqflask/base
parent21529db361812860286faf7f3fc4b08e9637b687 (diff)
downloadgenenetwork2-172bf33d20d6f42650b415571c1185af4cbd22c5.tar.gz
Fixed issue with sorting involving 0's on trait page
Fixed links to dataset info pages in search results and correlation results pages
Diffstat (limited to 'wqflask/base')
-rw-r--r--wqflask/base/data_set.py41
1 files changed, 26 insertions, 15 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 1fd1792e..4fee5c7a 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -289,7 +289,6 @@ class DatasetGroup(object):
         self.parlist = None
         self.get_f1_parent_strains()
 
-        self.accession_id = self.get_accession_id()
         self.mapping_id, self.mapping_names = self.get_mapping_methods()
 
         self.species = webqtlDatabaseFunction.retrieve_species(self.name)
@@ -299,20 +298,6 @@ class DatasetGroup(object):
         self._datasets = None
         self.genofile = None
 
-    def get_accession_id(self):
-        results = g.db.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where
-                    InbredSet.Name = %s and
-                    PublishFreeze.InbredSetId = InbredSet.Id and
-                    InfoFiles.InfoPageName = PublishFreeze.Name and
-                    PublishFreeze.public > 0 and
-                    PublishFreeze.confidentiality < 1 order by
-                    PublishFreeze.CreateTime desc""", (self.name)).fetchone()
-
-        if results != None:
-            return str(results[0])
-        else:
-            return "None"
-
     def get_mapping_methods(self):
 
         mapping_id = g.db.execute("select MappingMethodId from InbredSet where Name= '%s'" % self.name).fetchone()[0]
@@ -510,6 +495,7 @@ class DataSet(object):
             self.check_confidentiality()
             self.retrieve_other_names()
             self.group = DatasetGroup(self)   # sets self.group and self.group_id and gets genotype
+            self.accession_id = self.get_accession_id()
         if get_samplelist == True:
              self.group.get_samplelist()
         self.species = species.TheSpecies(self)
@@ -524,6 +510,31 @@ class DataSet(object):
     def riset():
         Weve_Renamed_This_As_Group
 
+    def get_accession_id(self):
+        if self.type == "Publish":
+            results = g.db.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where
+                        InbredSet.Name = %s and
+                        PublishFreeze.InbredSetId = InbredSet.Id and
+                        InfoFiles.InfoPageName = PublishFreeze.Name and
+                        PublishFreeze.public > 0 and
+                        PublishFreeze.confidentiality < 1 order by
+                        PublishFreeze.CreateTime desc""", (self.group.name)).fetchone()
+        elif self.type == "Geno":
+            results = g.db.execute("""select InfoFiles.GN_AccesionId from InfoFiles, GenoFreeze, InbredSet where
+                        InbredSet.Name = %s and
+                        GenoFreeze.InbredSetId = InbredSet.Id and
+                        InfoFiles.InfoPageName = GenoFreeze.ShortName and
+                        GenoFreeze.public > 0 and
+                        GenoFreeze.confidentiality < 1 order by
+                        GenoFreeze.CreateTime desc""", (self.group.name)).fetchone()
+        else:
+            results = None
+
+        if results != None:
+            return str(results[0])
+        else:
+            return "None"
+
     def retrieve_other_names(self):
         """This method fetches the the dataset names in search_result.