aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorPjotr Prins2015-04-03 11:15:29 +0200
committerPjotr Prins2015-04-03 11:15:29 +0200
commitfabbcac393627badf0542377fc22325ae7e96f3d (patch)
tree9e04884952b9e4a66675c0c851f0c93268e4f8c8 /wqflask
parent146b4a45c28b7d3ba4bf982cfaf93eda2e71d1ea (diff)
downloadgenenetwork2-fabbcac393627badf0542377fc22325ae7e96f3d.tar.gz
Passing in an iterator
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/lmm.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
index 6e22e6c9..b8650938 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
@@ -891,15 +891,21 @@ def gn2_load_redis(key,species,kinship,pheno,geno,new_code=True):
def gn2_iter_redis(key,species,kinship,pheno,geno_iterator):
"""
This function emulates GN2 behaviour by pre-loading Redis with
- a SNP iterator
+ a SNP iterator, for this it sets a key for every genotype (SNP)
"""
print("Loading Redis using a SNP iterator")
+ for i,genotypes in enumerate(geno_iterator):
+ gkey = key+'_geno_'+str(i)
+ Redis.set(gkey, genotypes)
+ Redis.expire(gkey, 60*60)
+
if kinship == None:
k = None
else:
k = kinship.tolist()
params = dict(pheno_vector = pheno.tolist(),
- genotype_matrix = geno_iterator.tolist(),
+ genotype_matrix = "iterator",
+ genotypes = i,
kinship_matrix = k,
restricted_max_likelihood = True,
refit = False,
@@ -913,7 +919,7 @@ def gn2_iter_redis(key,species,kinship,pheno,geno_iterator):
Redis.set(key, json_params)
Redis.expire(key, 60*60)
- return gwas_using_redis(key,species,new_code)
+ return gwas_using_redis(key,species)
# This is the main function used by Genenetwork2 (with environment)
#