aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2015-04-03 10:58:53 +0200
committerPjotr Prins2015-04-03 10:58:53 +0200
commit146b4a45c28b7d3ba4bf982cfaf93eda2e71d1ea (patch)
treee20271e2c28ad2baec84752c8b7a22bec5d8e88d
parentb9c79ef58ff6ec4da3e65290ea802c783bb17742 (diff)
downloadgenenetwork2-146b4a45c28b7d3ba4bf982cfaf93eda2e71d1ea.tar.gz
Refactoring GN2 interface
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/lmm.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
index 07b55726..6e22e6c9 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
@@ -805,7 +805,7 @@ class LMM:
pl.title(title)
-def gn2_redis(key,species,new_code=True):
+def gwas_using_redis(key,species,new_code=True):
"""
Invoke pylmm using Redis as a container. new_code runs the new
version
@@ -861,18 +861,6 @@ def gn2_redis(key,species,new_code=True):
Redis.expire(results_key, 60*60)
return ps, ts
-# This is the main function used by Genenetwork2 (with environment)
-def gn2_main():
- parser = argparse.ArgumentParser(description='Run pyLMM')
- parser.add_argument('-k', '--key')
- parser.add_argument('-s', '--species')
-
- opts = parser.parse_args()
-
- key = opts.key
- species = opts.species
-
- gn2_redis(key,species)
def gn2_load_redis(key,species,kinship,pheno,geno,new_code=True):
"""
@@ -898,7 +886,7 @@ def gn2_load_redis(key,species,kinship,pheno,geno,new_code=True):
Redis.set(key, json_params)
Redis.expire(key, 60*60)
- return gn2_redis(key,species,new_code)
+ return gwas_using_redis(key,species,new_code)
def gn2_iter_redis(key,species,kinship,pheno,geno_iterator):
"""
@@ -925,7 +913,23 @@ def gn2_iter_redis(key,species,kinship,pheno,geno_iterator):
Redis.set(key, json_params)
Redis.expire(key, 60*60)
- return gn2_redis(key,species,new_code)
+ return gwas_using_redis(key,species,new_code)
+
+# This is the main function used by Genenetwork2 (with environment)
+#
+# Note that this calling route will become OBSOLETE (we should use runlmm.py
+# instead)
+def gn2_main():
+ parser = argparse.ArgumentParser(description='Run pyLMM')
+ parser.add_argument('-k', '--key')
+ parser.add_argument('-s', '--species')
+
+ opts = parser.parse_args()
+
+ key = opts.key
+ species = opts.species
+
+ gwas_using_redis(key,species)
if __name__ == '__main__':