Added OBIView_line_selection class to make new line selections
associated with the view to clone, and improved and renamed method closing a view
This commit is contained in:
@ -108,18 +108,15 @@ def run(config):
|
||||
# Call cython alignment function
|
||||
iview.align(oview)
|
||||
|
||||
print(oview.__repr__())
|
||||
repr(oview)
|
||||
|
||||
iview.save_and_close()
|
||||
oview.save_and_close()
|
||||
iview.close()
|
||||
oview.close()
|
||||
d.close()
|
||||
|
||||
print("Done.")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@ def run(config):
|
||||
print(toprint)
|
||||
i+=1
|
||||
|
||||
iview.save_and_close()
|
||||
iview.close()
|
||||
d.close()
|
||||
|
||||
print("Done.")
|
||||
|
@ -75,10 +75,10 @@ def run(config):
|
||||
# Create output view with the line selection
|
||||
oview = d.new_view(config['obi']['outputview'], view_to_clone=iview, line_selection=selection, comments="obi grep: "+config['grep']['predicate']+"\n")
|
||||
|
||||
print(oview.__repr__())
|
||||
repr(oview)
|
||||
|
||||
iview.save_and_close()
|
||||
oview.save_and_close()
|
||||
iview.close()
|
||||
oview.close()
|
||||
d.close()
|
||||
|
||||
print("Done.")
|
||||
|
@ -4,9 +4,9 @@ from obitools3.parsers.fasta import fastaIterator
|
||||
from obitools3.parsers.fastq import fastqIterator
|
||||
from obitools3.obidms._obidms import OBIDMS
|
||||
|
||||
|
||||
import time
|
||||
|
||||
|
||||
__title__="Counts sequences in a sequence set"
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ def addOptions(parser):
|
||||
|
||||
# TODO: Handling of NA values
|
||||
def run(config):
|
||||
#pb = ProgressBar(35000000, config, seconde=5)
|
||||
pb = ProgressBar(35000000, config, seconde=5)
|
||||
|
||||
inputs = uopen(config['import']['filename'])
|
||||
|
||||
@ -113,7 +113,7 @@ def run(config):
|
||||
|
||||
i = 0
|
||||
for seq in iseq:
|
||||
#pb(i)
|
||||
pb(i)
|
||||
view[i].set_id(seq['id'])
|
||||
view[i].set_definition(seq['definition'])
|
||||
view[i].set_sequence(seq['sequence'])
|
||||
@ -125,7 +125,7 @@ def run(config):
|
||||
|
||||
print(view.__repr__())
|
||||
|
||||
view.save_and_close()
|
||||
view.close()
|
||||
d.close()
|
||||
|
||||
print("Done.")
|
||||
|
@ -1,5 +1,6 @@
|
||||
from obitools3.apps.progress cimport ProgressBar # TODO I absolutely don't understand why it doesn't work without that line
|
||||
from obitools3.obidms._obidms import OBIDMS # TODO cimport doesn't work
|
||||
from obitools3.obidms._obidms import OBIView_line_selection
|
||||
from obitools3.utils cimport str2bytes
|
||||
|
||||
import shutil
|
||||
@ -120,7 +121,7 @@ def test_add_col(config, infos):
|
||||
# else :
|
||||
# alias = ''
|
||||
# infos['view'].add_column(random_column_refs['name'], version_number=random_column_refs['version'], alias=alias, create=False)
|
||||
# random_view.save_and_close()
|
||||
# random_view.close()
|
||||
#else :
|
||||
create_random_column(config, infos)
|
||||
print_test(config, ">>> Add column test OK")
|
||||
@ -215,7 +216,7 @@ def random_new_view(config, infos, first=False):
|
||||
quality_col = False # TODO
|
||||
if not first:
|
||||
infos['view_names'].append(infos['view'].name)
|
||||
infos['view'].save_and_close()
|
||||
infos['view'].close()
|
||||
v_to_clone = infos['dms'].open_view(random.choice(infos["view_names"]))
|
||||
v_type = None
|
||||
print_test(config, "View to clone: ")
|
||||
@ -223,7 +224,7 @@ def random_new_view(config, infos, first=False):
|
||||
create_line_selection = random_bool(config)
|
||||
if create_line_selection and v_to_clone.line_count > 0:
|
||||
print_test(config, "New view with new line selection.")
|
||||
line_selection = []
|
||||
line_selection = OBIView_line_selection(v_to_clone)
|
||||
for i in range(random.randint(1, v_to_clone.line_count)) :
|
||||
line_selection.append(random.randint(0, v_to_clone.line_count-1))
|
||||
#print_test(config, "New line selection: "+str(line_selection))
|
||||
@ -241,7 +242,7 @@ def random_new_view(config, infos, first=False):
|
||||
assert v_to_clone.line_count == infos['view'].line_count, "New view and cloned view don't have the same line count"
|
||||
else :
|
||||
assert len(line_selection) == infos['view'].line_count, "New view with new line selection does not have the right line count"
|
||||
v_to_clone.save_and_close()
|
||||
v_to_clone.close()
|
||||
if first :
|
||||
fill_view(config, infos)
|
||||
|
||||
@ -370,7 +371,7 @@ def run(config):
|
||||
|
||||
#print(infos)
|
||||
|
||||
infos['view'].save_and_close()
|
||||
infos['view'].close()
|
||||
infos['dms'].close()
|
||||
shutil.rmtree(config['obi']['defaultdms']+'.obidms', ignore_errors=True)
|
||||
|
||||
|
Reference in New Issue
Block a user