aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/db/datasets.py28
-rw-r--r--gn3/db/partial_correlations.py20
2 files changed, 1 insertions, 47 deletions
diff --git a/gn3/db/datasets.py b/gn3/db/datasets.py
index a41e228..1d6cdf8 100644
--- a/gn3/db/datasets.py
+++ b/gn3/db/datasets.py
@@ -82,30 +82,6 @@ def retrieve_geno_trait_dataset_name(
"dataset_shortname"],
cursor.fetchone()))
-def retrieve_temp_trait_dataset_name(
- threshold: int, name: str, connection: Any):
- """
- Get the ID, DataScale and various name formats for a `Temp` trait.
- """
- query = (
- "SELECT Id, Name, FullName, ShortName "
- "FROM TempFreeze "
- "WHERE "
- "public > %(threshold)s "
- "AND "
- "(Name = %(name)s OR FullName = %(name)s OR ShortName = %(name)s)")
- with connection.cursor() as cursor:
- cursor.execute(
- query,
- {
- "threshold": threshold,
- "name": name
- })
- return dict(zip(
- ["dataset_id", "dataset_name", "dataset_fullname",
- "dataset_shortname"],
- cursor.fetchone()))
-
def retrieve_dataset_name(
trait_type: str, threshold: int, trait_name: str, dataset_name: str,
conn: Any):
@@ -120,9 +96,7 @@ def retrieve_dataset_name(
"ProbeSet": retrieve_probeset_trait_dataset_name,
"Publish": retrieve_publish_trait_dataset_name,
"Geno": retrieve_geno_trait_dataset_name,
- "Temp": retrieve_temp_trait_dataset_name}
- if trait_type == "Temp":
- return retrieve_temp_trait_dataset_name(threshold, trait_name, conn)
+ "Temp": lambda threshold, dataset_name, conn: {}}
return fn_map[trait_type](threshold, dataset_name, conn)
diff --git a/gn3/db/partial_correlations.py b/gn3/db/partial_correlations.py
index 3e77367..caf8d35 100644
--- a/gn3/db/partial_correlations.py
+++ b/gn3/db/partial_correlations.py
@@ -587,24 +587,6 @@ def geno_traits_datasets(conn: Any, threshold: int, traits: Tuple[Dict]):
}
} for trait in traits)
-def temp_datasets_names(conn, threshold, dataset_names):
- """
- Get the ID, DataScale and various name formats for a `Temp` trait.
- """
- query = (
- "SELECT Id, Name, FullName, ShortName "
- "FROM TempFreeze "
- "WHERE "
- "public > %s "
- "AND "
- "(Name = ({names}) OR FullName = ({names}) OR ShortName = ({names}))")
- with conn.cursor(cursorclass=DictCursor) as cursor:
- cursor.execute(
- query.format(names=", ".join(["%s"] * len(dataset_names))),
- (threshold,) +(dataset_names * 3))
- return {ds["dataset_name"]: ds for ds in cursor.fetchall()}
- return {}
-
def temp_datasets_groups(conn, dataset_names):
"""
Retrieve the Group, and GroupID values for `Temp` trait types.
@@ -625,13 +607,11 @@ def temp_traits_datasets(conn: Any, threshold: int, traits: Tuple[Dict]):
Retrieve datasets for 'Temp' traits.
"""
dataset_names = tuple(set(trait["db"]["dataset_name"] for trait in traits))
- dataset_names_info = temp_datasets_names(conn, threshold, dataset_names)
dataset_groups = temp_datasets_groups(conn, dataset_names)
return tuple({
**trait,
"db": {
**trait["db"],
- **dataset_names_info.get(trait["db"]["dataset_name"], {}),
**dataset_groups.get(trait["db"]["dataset_name"], {})
}
} for trait in traits)