Skip to content

Instantly share code, notes, and snippets.

@lexnederbragt
Created May 9, 2014 14:25
Show Gist options
  • Save lexnederbragt/3689ee2301493c34c8ab to your computer and use it in GitHub Desktop.
Save lexnederbragt/3689ee2301493c34c8ab to your computer and use it in GitHub Desktop.
Convert the latest TRF output, using the '-ngs' flag, to gff. Very rudimentary, use at your own risk.
with open(fname) as fh:
for line in fh:
ele = line.strip().split(" ")
if line.startswith('@'):
seq_name = ele[0][1:]
else:
[start, stop, period, copies,
consensus_size, perc_match, perc_indels,
align_score, perc_A, perc_C, perc_G, perc_T,
entropy, cons_seq, repeat_seq, left_flank, right_flank] = ele
gff_line = [seq_name, 'TRF', cons_seq + '_' + copies + '_copies',
start, stop, '.', '.', '.', 'Name='+ cons_seq + '_' + copies + '_copies']
print '\t'.join(gff_line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment