diff options
author | Pjotr Prins | 2016-06-23 10:27:18 +0000 |
---|---|---|
committer | Pjotr Prins | 2016-06-23 10:27:18 +0000 |
commit | 8044e04c171d972fa64c510320c781360b823c07 (patch) | |
tree | 74c92a0c62e04366a40707a54ee7d6ef11e1969a /wqflask/base | |
parent | 0a6c114a20d2b02476949511773ad32e591d7d80 (diff) | |
download | genenetwork2-8044e04c171d972fa64c510320c781360b823c07.tar.gz |
Removed dependency on dataset_menu_structure.json
Diffstat (limited to 'wqflask/base')
-rw-r--r-- | wqflask/base/data_set.py | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 02018dd3..321dbf3f 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -50,7 +50,9 @@ from maintenance import get_group_samplelists from MySQLdb import escape_string as escape from pprint import pformat as pf +from db.gn_server import menu_main +from utility.tools import USE_GN_SERVER from utility.logger import getLogger logger = getLogger(__name__ ) @@ -61,8 +63,7 @@ DS_NAME_MAP = {} def create_dataset(dataset_name, dataset_type = None, get_samplelist = True): if not dataset_type: dataset_type = Dataset_Getter(dataset_name) - - logger.debug("dataset_type is:", dataset_type) + logger.debug("dataset_type", dataset_type) dataset_ob = DS_NAME_MAP[dataset_type] dataset_class = globals()[dataset_ob] @@ -71,12 +72,28 @@ def create_dataset(dataset_name, dataset_type = None, get_samplelist = True): class Dataset_Types(object): def __init__(self): + """Create a dictionary of samples where the value is set to Geno, +Publish or ProbeSet. E.g. + + {'AD-cases-controls-MyersGeno': 'Geno', + 'AD-cases-controls-MyersPublish': 'Publish', + 'AKXDGeno': 'Geno', + 'AXBXAGeno': 'Geno', + 'AXBXAPublish': 'Publish', + 'Aging-Brain-UCIPublish': 'Publish', + 'All Phenotypes': 'Publish', + 'B139_K_1206_M': 'ProbeSet', + 'B139_K_1206_R': 'ProbeSet' ... + + """ self.datasets = {} - file_name = "wqflask/static/new/javascript/dataset_menu_structure.json" - with open(file_name, 'r') as fh: - data = json.load(fh) + if USE_GN_SERVER: + data = menu_main() + else: + file_name = "wqflask/static/new/javascript/dataset_menu_structure.json" + with open(file_name, 'r') as fh: + data = json.load(fh) - logger.debug("*" * 70) for species in data['datasets']: for group in data['datasets'][species]: for dataset_type in data['datasets'][species][group]: @@ -88,7 +105,8 @@ class Dataset_Types(object): new_type = "Geno" else: new_type = "ProbeSet" - self.datasets[short_dataset_name] = new_type + self.datasets[short_dataset_name] = new_type + logger.info("datasets",self.datasets) def __call__(self, name): return self.datasets[name] |