Mercurial > repos > artbio > cherry_pick_fasta
comparison cherry_pick_fasta.py @ 4:ba6c4aeb22ea draft
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/cherry_pick_fasta commit 3e1f8bb17e712d70e64ebb541775e9555acc038f"
author | artbio |
---|---|
date | Fri, 21 May 2021 11:48:59 +0000 |
parents | c282a8a47dd9 |
children | d8fa616a228a |
comparison
equal
deleted
inserted
replaced
3:c282a8a47dd9 | 4:ba6c4aeb22ea |
---|---|
75 def write_fasta_result(fasta_dict, file): | 75 def write_fasta_result(fasta_dict, file): |
76 line_length = 60 | 76 line_length = 60 |
77 with open(file, 'w') as f: | 77 with open(file, 'w') as f: |
78 for header in sorted(fasta_dict): | 78 for header in sorted(fasta_dict): |
79 f.write('>%s\n' % header) | 79 f.write('>%s\n' % header) |
80 for i in range(line_length, len(fasta_dict[header]), line_length): | 80 if len(fasta_dict[header]) <= line_length: |
81 f.write('%s\n' % fasta_dict[header][i-line_length:i]) | 81 f.write('%s\n' % fasta_dict[header]) |
82 f.write('%s\n' % fasta_dict[header][i:]) | 82 else: |
83 for i in range(line_length, len(fasta_dict[header]), | |
84 line_length): | |
85 f.write('%s\n' % fasta_dict[header][i-line_length:i]) | |
86 f.write('%s\n' % fasta_dict[header][i:]) | |
83 | 87 |
84 | 88 |
85 def __main__(): | 89 def __main__(): |
86 ''' main function ''' | 90 ''' main function ''' |
87 args = Parser() | 91 args = Parser() |