about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins2016-03-03 11:21:01 +0000
committerPjotr Prins2016-04-20 10:00:15 +0000
commita66858e99c2195d90a187899db6f4dd8966a0a2c (patch)
treee2c28be74e333614c78ef748ac8fdd165953effd
parentc52bf79ba92d2a632637536a9ea607c22ef2d9bf (diff)
downloadgenenetwork2-a66858e99c2195d90a187899db6f4dd8966a0a2c.tar.gz
Show error when GENODIR is missing
-rwxr-xr-xbin/genenetwork213
-rw-r--r--etc/default_settings.py2
-rw-r--r--wqflask/utility/tools.py4
3 files changed, 10 insertions, 9 deletions
diff --git a/bin/genenetwork2 b/bin/genenetwork2
index a0a013fc..bbb2a19f 100755
--- a/bin/genenetwork2
+++ b/bin/genenetwork2
@@ -9,18 +9,19 @@
 SCRIPT=$(readlink -f "$0")
 # Absolute path this script is in, thus /home/user/bin
 GN2_BASE_PATH=$(dirname $(dirname "$SCRIPT"))
+
+GN2_GUIX_PATH=$GN2_BASE_PATH/lib/python2.7/site-packages/genenetwork2-2.0-py2.7.egg
+if [ -d $GN2_GUIX_PATH ]; then
+  GN2_BASE_PATH=$GN2_GUIX_PATH
+fi
 echo $GN2_BASE_PATH
 
 # Handle settings parameter
 settings=$1
 if [ -z $settings ]; then settings=$GN2_BASE_PATH/etc/default_settings.py ; fi
 if [ ! -e $settings ]; then
-    GN2_BASE_PATH=$GN2_BASE_PATH/lib/python2.7/site-packages/genenetwork2-2.0-py2.7.egg
-    settings=$GN2_BASE_PATH/etc/default_settings.py
-    if [ ! -e $settings ]; then
-        echo "ERROR: can not locate settings file - pass it in the command line"
-        exit 1
-    fi
+    echo "ERROR: can not locate settings file - pass it in the command line"
+    exit 1
 fi
 export WQFLASK_SETTINGS=$settings
 
diff --git a/etc/default_settings.py b/etc/default_settings.py
index 60a3a7b4..0cf40265 100644
--- a/etc/default_settings.py
+++ b/etc/default_settings.py
@@ -23,7 +23,7 @@ SERVER_PORT = 5003
 SECRET_HMAC_CODE = '\x08\xdf\xfa\x93N\x80\xd9\\H@\\\x9f`\x98d^\xb4a;\xc6OM\x946a\xbc\xfc\x80:*\xebc'
 
 # Path overrides for Genenetwork
-GENENETWORK_FILES = "../../gn2_data"
+GENENETWORK_FILES = os.environ['HOME']+"/gn2_data"
 PYLMM_COMMAND = str.strip(os.popen("which pylmm_redis").read())
 PLINK_COMMAND = str.strip(os.popen("which plink2").read())
 GEMMA_COMMAND = str.strip(os.popen("which gemma").read())
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index b8eff12a..9405a9c6 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -76,8 +76,8 @@ def plink_command(guess=None):
 def flat_files(subdir=None):
     base = get_setting("GENENETWORK_FILES")
     if subdir:
-        return valid_path(base+"/"+subdir)
-    return valid_path(base)
+        return assert_dir(base+"/"+subdir)
+    return assert_dir(base)
 
 def assert_dir(dir):
     if not valid_path(dir):