diff blast_unmatched.py @ 2:dfcdac284538 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/blast_unmatched commit 830e10a94c2afc178f4078609842cd93808df1b4
author artbio
date Thu, 05 Oct 2017 05:11:01 -0400
parents 50c1fa95a076
children fffdb903f2d1
line wrap: on
line diff
--- a/blast_unmatched.py	Tue Oct 03 12:41:53 2017 -0400
+++ b/blast_unmatched.py	Thu Oct 05 05:11:01 2017 -0400
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 
 import optparse
-
+import re
 
 def parse_options():
     """
@@ -36,10 +36,13 @@
     """
     output_file_handle = open(output_file, 'w')
     unmatched = False
+    end = re.compile(".+\W$")
     with open(fasta_file, 'r') as infile:
         for line in infile:
             if line.startswith('>'):
-                subline = line[1:100].rstrip() #qid are 100chars long in blast
+                subline = line[1:].rstrip() #qid are 100chars long in blast
+                while end.match(subline) != None:
+                    subline = subline[:-1]
                 if subline not in matched:
                     output_file_handle.write(line)
                     unmatched = True