From 312835014d8d243c72f3520bb116eb3c36cd6b85 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Mon, 28 Sep 2020 02:33:09 +0300 Subject: Convert None to "" in if statement * wqflask/base/trait.py: Fixes error parsing error: "(GeneNetwork error: float argument required, not NoneType)" --- wqflask/base/trait.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'wqflask/base') diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 7666348e..bdd9c3d6 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -599,12 +599,11 @@ 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 trait.locus_chr != "" and trait.locus_mb != "": + 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 trait.lrs != "": + if str(trait.lrs or "") != "": trait.LRS_score_repr = LRS_score_repr = '%3.1f' % trait.lrs else: raise KeyError, `trait.name`+' information is not found in the database.' - return trait \ No newline at end of file + return trait -- cgit v1.2.3 From d34258bed3ef13350499414100401df3bf08a105 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Mon, 28 Sep 2020 18:08:34 +0300 Subject: Fix casting error * wqflask/base/trait.py (retrieve_trait_info): If the description_string or discription_display value return a None object, evaluate to an empty string. Fixes errors related to *len(None)*. --- wqflask/base/trait.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'wqflask/base') diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index bdd9c3d6..8f8b5b70 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -507,13 +507,14 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False): description_string = unicode(str(trait.description).strip(codecs.BOM_UTF8), 'utf-8') target_string = unicode(str(trait.probe_target_description).strip(codecs.BOM_UTF8), 'utf-8') - if len(description_string) > 1 and description_string != 'None': + if str(description_string or "") != "" and description_string != 'None': description_display = description_string else: description_display = trait.symbol - if (len(description_display) > 1 and description_display != 'N/A' and - len(target_string) > 1 and target_string != 'None'): + if (str(description_display or "") != "" and + description_display != 'N/A' and + str(target_string or "") != "" and target_string != 'None'): description_display = description_display + '; ' + target_string.strip() # Save it for the jinja2 template -- cgit v1.2.3 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') 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