Mercurial > repos > artbio > mircounts
diff format_fasta_hairpins.py @ 13:b045c30fb768 draft
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit af48e9f6df2717ffd3731a974be1ec36e4eff779"
author | artbio |
---|---|
date | Fri, 18 Oct 2019 19:18:50 -0400 |
parents | de227b7307cf |
children |
line wrap: on
line diff
--- a/format_fasta_hairpins.py Sat May 12 09:06:24 2018 -0400 +++ b/format_fasta_hairpins.py Fri Oct 18 19:18:50 2019 -0400 @@ -43,10 +43,13 @@ def convert_and_print_hairpins(gzipfile, basename, fasta_output): raw_fasta_dict = get_fasta_dic(gzipfile) parsed_fasta_dict = {} - trs = str.maketrans("uU", "tT") for head in raw_fasta_dict: if basename in head: - parsed_fasta_dict[head] = raw_fasta_dict[head].translate(trs) + parsed_fasta_dict[head] = raw_fasta_dict[head] + parsed_fasta_dict[head] = ''.join( + [i if i != 'u' else 't' for i in parsed_fasta_dict[head]]) + parsed_fasta_dict[head] = ''.join( + [i if i != 'U' else 'T' for i in parsed_fasta_dict[head]]) with open(fasta_output, "w") as output: for head in sorted(parsed_fasta_dict): output.write('>%s\n%s\n' % (head, parsed_fasta_dict[head]))