aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Sloan2013-04-26 16:21:38 +0000
committerZachary Sloan2013-04-26 16:21:38 +0000
commit275f9210a7af6a2de32e8e102de816276b5ef237 (patch)
tree4759751809c259a6c41581025f9f7e1afa937803
parent00f20d2d650c44794a8d21aad45d748e9aa0365b (diff)
downloadgenenetwork2-275f9210a7af6a2de32e8e102de816276b5ef237.tar.gz
Added file that checks how much time is added to a loop's runtime by print statements
Continued work on file that processes each individual chunk of the snp iterator/plink input
-rw-r--r--wqflask/maintenance/print_benchmark.py43
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/process_plink.py6
2 files changed, 48 insertions, 1 deletions
diff --git a/wqflask/maintenance/print_benchmark.py b/wqflask/maintenance/print_benchmark.py
new file mode 100644
index 00000000..540e0904
--- /dev/null
+++ b/wqflask/maintenance/print_benchmark.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+
+from __future__ import absolute_import, print_function, division
+
+import time
+
+from pprint import pformat as pf
+
+
+class TheCounter(object):
+ Counters = {}
+
+ def __init__(self):
+ start_time = time.time()
+ for counter in range(170000):
+ self.print_it(counter)
+ self.time_took = time.time() - start_time
+ TheCounter.Counters[self.__class__.__name__] = self.time_took
+
+class PrintAll(TheCounter):
+ def print_it(self, counter):
+ print(counter)
+
+class PrintSome(TheCounter):
+ def print_it(self, counter):
+ if counter % 1000 == 0:
+ print(counter)
+
+class PrintNone(TheCounter):
+ def print_it(self, counter):
+ pass
+
+
+def new_main():
+ print("Running new_main")
+ tests = [PrintAll, PrintSome, PrintNone]
+ for test in tests:
+ test()
+
+ print(pf(TheCounter.Counters))
+
+if __name__ == '__main__':
+ new_main() \ No newline at end of file
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/process_plink.py b/wqflask/wqflask/my_pylmm/pyLMM/process_plink.py
index 5ce7adbc..8f7ad243 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/process_plink.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/process_plink.py
@@ -13,6 +13,9 @@ plink_pickled = Redis.lpop("plink_inputs")
plink_data = pickle.loads(plink_pickled)
+identifier = plink_data['identifier']
+print("identifier: ", identifier)
+
ps, ts = lmm.human_association(snp,
n,
@@ -21,4 +24,5 @@ ps, ts = lmm.human_association(snp,
pheno_vector,
covariate_matrix,
kinship_matrix,
- refit) \ No newline at end of file
+ refit)
+