# HG changeset patch # User artbio # Date 1621597705 0 # Node ID d04b7de957821883f7e374fa3296ff1354ce8fde # Parent 19a1ce11945e7928defccde6e0a419ab235a303d "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/cherry_pick_fasta commit 3e1f8bb17e712d70e64ebb541775e9555acc038f" diff -r 19a1ce11945e -r d04b7de95782 cherry_pick_fasta.py --- a/cherry_pick_fasta.py Fri May 21 09:33:44 2021 +0000 +++ b/cherry_pick_fasta.py Fri May 21 11:48:25 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 19a1ce11945e -r d04b7de95782 cherry_pick_fasta.xml --- a/cherry_pick_fasta.xml Fri May 21 09:33:44 2021 +0000 +++ b/cherry_pick_fasta.xml Fri May 21 11:48:25 2021 +0000 @@ -1,4 +1,4 @@ - + with header satisfying a string query biopython