From 0b9a41d952db18c2ec25cad9e6d295ecc7684fb8 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Sat, 21 May 2016 10:28:03 +0200 Subject: [PATCH] Patch a bug about the reading of the last sequence --- python/obitools3/parsers/fasta.pyx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/python/obitools3/parsers/fasta.pyx b/python/obitools3/parsers/fasta.pyx index 2a262bc..44be6b9 100644 --- a/python/obitools3/parsers/fasta.pyx +++ b/python/obitools3/parsers/fasta.pyx @@ -28,9 +28,14 @@ def fastaIterator(lineiterator, int buffersize=100000000): ident,tags,definition = parseHeader(line) s = [] line = next(i) - while line[0]!='>': - s.append(line[0:-1]) - line = next(i) + + try: + while line[0]!='>': + s.append(line[0:-1]) + line = next(i) + except StopIteration: + pass + sequence = "".join(s) quality = None @@ -42,5 +47,6 @@ def fastaIterator(lineiterator, int buffersize=100000000): "annotation" : {} } + \ No newline at end of file