diff options
-rw-r--r-- | wqflask/utility/tools.py | 8 | ||||
-rw-r--r-- | wqflask/wqflask/show_trait/show_trait.py | 14 |
2 files changed, 14 insertions, 8 deletions
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 907b0d6a..22779739 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -93,6 +93,10 @@ def gemma_command(guess=None): def plink_command(guess=None): return valid_bin(get_setting("PLINK_COMMAND",guess)) +def flat_file_exists(subdir): + base = get_setting("GENENETWORK_FILES") + return valid_path(base+"/"+subdir) + def flat_files(subdir=None): base = get_setting("GENENETWORK_FILES") if subdir: @@ -104,6 +108,7 @@ def assert_dir(dir): raise Exception("ERROR: can not find directory "+dir) return dir + def mk_dir(dir): if not valid_path(dir): os.makedirs(dir) @@ -187,7 +192,8 @@ LOG_BENCH = get_setting_bool('LOG_BENCH') LOG_FORMAT = "%(message)s" # not yet in use USE_REDIS = get_setting_bool('USE_REDIS') USE_GN_SERVER = get_setting_bool('USE_GN_SERVER') -GENENETWORK_FILES = get_setting_bool('GENENETWORK_FILES') + +GENENETWORK_FILES = get_setting('GENENETWORK_FILES') PYLMM_COMMAND = pylmm_command() GEMMA_COMMAND = gemma_command() diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 2fd525a5..d9617c7c 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -23,7 +23,7 @@ from basicStatistics import BasicStatisticsFunctions from pprint import pformat as pf -from utility.tools import flat_files +from utility.tools import flat_files, flat_file_exists from utility.logger import getLogger logger = getLogger(__name__ ) @@ -162,12 +162,12 @@ class ShowTrait(object): def get_mapping_methods(self): '''Only display mapping methods when the dataset group's genotype file exists''' def check_plink_gemma(): - MAPPING_PATH = flat_files("mapping") - if (os.path.isfile(MAPPING_PATH+"/"+self.dataset.group.name+".bed") and - os.path.isfile(MAPPING_PATH+"/"+self.dataset.group.name+".map")): - return True - else: - return False + if flat_file_exists("mapping"): + MAPPING_PATH = flat_files("mapping")+"/" + if (os.path.isfile(MAPPING_PATH+self.dataset.group.name+".bed") and + os.path.isfile(MAPPING_PATH+self.dataset.group.name+".map")): + return True + return False def check_pylmm_rqtl(): if os.path.isfile(webqtlConfig.GENODIR+self.dataset.group.name+".geno") and (os.path.getsize(webqtlConfig.JSON_GENODIR+self.dataset.group.name+".json") > 0): |