From d2c73e31adb9795660ba5af5c229871c2367628a Mon Sep 17 00:00:00 2001 From: Lothar Braun Date: Mon, 21 Nov 2011 17:02:42 +0100 Subject: [PATCH] Progress bars for distance matrix and tree building --- PI/distance.py | 6 ++++++ PI/phylogeny.py | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/PI/distance.py b/PI/distance.py index 600a630..d7aa2bd 100644 --- a/PI/distance.py +++ b/PI/distance.py @@ -16,6 +16,7 @@ # import align, zlib +import util from numpy import * __all__ = [ "Distance", "Entropic", "PairwiseIdentity", "LocalAlignment" ] @@ -191,9 +192,14 @@ def _go(self): # # Compute similarity matrix of SW scores # + progress = 0 for i in range(self.N): for j in range(self.N): + if progress % (self.N * self.N / 100) == 0: + util.progress(100, float(progress) / (self.N * self.N) * 100) + progress += 1 + if similar[i][j] >= 0: continue diff --git a/PI/phylogeny.py b/PI/phylogeny.py index 6847a79..56b9454 100644 --- a/PI/phylogeny.py +++ b/PI/phylogeny.py @@ -19,6 +19,9 @@ from tree import * from pydot import * + +import util + class Phylogeny: """Implementation of base phylogenetic class""" @@ -76,6 +79,14 @@ def _go(self): for i in range(n): min = 10000 + if n > 100: + if i % (n / 100) == 0: + util.progress(100, float(i) / n * 100) + elif n > 10: + if i % (n / 10) == 0: + util.progress(100, float(i) / n * 100) + + for A in Cu: for B in Cu: if A == B: @@ -108,6 +119,7 @@ def _go(self): Cu.remove(C.getRight()) Cu.add(C) + util.progress(100, 100) self.tree = Cu.pop() self._cluster(self.tree)