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

This commit is contained in:
Celine Mercier
2019-02-12 16:46:08 +01:00
parent 3015310535
commit 4ddd1a1c37

13
python/obitools3/parsers/embl.pyx Normal file → Executable file
View File

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