aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-02-21 17:55:08 +0300
committerFrederick Muriuki Muriithi2022-02-21 17:55:08 +0300
commit393700a432e25336c5afd1f008152202853f5bc2 (patch)
tree745e946f9441d33cfb4461e0dfc62c82baa40cc9 /gn3
parenta35fce27875d9db80dce1976b6f8ee8c00ecfe0a (diff)
downloadgenenetwork3-393700a432e25336c5afd1f008152202853f5bc2.tar.gz
Fix minor issues introduced while fixing linting errors
Diffstat (limited to 'gn3')
-rw-r--r--gn3/computations/partial_correlations.py2
-rw-r--r--gn3/db/partial_correlations.py12
-rw-r--r--gn3/db/traits.py2
-rw-r--r--gn3/fs_helpers.py5
4 files changed, 11 insertions, 10 deletions
diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py
index f7ddfd0..7110cc5 100644
--- a/gn3/computations/partial_correlations.py
+++ b/gn3/computations/partial_correlations.py
@@ -141,7 +141,7 @@ def find_identical_traits(
return acc + ident[1]
def __dictify_controls__(acc, control_item):
- ckey = tuple("{item:.3f}" for item in control_item[0])
+ ckey = tuple(f"{item:.3f}" for item in control_item[0])
return {**acc, ckey: acc.get(ckey, tuple()) + (control_item[1],)}
return (reduce(## for identical control traits
diff --git a/gn3/db/partial_correlations.py b/gn3/db/partial_correlations.py
index a28b111..72dbf1a 100644
--- a/gn3/db/partial_correlations.py
+++ b/gn3/db/partial_correlations.py
@@ -48,7 +48,7 @@ def temp_traits_data(conn, traits):
"FROM TempData, Temp, Strain "
"WHERE TempData.StrainId = Strain.Id "
"AND TempData.Id = Temp.DataId "
- "AND Temp.name IN ({', '.join(['%s'] * len(traits))}) "
+ f"AND Temp.name IN ({', '.join(['%s'] * len(traits))}) "
"ORDER BY Strain.Name")
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
@@ -386,7 +386,7 @@ def temp_traits_info(
"""
query = (
"SELECT Name as trait_name, name, description FROM Temp "
- "WHERE Name IN ({', '.join(['%s'] * len(traits))})")
+ f"WHERE Name IN ({', '.join(['%s'] * len(traits))})")
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
query,
@@ -450,7 +450,7 @@ def publish_datasets_groups(conn: Any, dataset_names: Tuple[str]):
"InbredSet.Id "
"FROM InbredSet, PublishFreeze "
"WHERE PublishFreeze.InbredSetId = InbredSet.Id "
- "AND PublishFreeze.Name IN ({', '.join(['%s'] * len(dataset_names))})")
+ f"AND PublishFreeze.Name IN ({', '.join(['%s'] * len(dataset_names))})")
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(query, tuple(dataset_names))
return organise_groups_by_dataset(cursor.fetchall())
@@ -500,7 +500,7 @@ def probeset_datasets_groups(conn, dataset_names):
"FROM InbredSet, ProbeSetFreeze, ProbeFreeze "
"WHERE ProbeFreeze.InbredSetId = InbredSet.Id "
"AND ProbeFreeze.Id = ProbeSetFreeze.ProbeFreezeId "
- "AND ProbeSetFreeze.Name IN ({', '.join(['%s'] * len(dataset_names))})")
+ f"AND ProbeSetFreeze.Name IN ({', '.join(['%s'] * len(dataset_names))})")
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(query, tuple(dataset_names))
return organise_groups_by_dataset(cursor.fetchall())
@@ -547,7 +547,7 @@ def geno_datasets_groups(conn, dataset_names):
"SELECT GenoFreeze.Name AS dataset_name, InbredSet.Name, InbredSet.Id "
"FROM InbredSet, GenoFreeze "
"WHERE GenoFreeze.InbredSetId = InbredSet.Id "
- "AND GenoFreeze.Name IN ({', '.join(['%s'] * len(dataset_names))})")
+ f"AND GenoFreeze.Name IN ({', '.join(['%s'] * len(dataset_names))})")
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(query, tuple(dataset_names))
return organise_groups_by_dataset(cursor.fetchall())
@@ -575,7 +575,7 @@ def temp_datasets_groups(conn, dataset_names):
"SELECT Temp.Name AS dataset_name, InbredSet.Name, InbredSet.Id "
"FROM InbredSet, Temp "
"WHERE Temp.InbredSetId = InbredSet.Id "
- "AND Temp.Name IN ({', '.join(['%s'] * len(dataset_names))})")
+ f"AND Temp.Name IN ({', '.join(['%s'] * len(dataset_names))})")
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(query, tuple(dataset_names))
return organise_groups_by_dataset(cursor.fetchall())
diff --git a/gn3/db/traits.py b/gn3/db/traits.py
index 90d1e9d..6f979d8 100644
--- a/gn3/db/traits.py
+++ b/gn3/db/traits.py
@@ -402,7 +402,7 @@ def retrieve_probeset_trait_info(trait_data_source: Dict[str, Any], conn: Any):
"probe_set_note_by_rw", "flag")
columns = (f"ProbeSet.{x}" for x in keys)
query = (
- f"SELECT {','.join(columns)} "
+ f"SELECT {', '.join(columns)} "
"FROM "
"ProbeSet, ProbeSetFreeze, ProbeSetXRef "
"WHERE "
diff --git a/gn3/fs_helpers.py b/gn3/fs_helpers.py
index e2f7ee2..73f6567 100644
--- a/gn3/fs_helpers.py
+++ b/gn3/fs_helpers.py
@@ -71,8 +71,9 @@ contents to TARGET_DIR/<dir-hash>.
os.mkdir(os.path.join(target_dir, token))
gzipped_file.save(tar_target_loc)
# Extract to "tar_target_loc/token"
- with tarfile.open(tar_target_loc) as tar:
- tar.extractall(path=os.path.join(target_dir, token))
+ tar = tarfile.open(tar_target_loc)
+ tar.extractall(path=os.path.join(target_dir, token))
+ tar.close()
# pylint: disable=W0703
except Exception:
return {"status": 128, "error": "gzip failed to unpack file"}