Repository 'gafa'
hg clone https://toolshed.g2.bx.psu.edu/repos/earlhaminst/gafa

Changeset 3:e17a3470c70a (2017-03-03)
Previous changeset 2:0c2f9172334a (2017-02-20) Next changeset 4:117fc7414307 (2017-03-15)
Commit message:
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/GAFA/ commit 988b1fc1cb8739e45648465adbf099f3fdaf87f8
modified:
GAFA.py
b
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'[^-]')