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 | |
parent | 0a6c114a20d2b02476949511773ad32e591d7d80 (diff) | |
download | genenetwork2-8044e04c171d972fa64c510320c781360b823c07.tar.gz |
Removed dependency on dataset_menu_structure.json
-rw-r--r-- | wqflask/base/data_set.py | 32 | ||||
-rw-r--r-- | wqflask/wqflask/search_results.py | 10 |
2 files changed, 28 insertions, 14 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] diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index c1b8683e..b1e7b8db 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -1,8 +1,5 @@ -from __future__ import absolute_import, print_function, division +# from __future__ import absolute_import, print_function, division -from wqflask import app - -from flask import render_template import os import cPickle @@ -18,9 +15,6 @@ from pprint import pformat as pf import json -# from flask import Flask, g - -# from utility.benchmark import Bench from base.data_set import create_dataset from base.trait import GeneralTrait from wqflask import parser @@ -28,6 +22,8 @@ from wqflask import do_search from utility import webqtlUtil,tools from db import webqtlDatabaseFunction +from flask import render_template + from utility import formatting from utility.logger import getLogger |