diff validate_fasta.py @ 8:ca90d17ff51b draft

"planemo upload for repository https://github.com/usegalaxy-au/tools-au commit 03537aada92b5fff565ff48dd47c81462c5df47e"
author galaxy-australia
date Fri, 19 Aug 2022 00:29:16 +0000
parents eb085b3dbaf8
children 3bd420ec162d
line wrap: on
line diff
--- a/validate_fasta.py	Tue Apr 19 00:39:29 2022 +0000
+++ b/validate_fasta.py	Fri Aug 19 00:29:16 2022 +0000
@@ -3,7 +3,7 @@
 import re
 import sys
 import argparse
-from typing import List, TextIO
+from typing import List
 
 
 class Fasta:
@@ -98,10 +98,10 @@
     def validate_num_seqs(self) -> None:
         """Assert that only one sequence has been provided."""
         if len(self.fasta_list) > 1:
-            raise ValueError(
-                'Error encountered validating FASTA:\n'
-                f' More than 1 sequence detected ({len(self.fasta_list)}).'
-                ' Please use single FASTA sequence as input.')
+            sys.stderr.write(
+                'WARNING: More than 1 sequence detected.'
+                ' Using first FASTA sequence as input.\n')
+            self.fasta_list = self.fasta_list[:1]
         elif len(self.fasta_list) == 0:
             raise ValueError(
                 'Error encountered validating FASTA:\n'
@@ -159,7 +159,7 @@
         formatted_seq = ''
         for i in range(0, len(aa_seq), self.line_wrap):
             formatted_seq += aa_seq[i: i + self.line_wrap] + '\n'
-        return formatted_seq
+        return formatted_seq.upper()
 
 
 def main():