# HG changeset patch # User earlhaminst # Date 1488543623 18000 # Node ID e17a3470c70a201c544a197f959edb14007eada9 # Parent 0c2f9172334ab4fa961c4210db00013720c86087 planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/GAFA/ commit 988b1fc1cb8739e45648465adbf099f3fdaf87f8 diff -r 0c2f9172334a -r e17a3470c70a GAFA.py --- a/GAFA.py Mon Feb 20 12:19:21 2017 -0500 +++ b/GAFA.py Fri Mar 03 07:20:23 2017 -0500 @@ -12,20 +12,20 @@ def FASTAReader_gen(fasta_filename): - fasta_file = open(fasta_filename) - line = fasta_file.readline() - while True: - if not line: - return - assert line.startswith('>'), "FASTA headers must start with >" - header = line.rstrip() - sequence_parts = [] + with open(fasta_filename) as fasta_file: line = fasta_file.readline() - while line and line[0] != '>': - sequence_parts.append(line.rstrip()) + while True: + if not line: + return + assert line.startswith('>'), "FASTA headers must start with >" + header = line.rstrip() + sequence_parts = [] line = fasta_file.readline() - sequence = "".join(sequence_parts) - yield Sequence(header, sequence) + while line and line[0] != '>': + sequence_parts.append(line.rstrip()) + line = fasta_file.readline() + sequence = "".join(sequence_parts) + yield Sequence(header, sequence) FASTA_MATCH_RE = re.compile(r'[^-]')