aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/data_set.py
diff options
context:
space:
mode:
authorMunyoki Kilyungi2022-09-06 15:45:10 +0300
committerBonfaceKilz2022-09-08 14:26:19 +0300
commitbfbcd60c383f231571a6b55dc9644da88b672c82 (patch)
tree372edf52f61b2ff7dab080eaf9a54b66310ce4f1 /wqflask/base/data_set.py
parent71d958db0f9e874f74358b76a9fb1847076c20c3 (diff)
downloadgenenetwork2-bfbcd60c383f231571a6b55dc9644da88b672c82.tar.gz
Remove intermediate variables that are only used once
* wqflask/base/data_set.py (DatasetGroup.__init__): Remove "query" variable. (DataSet.chunk_dataset): Fix indentation. * wqflask/wqflask/search_results.py (get_GO_symbols): Remove "this_term" variable. * wqflask/wqflask/views.py (search_page): Remove "the_search" variable.
Diffstat (limited to 'wqflask/base/data_set.py')
-rw-r--r--wqflask/base/data_set.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 41c94078..b877f176 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -316,16 +316,20 @@ class DatasetGroup:
def __init__(self, dataset, name=None):
"""This sets self.group and self.group_id"""
- query = """SELECT InbredSet.Name, InbredSet.Id, InbredSet.GeneticType,
- InbredSet.InbredSetCode FROM InbredSet where Name=%s
- """
- if not name:
- query, name = dataset.query_for_group, dataset.name
with database_connection() as conn, conn.cursor() as cursor:
- cursor.execute(query, (name,))
- results = cursor.fetchone()
- if results:
- self.name, self.id, self.genetic_type, self.code = results
+ if not name:
+ cursor.execute(dataset.query_for_group,
+ (dataset.name,))
+ else:
+ cursor.execute(
+ "SELECT InbredSet.Name, "
+ "InbredSet.Id, "
+ "InbredSet.GeneticType, "
+ "InbredSet.InbredSetCode "
+ "FROM InbredSet WHERE Name = %s",
+ (dataset.name,))
+ (self.name, self.id,
+ self.genetic_type, self.code) = cursor.fetchone()
if self.name == 'BXD300':
self.name = "BXD"
@@ -672,7 +676,7 @@ class DataSet:
"WHERE ProbeSetFreeze.Name = %s AND "
"ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id "
"AND ProbeSetXRef.ProbeSetId = ProbeSet.Id",
- (self.name,))
+ (self.name,))
# should cache this
traits_name_dict = dict(cursor.fetchall())