From 4bd5534658fe7ed2a9ffd50c137be81d7a7b190b Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 30 Sep 2020 13:32:54 -0500 Subject: Removed unused code from TempDataSet class * wqflask/base/data_set.py - TempDataSet class contained some code referring to the SQL DB, but temp traits aren't stored in the SQL DB anymore --- wqflask/base/data_set.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'wqflask/base/data_set.py') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index afffe780..e0ef559c 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -1173,40 +1173,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" -- cgit v1.2.3 From 217f527e873d5197c7efcaec627e1df5afadefa4 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 8 Oct 2020 15:32:18 -0500 Subject: Fixed issue where new phenotype groups wouldn't be saved to the self.datasets property because the group name was used as the key (instead of the group name + "Publish", which is the full dataset name for phenotypes) * wqflask/base/data_set.py - Set "group_name" as a separate variable from "name" to avoid it being used as the key in self.datasets --- wqflask/base/data_set.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'wqflask/base/data_set.py') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index e0ef559c..aeafc027 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -150,10 +150,11 @@ 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())): + if bool(len(g.db.execute(sql_query_mapping[t].format(group_name)).fetchone())): self.datasets[name] = dataset_name_mapping[t] self.redis_instance.set("dataset_structure", json.dumps(self.datasets)) return True -- cgit v1.2.3 From 3d444c29ab975e313534dd7c57747b3e79f06c26 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 8 Oct 2020 15:40:18 -0500 Subject: Fixed remaining issue that applies to all dataset types * wqflask/base/data_set.py - Fixed issue where there was an error when trying to take the len of the query results when there were no results --- wqflask/base/data_set.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'wqflask/base/data_set.py') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index aeafc027..2f1549ae 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -154,7 +154,8 @@ Publish or ProbeSet. E.g. if t in ['pheno', 'other_pheno']: group_name = name.replace("Publish", "") - if bool(len(g.db.execute(sql_query_mapping[t].format(group_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 -- cgit v1.2.3