Skip to content

Commit

Permalink
Progress bars for distance matrix and tree building
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothar Braun committed Nov 21, 2011
1 parent b822dcf commit d2c73e3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions PI/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#

import align, zlib
import util
from numpy import *

__all__ = [ "Distance", "Entropic", "PairwiseIdentity", "LocalAlignment" ]
Expand Down Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions PI/phylogeny.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
from tree import *
from pydot import *


import util

class Phylogeny:

"""Implementation of base phylogenetic class"""
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d2c73e3

Please sign in to comment.