From 9395e9f3cc2d06e069c5de797b2d6e8e59cfba7c Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 24 Feb 2016 17:00:04 +0000 Subject: [PATCH 042/100] Sanitizing locations --- wqflask/utility/tools.py | 5 ++--- wqflask/wqflask/marker_regression/marker_regression.py | 13 ++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'wqflask') diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 51189fa3..b8eff12a 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -1,4 +1,3 @@ - # Tools/paths finder resolves external paths from settings and/or environment # variables @@ -105,9 +104,9 @@ def locate(name, subdir=None): print("Found: file "+lookfor+"\n") return lookfor else: - raise IOError("Can not locate "+lookfor) + raise Exception("Can not locate "+lookfor) if subdir: sys.stderr.write(subdir) - raise IOError("Can not locate "+name+" in "+base) + raise Exception("Can not locate "+name+" in "+base) def locate_ignore_error(name, subdir=None): """ diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 910d0c3c..e9cfb06d 100644 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -41,7 +41,8 @@ from wqflask.marker_regression import gemma_mapping #from wqflask.marker_regression import plink_mapping #from wqflask.marker_regression import rqtl_mapping -from utility.tools import locate, PYLMM_COMMAND, GEMMA_COMMAND, PLINK_COMMAND +from utility.tools import locate, locate_ignore_error, PYLMM_COMMAND, GEMMA_COMMAND, PLINK_COMMAND +from utility.external import shell class MarkerRegression(object): @@ -413,8 +414,8 @@ class MarkerRegression(object): write_cross = ro.r["write.cross"] # Map the write.cross function GENOtoCSVR = ro.r["GENOtoCSVR"] # Map the GENOtoCSVR function - genofilelocation = webqtlConfig.HTMLPATH + "genotypes/" + self.dataset.group.name + ".geno" - crossfilelocation = webqtlConfig.HTMLPATH + "genotypes/" + self.dataset.group.name + ".cross" + genofilelocation = locate(self.dataset.group.name + ".geno", "genotype") + crossfilelocation = locate(self.dataset.group.name + ".cross", "genotype") #print("Conversion of geno to cross at location:", genofilelocation, " to ", crossfilelocation) @@ -860,9 +861,7 @@ class MarkerRegression(object): Redis.expire(key, 60*60) command = PYLMM_COMMAND+' --key {} --species {}'.format(key,"other") - - os.system(command) - + shell(command) json_results = Redis.blpop("pylmm:results:" + temp_uuid, 45*60) results = json.loads(json_results[1]) @@ -941,7 +940,7 @@ class MarkerRegression(object): print("command is:", command) print("after printing command") - os.system(command) + shell(command) #t_stats, p_values = lmm.run(key) #lmm.run(key) -- cgit v1.2.3