aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/data_set.py
diff options
context:
space:
mode:
authorPjotr Prins2016-04-20 08:55:56 +0000
committerPjotr Prins2016-04-20 08:55:56 +0000
commita5ff6520ad29266e1647ce54ad6b2c0f200dfe9a (patch)
tree8827020795cc045cd787754fb7d8f7b94fbef4bf /wqflask/base/data_set.py
parent6c0f35e56e8d26a47d210b12c171bb050d1ab150 (diff)
downloadgenenetwork2-a5ff6520ad29266e1647ce54ad6b2c0f200dfe9a.tar.gz
[PATCH 032/100] file locating: error checking is built-in
Diffstat (limited to 'wqflask/base/data_set.py')
-rwxr-xr-xwqflask/base/data_set.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index c6f34143..9ffc09ac 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -44,15 +44,13 @@ from dbFunction import webqtlDatabaseFunction
from utility import webqtlUtil
from utility.benchmark import Bench
from utility import chunks
-from utility.tools import flat_files
+from utility.tools import locate
from maintenance import get_group_samplelists
from MySQLdb import escape_string as escape
from pprint import pformat as pf
-MAPPING_PATH = flat_files("mapping")
-
# Used by create_database to instantiate objects
# Each subclass will add to this
DS_NAME_MAP = {}
@@ -405,11 +403,10 @@ class DatasetGroup(object):
#print(" type: ", type(self.samplelist))
#print(" self.samplelist: ", self.samplelist)
else:
- #print("Cache not hit")
-
- geno_file_path = webqtlConfig.GENODIR+self.name+".geno"
+ print("Cache not hit")
- mapping_file_path = MAPPING_PATH+"/"+self.name+".fam"
+ 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):
@@ -439,10 +436,7 @@ class DatasetGroup(object):
genotype_1 = reaper.Dataset()
# reaper barfs on unicode filenames, so here we ensure it's a string
- full_filename = str(os.path.join(webqtlConfig.GENODIR, self.name + '.geno'))
- if not os.path.isfile(full_filename):
- raise SystemError("File "+full_filename+" does not exist")
- print("Reading file: ", full_filename)
+ full_filename = str(locate(self.name+'.geno','genotype'))
genotype_1.read(full_filename)
if genotype_1.type == "group" and self.parlist: