diff options
author | Frederick Muriuki Muriithi | 2022-02-18 14:17:29 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-02-18 14:17:29 +0300 |
commit | 75dcfe295af57b16428c586cc11dbaa827a5feba (patch) | |
tree | f24fe87f97a278552f7d1d9ad4b998339a1affe8 /gn3/db | |
parent | 83a7aa7533f8f4ecac049dc0e93aff6429e6e5ae (diff) | |
download | genenetwork3-75dcfe295af57b16428c586cc11dbaa827a5feba.tar.gz |
Remove code trying to query non-existent `TempFreeze` table
The code was migrated from GN1 with a faulty assumption that all trait types
have a corresponding `*Freeze` table in the database. This assumption is not
true for the `Temp` traits.
This commit removes the buggy code.
Diffstat (limited to 'gn3/db')
-rw-r--r-- | gn3/db/datasets.py | 28 | ||||
-rw-r--r-- | gn3/db/partial_correlations.py | 20 |
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) |