Commit 6fa7d4cd by Eric Coissac

Add a progress bar during automata construction

parent 8af6c6a7
...@@ -13,6 +13,7 @@ from array import array ...@@ -13,6 +13,7 @@ from array import array
from orgasm.backtranslate._ahocorasick cimport * from orgasm.backtranslate._ahocorasick cimport *
from orgasm.utils.dna cimport isDNA from orgasm.utils.dna cimport isDNA
from orgasm.apps.progress cimport ProgressBar
#from time import time #from time import time
from posix.time cimport timeval,gettimeofday from posix.time cimport timeval,gettimeofday
...@@ -378,6 +379,8 @@ cdef class Index: ...@@ -378,6 +379,8 @@ cdef class Index:
cdef dict matches cdef dict matches
cdef str k cdef str k
cdef bint nuc cdef bint nuc
cdef ProgressBar progress
cdef int i
nuc = all([isDNA(sequences[k]) for k in sequences]) nuc = all([isDNA(sequences[k]) for k in sequences])
...@@ -392,8 +395,14 @@ cdef class Index: ...@@ -392,8 +395,14 @@ cdef class Index:
patterns = ProtAhoCorasick() patterns = ProtAhoCorasick()
kup = 4 if kup < 0 else kup kup = 4 if kup < 0 else kup
progress = ProgressBar(len(sequences),
head="Building Aho-Corasick automata",
seconde=0.1)
i=0
for k in sequences: for k in sequences:
patterns.addSequence(sequences[k],k,kup) patterns.addSequence(sequences[k],k,kup)
i=i+1
progress(i)
patterns.finalize() patterns.finalize()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment