Cython API: compiling but not working
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
from obitools3.apps.progress cimport ProgressBar # @UnresolvedImport
|
||||
from obitools3.obidms._obidms import OBIDMS, OBIView, OBIView_line_selection # TODO cimport doesn't work
|
||||
from obitools3.dms.dms import OBIDMS # TODO cimport doesn't work
|
||||
#, OBIView, OBIView_line_selection # TODO cimport doesn't work
|
||||
|
||||
from functools import reduce
|
||||
import time
|
||||
@ -56,34 +57,34 @@ def run(config):
|
||||
d = OBIDMS(config['obi']['defaultdms'])
|
||||
|
||||
# Open input view 1
|
||||
iview = d.open_view(config['obi']['inputview'])
|
||||
|
||||
# Initialize the progress bar
|
||||
pb = ProgressBar(len(iview), config, seconde=5)
|
||||
|
||||
# Apply filter
|
||||
selection = OBIView_line_selection(iview)
|
||||
for i in range(len(iview)) :
|
||||
pb(i)
|
||||
line = iview[i]
|
||||
|
||||
loc_env = {'sequence': line, 'line': line} # TODO add taxonomy
|
||||
|
||||
good = (reduce(lambda bint x, bint y: x and y,
|
||||
(bool(eval(p, loc_env, line))
|
||||
for p in config['grep']['predicates']), True))
|
||||
|
||||
if good :
|
||||
selection.append(i)
|
||||
|
||||
# Create output view with the line selection
|
||||
oview = d.clone_view_with_line_selection(config['obi']['outputview'], selection, comments="obi grep: "+str(config['grep']['predicates'])+"\n")
|
||||
|
||||
#print("\n")
|
||||
#print(repr(oview))
|
||||
|
||||
iview.close()
|
||||
oview.close()
|
||||
# iview = d.open_view(config['obi']['inputview'])
|
||||
#
|
||||
# # Initialize the progress bar
|
||||
# pb = ProgressBar(len(iview), config, seconde=5)
|
||||
#
|
||||
# # Apply filter
|
||||
# selection = OBIView_line_selection(iview)
|
||||
# for i in range(len(iview)) :
|
||||
# pb(i)
|
||||
# line = iview[i]
|
||||
#
|
||||
# loc_env = {'sequence': line, 'line': line} # TODO add taxonomy
|
||||
#
|
||||
# good = (reduce(lambda bint x, bint y: x and y,
|
||||
# (bool(eval(p, loc_env, line))
|
||||
# for p in config['grep']['predicates']), True))
|
||||
#
|
||||
# if good :
|
||||
# selection.append(i)
|
||||
#
|
||||
# # Create output view with the line selection
|
||||
# oview = d.clone_view_with_line_selection(config['obi']['outputview'], selection, comments="obi grep: "+str(config['grep']['predicates'])+"\n")
|
||||
#
|
||||
# #print("\n")
|
||||
# #print(repr(oview))
|
||||
#
|
||||
# iview.close()
|
||||
# oview.close()
|
||||
d.close()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user