Commit 4ddd1a1c authored by Celine Mercier's avatar Celine Mercier

embl iterator: only option on embl directories now works as intended

parent 30153105
...@@ -120,7 +120,7 @@ def emblIterator_file(lineiterator, ...@@ -120,7 +120,7 @@ def emblIterator_file(lineiterator,
while True: while True:
if ionly >= 0 and read >= ionly: if ionly >= 0 and read >= ionly-1:
break break
while skipped < skip: while skipped < skip:
...@@ -160,7 +160,6 @@ def emblIterator_file(lineiterator, ...@@ -160,7 +160,6 @@ def emblIterator_file(lineiterator,
DONECOUNT+=1 DONECOUNT+=1
yield seq yield seq
read+=1 read+=1
yield seq yield seq
...@@ -175,10 +174,18 @@ def emblIterator_dir(dir_path, ...@@ -175,10 +174,18 @@ def emblIterator_dir(dir_path,
int buffersize=100000000 int buffersize=100000000
): ):
path = dir_path path = dir_path
read = 0
for filename in glob.glob(os.path.join(path, b'*.dat*')): for filename in glob.glob(os.path.join(path, b'*.dat*')):
if read==only:
return
f = uopen(filename) f = uopen(filename)
for seq in emblIterator_file(f, skip=skip, only=only, buffersize=buffersize): if only is not None:
only_f = only-read
else:
only_f = None
for seq in emblIterator_file(f, skip=skip, only=only_f, buffersize=buffersize):
yield seq yield seq
read+=1
def emblIterator(obj, def emblIterator(obj,
......
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