Commit 6fa7d4cd by Eric Coissac

Add a progress bar during automata construction

parent 8af6c6a7
......@@ -13,6 +13,7 @@ from array import array
from orgasm.backtranslate._ahocorasick cimport *
from orgasm.utils.dna cimport isDNA
from orgasm.apps.progress cimport ProgressBar
#from time import time
from posix.time cimport timeval,gettimeofday
......@@ -378,6 +379,8 @@ cdef class Index:
cdef dict matches
cdef str k
cdef bint nuc
cdef ProgressBar progress
cdef int i
nuc = all([isDNA(sequences[k]) for k in sequences])
......@@ -392,8 +395,14 @@ cdef class Index:
patterns = ProtAhoCorasick()
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:
patterns.addSequence(sequences[k],k,kup)
i=i+1
progress(i)
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