changeset 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 144b856e926c
files cherry_pick_fasta.py cherry_pick_fasta.xml
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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__():
--- 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 @@
-<tool id="cherry_pick_fasta" name="Pick Fasta sequences" version="3.0.0">
+<tool id="cherry_pick_fasta" name="Pick Fasta sequences" version="3.0.1">
   <description>with header satisfying a string query</description>
   <requirements>
         <requirement type="package" version="1.70">biopython</requirement>