aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-05-31 05:00:05 +0300
committerFrederick Muriuki Muriithi2023-05-31 05:00:05 +0300
commit8d18898bd059e968425e9275090d8f48320191f7 (patch)
tree225aa6d49a38547a98d69bf137c6276bd9721a52
parent12cf19bfa9bd65e32253a9f904a256d20364bc90 (diff)
downloadgenenetwork2-8d18898bd059e968425e9275090d8f48320191f7.tar.gz
Compute dataset type from name.
-rw-r--r--wqflask/base/data_set/__init__.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/wqflask/base/data_set/__init__.py b/wqflask/base/data_set/__init__.py
index 7f0673de..e49c6a93 100644
--- a/wqflask/base/data_set/__init__.py
+++ b/wqflask/base/data_set/__init__.py
@@ -30,15 +30,19 @@ DS_NAME_MAP = {
"ProbeSet": "MrnaAssayDataSet"
}
+def __dataset_type__(dataset_name):
+ """Get dataset type."""
+ if "Temp" in dataset_name:
+ return "Temp"
+ if "Geno" in dataset_name:
+ return "Geno"
+ if "Publish" in dataset_name:
+ return "Publish"
+ return "ProbeSet"
+
def create_dataset(dataset_name, dataset_type=None,
get_samplelist=True, group_name=None, redis_conn=Redis()):
- if dataset_name == "Temp":
- dataset_type = "Temp"
-
- if not dataset_type:
- with database_connection() as db_conn, db_conn.cursor() as cursor:
- dataset_type = DatasetType(redis_conn)(
- dataset_name, redis_conn, cursor)
+ dataset_type = dataset_type or __dataset_type__(dataset_name)
dataset_ob = DS_NAME_MAP[dataset_type]
dataset_class = globals()[dataset_ob]