# HG changeset patch # User greg # Date 1452453950 18000 # Node ID 4f6eba6beef5d50deaa8ebf0eff30d43132b6458 # Parent d077d91065eae09e0893c5225e6eb31e10887159 Uploaded diff -r d077d91065ea -r 4f6eba6beef5 fasta_extract.py --- 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()