diff options
author | Pjotr Prins | 2015-03-18 12:17:59 +0300 |
---|---|---|
committer | Pjotr Prins | 2015-03-18 12:17:59 +0300 |
commit | 6b8321d77e915dc5aec0c272c1cb84c2af3e6191 (patch) | |
tree | 35a24a0432ff88892f9c6f712db4421309e9becc | |
parent | f1056b9f4128fb91fbaf738914395697aa485b2e (diff) | |
download | genenetwork2-6b8321d77e915dc5aec0c272c1cb84c2af3e6191.tar.gz |
Replace progress meter
-rw-r--r-- | wqflask/wqflask/my_pylmm/pyLMM/gn2.py | 7 | ||||
-rw-r--r-- | wqflask/wqflask/my_pylmm/pyLMM/lmm.py | 17 | ||||
-rw-r--r-- | wqflask/wqflask/my_pylmm/pyLMM/standalone.py | 2 |
3 files changed, 13 insertions, 13 deletions
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/gn2.py b/wqflask/wqflask/my_pylmm/pyLMM/gn2.py index c71b9f22..f8033ac5 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/gn2.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/gn2.py @@ -12,11 +12,16 @@ import logging # logging.basicConfig(level=logging.DEBUG) # np.set_printoptions() +def set_progress_storage(location): + global storage + storage = location + def progress(location, count, total): """ Progress update """ - logging.info("Progress: %s %d%%" % (location,round(count*100.0/total))) + storage.store("percent_complete",round(count*100.0)/total) + logger.info("Progress: %s %d%%" % (location,round(count*100.0/total))) def mprint(msg,data): """ diff --git a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py index 95272818..eab7d91d 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py @@ -65,6 +65,8 @@ except ImportError: sys.stderr.write("WARNING: LMM standalone version missing the Genenetwork2 environment\n") pass +progress,info = uses('progress','info') + #np.seterr('raise') #def run_human(pheno_vector, @@ -171,10 +173,7 @@ def run_human(pheno_vector, #if count > 1000: # break count += 1 - - percent_complete = (float(count) / total_snps) * 100 - #print("percent_complete: ", percent_complete) - tempdata.store("percent_complete", percent_complete) + progress("human",count,total_snps) #with Bench("actual association"): ps, ts = human_association(snp, @@ -431,10 +430,7 @@ def calculate_kinship_old(genotype_matrix, temp_data=None): continue keep.append(counter) genotype_matrix[:,counter] = (genotype_matrix[:,counter] - values_mean) / np.sqrt(vr) - - percent_complete = int(round((counter/m)*45)) - if temp_data != None: - temp_data.store("percent_complete", percent_complete) + progress('kinship_old',counter,m) genotype_matrix = genotype_matrix[:,keep] print("After kinship (old) genotype_matrix: ", pf(genotype_matrix)) @@ -539,9 +535,8 @@ def GWAS(pheno_vector, lmm_ob.fit(X=x) ts, ps, beta, betaVar = lmm_ob.association(x, REML=restricted_max_likelihood) - percent_complete = 45 + int(round((counter/m)*55)) - temp_data.store("percent_complete", percent_complete) - + progress("gwas_old",counter,m) + p_values.append(ps) t_statistics.append(ts) diff --git a/wqflask/wqflask/my_pylmm/pyLMM/standalone.py b/wqflask/wqflask/my_pylmm/pyLMM/standalone.py index e20d4092..b3d480c3 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/standalone.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/standalone.py @@ -22,7 +22,7 @@ def set_progress_storage(location): storage = location def progress(location, count, total): - storage['percentage'] = round(count*100.0)/total) + storage.store("percent_complete",round(count*100.0)/total) logger.info("Progress: %s %d%%" % (location,round(count*100.0/total))) def mprint(msg,data): |