# HG changeset patch # User artbio # Date 1621597739 0 # Node ID ba6c4aeb22ea1a8f45ae97792a693695b7d07523 # Parent c282a8a47dd9d0ba0d0b325a45e60063b9161970 "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/cherry_pick_fasta commit 3e1f8bb17e712d70e64ebb541775e9555acc038f" diff -r c282a8a47dd9 -r ba6c4aeb22ea cherry_pick_fasta.py --- a/cherry_pick_fasta.py Fri May 21 09:34:14 2021 +0000 +++ b/cherry_pick_fasta.py Fri May 21 11:48:59 2021 +0000 @@ -77,9 +77,13 @@ with open(file, 'w') as f: for header in sorted(fasta_dict): f.write('>%s\n' % header) - for i in range(line_length, len(fasta_dict[header]), line_length): - f.write('%s\n' % fasta_dict[header][i-line_length:i]) - f.write('%s\n' % fasta_dict[header][i:]) + if len(fasta_dict[header]) <= line_length: + f.write('%s\n' % fasta_dict[header]) + else: + for i in range(line_length, len(fasta_dict[header]), + line_length): + f.write('%s\n' % fasta_dict[header][i-line_length:i]) + f.write('%s\n' % fasta_dict[header][i:]) def __main__(): diff -r c282a8a47dd9 -r ba6c4aeb22ea cherry_pick_fasta.xml --- a/cherry_pick_fasta.xml Fri May 21 09:34:14 2021 +0000 +++ b/cherry_pick_fasta.xml Fri May 21 11:48:59 2021 +0000 @@ -1,4 +1,4 @@ - + with header satisfying a string query biopython