From fabbcac393627badf0542377fc22325ae7e96f3d Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Fri, 3 Apr 2015 11:15:29 +0200 Subject: Passing in an iterator --- wqflask/wqflask/my_pylmm/pyLMM/lmm.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'wqflask') 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) # -- cgit v1.2.3