changeset 7:4f6eba6beef5 draft

Uploaded
author greg
date Sun, 10 Jan 2016 14:25:50 -0500
parents d077d91065ea
children b740d423ce07
files fasta_extract.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/fasta_extract.py	Sun Jan 10 14:15:34 2016 -0500
+++ b/fasta_extract.py	Sun Jan 10 14:25:50 2016 -0500
@@ -20,11 +20,11 @@
     if orphan:
         attrs += '_orphan'
         format = 'gff'
+        output_dir = 'output_orphan_dir'
     else:
         format = 'fasta'
-    if orphan:
-        return os.path.join('output_orphan_dir', '%s_on_data_%d.%s' % (attrs, hid, format))
-    return os.path.join('output_dir', '%s_on_data_%d.%s' % (attrs, hid, format))
+        output_dir = 'output_dir'
+    return os.path.join(output_dir, '%s_on_data_%d.%s' % (attrs, hid, format))
 
 
 def stop_err(msg):
@@ -44,7 +44,6 @@
 fasta = Fasta(args.genome_file)
 
 for (input_filename, hid) in args.inputs:
-    hid = int(hid)
     extend_existing = args.extend_existing == 'existing'
     consider_strand = args.strand == 'yes'
     reader = csv.reader(open(input_filename, 'rU'), delimiter='\t')
@@ -86,3 +85,5 @@
                 orphan_writer.writerow(row)
         except Exception, e:
             stop_err(str(e))
+        finally:
+            output.clode()