aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-09-22 06:36:32 +0300
committerFrederick Muriuki Muriithi2022-09-22 06:36:32 +0300
commit07661315b8e92de22bcea3434c101663b2235c12 (patch)
tree9ede62b2a61128a32f57587ed520e6da57de3c36 /wqflask
parent30f305c1b87b4b6c4f308b15d5ae9248dc367e14 (diff)
downloadgenenetwork2-07661315b8e92de22bcea3434c101663b2235c12.tar.gz
Use passed in cursor instead of initialising a new cursor.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/show_trait/show_trait.py52
1 files changed, 25 insertions, 27 deletions
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 8cea271d..02a3365b 100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -82,20 +82,19 @@ class ShowTrait:
if not blatsequence:
# XZ, 06/03/2009: ProbeSet name is not unique among platforms. We should use ProbeSet Id instead.
seqs = ()
- with database_connection() as conn, conn.cursor() as cursor:
- cursor.execute(
- "SELECT Probe.Sequence, Probe.Name "
- "FROM Probe, ProbeSet, ProbeSetFreeze, "
- "ProbeSetXRef WHERE "
- "ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id "
- "AND ProbeSetXRef.ProbeSetId = ProbeSet.Id AND "
- "ProbeSetFreeze.Name = %s AND "
- "ProbeSet.Name = %s AND "
- "Probe.ProbeSetId = ProbeSet.Id ORDER "
- "BY Probe.SerialOrder",
- (self.this_trait.dataset.name, self.this_trait.name,)
- )
- seqs = cursor.fetchall()
+ db_cursor.execute(
+ "SELECT Probe.Sequence, Probe.Name "
+ "FROM Probe, ProbeSet, ProbeSetFreeze, "
+ "ProbeSetXRef WHERE "
+ "ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id "
+ "AND ProbeSetXRef.ProbeSetId = ProbeSet.Id AND "
+ "ProbeSetFreeze.Name = %s AND "
+ "ProbeSet.Name = %s AND "
+ "Probe.ProbeSetId = ProbeSet.Id ORDER "
+ "BY Probe.SerialOrder",
+ (self.this_trait.dataset.name, self.this_trait.name,)
+ )
+ seqs = db_cursor.fetchall()
if not seqs:
raise ValueError
else:
@@ -109,19 +108,18 @@ class ShowTrait:
# XZ, 06/03/2009: ProbeSet name is not unique among platforms. We should use ProbeSet Id instead.
seqs = ()
- with database_connection() as conn, conn.cursor() as cursor:
- cursor.execute(
- "SELECT Probe.Sequence, Probe.Name "
- "FROM Probe, ProbeSet, ProbeSetFreeze, "
- "ProbeSetXRef WHERE "
- "ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id "
- "AND ProbeSetXRef.ProbeSetId = ProbeSet.Id AND "
- "ProbeSetFreeze.Name = %s AND ProbeSet.Name = %s "
- "AND Probe.ProbeSetId = ProbeSet.Id "
- "ORDER BY Probe.SerialOrder",
- (self.this_trait.dataset.name, self.this_trait.name,)
- )
- seqs = cursor.fetchall()
+ db_cursor.execute(
+ "SELECT Probe.Sequence, Probe.Name "
+ "FROM Probe, ProbeSet, ProbeSetFreeze, "
+ "ProbeSetXRef WHERE "
+ "ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id "
+ "AND ProbeSetXRef.ProbeSetId = ProbeSet.Id AND "
+ "ProbeSetFreeze.Name = %s AND ProbeSet.Name = %s "
+ "AND Probe.ProbeSetId = ProbeSet.Id "
+ "ORDER BY Probe.SerialOrder",
+ (self.this_trait.dataset.name, self.this_trait.name,)
+ )
+ seqs = db_cursor.fetchall()
for seqt in seqs:
if int(seqt[1][-1]) % 2 == 1:
blatsequence += '%3EProbe_' + \