aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/base/data_set.py16
-rw-r--r--wqflask/utility/tools.py4
2 files changed, 11 insertions, 9 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 9ffc09ac..ce13dd77 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -44,7 +44,7 @@ from dbFunction import webqtlDatabaseFunction
from utility import webqtlUtil
from utility.benchmark import Bench
from utility import chunks
-from utility.tools import locate
+from utility.tools import locate, locate_without_error
from maintenance import get_group_samplelists
@@ -405,15 +405,15 @@ class DatasetGroup(object):
else:
print("Cache not hit")
- geno_file_path = locate(self.name+".geno",'genotype')
- mapping_file_path = locate(self.name+".fam",'mapping')
- if os.path.isfile(mapping_file_path):
- self.samplelist = get_group_samplelists.get_samplelist("plink", mapping_file_path)
- elif os.path.isfile(geno_file_path):
- self.samplelist = get_group_samplelists.get_samplelist("geno", geno_file_path)
+ genotype_fn = locate_without_error(self.name+".geno",'genotype')
+ mapping_fn = locate_without_error(self.name+".fam",'mapping')
+ if mapping_fn:
+ self.samplelist = get_group_samplelists.get_samplelist("plink", mapping_fn)
+ elif genotype_fn:
+ self.samplelist = get_group_samplelists.get_samplelist("geno", genotype_fn)
else:
self.samplelist = None
- #print("after get_samplelist")
+ print("Sample list: ",self.samplelist)
Redis.set(key, json.dumps(self.samplelist))
Redis.expire(key, 60*5)
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index dd40be99..d4c10c68 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -36,7 +36,7 @@ def get_setting(command_id,guess=None):
"""
def value(command):
if command:
- sys.stderr.write("Found value "+command+"\n")
+ sys.stderr.write("Found path "+command+"\n")
return command
else:
return None
@@ -95,6 +95,7 @@ def locate(name, subdir=None):
if valid_path(base):
lookfor = base + "/" + name
if valid_file(lookfor):
+ print("Found: file "+lookfor+"\n")
return lookfor
else:
raise IOError("Can not locate "+lookfor)
@@ -114,6 +115,7 @@ def locate_without_error(name, subdir=None):
if valid_path(base):
lookfor = base + "/" + name
if valid_file(lookfor):
+ print("Found: file "+name+"\n")
return lookfor
sys.stderr.write("WARNING: file "+name+" not found\n")
return None