Mercurial > repos > greg > fasta_extract
changeset 12:da6ab598f025 draft
Uploaded
author | greg |
---|---|
date | Sun, 10 Jan 2016 14:53:59 -0500 |
parents | 48f6e9f1c19d |
children | a5d7ed2680c3 |
files | fasta_extract.py |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/fasta_extract.py Sun Jan 10 14:42:37 2016 -0500 +++ b/fasta_extract.py Sun Jan 10 14:53:59 2016 -0500 @@ -24,7 +24,7 @@ else: format = 'fasta' output_dir = 'output_dir' - return os.path.join(output_dir, '%s_on_data_%d.%s' % (attrs, hid, format)) + return os.path.join(output_dir, '%s_on_data_%s.%s' % (attrs, hid, format)) def stop_err(msg): @@ -43,16 +43,18 @@ fasta = Fasta(args.genome_file) +dh = open('debug.log', 'wb') 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') fasta_output_path = get_output_path(hid, args.subtract_from_start, args.add_to_end, extend_existing, consider_strand) + dh.write('\n fasta_output_path: %s\n' % str(fasta_output_path)) output = open(fasta_output_path, 'wb') gff_output_path = get_output_path(hid, args.subtract_from_start, @@ -60,8 +62,11 @@ extend_existing, consider_strand, orphan=True) + dh.write('\n gff_output_path: %s\n' % str(gff_output_path)) orphan_writer = csv.writer(open(gff_output_path, 'wb'), delimiter='\t') + for row in reader: + dh.write('\n row: %s\n' % str(row)) if len(row) != 9 or row[0].startswith('#'): continue try: @@ -81,6 +86,7 @@ bases = fasta[cname][start-1:end] if consider_strand and strand == '-': bases = reverse_complement(bases) + dh.write('\n bases: %s\n' % str(bases)) output.write('%s\n' % bases) else: orphan_writer.writerow(row) @@ -88,3 +94,4 @@ stop_err(str(e)) finally: output.close() + dh.close()