aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2015-02-20 14:25:15 +0300
committerPjotr Prins2015-02-20 14:25:15 +0300
commitd85ca24cfa021785504ad1d84b712880c8dfbcd1 (patch)
tree1f100274da25fb9ed9a979a5a5bc6b96f704ef36
parenta4721c98188cff260633bc54251e3273a7b5f3de (diff)
downloadgenenetwork2-d85ca24cfa021785504ad1d84b712880c8dfbcd1.tar.gz
Split out behaviour for calling lmm from GN2 or (testing) CLI
-rwxr-xr-xwqflask/wqflask/my_pylmm/pyLMM/lmm.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
index 369fcbcc..8de3b3a7 100755
--- a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
@@ -45,11 +45,16 @@ import sys
sys.path.append("/home/zas1024/gene/wqflask/")
print("sys.path2:", sys.path)
-from utility.benchmark import Bench
-from utility import temp_data
-
-from wqflask.my_pylmm.pyLMM import chunks
+has_gn2=True
+try:
+ from utility.benchmark import Bench
+ from utility import temp_data
+ from wqflask.my_pylmm.pyLMM import chunks
+except ImportError:
+ print("WARNING: Standalone version\n")
+ has_gn2=False
+ pass
#np.seterr('raise')
@@ -288,6 +293,7 @@ def run_other(pheno_vector,
def matrixMult(A,B):
# If there is no fblas then we will revert to np.dot()
+
try:
linalg.fblas
except AttributeError:
@@ -708,7 +714,7 @@ class LMM:
pl.ylabel("Probability of data")
pl.title(title)
-def main():
+def gn2_main():
parser = argparse.ArgumentParser(description='Run pyLMM')
parser.add_argument('-k', '--key')
parser.add_argument('-s', '--species')
@@ -750,7 +756,10 @@ def main():
Redis.expire(results_key, 60*60)
if __name__ == '__main__':
- main()
+ if has_gn2:
+ gn2_main()
+ else:
+ cli_main()