embl iterator: only option on embl directories now works as intended
This commit is contained in:
13
python/obitools3/parsers/embl.pyx
Normal file → Executable file
13
python/obitools3/parsers/embl.pyx
Normal file → Executable 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,
|
||||
|
Reference in New Issue
Block a user