diff filter.py @ 3:9b9ae5963d3c draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ngsutils commit 4a3c9f195ba5d899b1a1ce5e80281cdf230f456a
author iuc
date Mon, 23 Oct 2017 13:27:02 -0400
parents 7a68005de299
children 49bf71fbc574
line wrap: on
line diff
--- a/filter.py	Sun Nov 27 15:01:21 2016 -0500
+++ b/filter.py	Mon Oct 23 13:27:02 2017 -0400
@@ -107,6 +107,7 @@
     The tag type (:i, :f, :Z) is optional.
 
 """
+from __future__ import print_function
 
 import os
 import sys
@@ -118,8 +119,8 @@
 
 
 def usage():
-    print __doc__
-    print """
+    print(__doc__)
+    print("""
 Usage: bamutils filter in.bam out.bam {-failed out.txt} criteria...
 
 Options:
@@ -131,7 +132,7 @@
 
 This will remove all unmapped reads, as well as any reads that have an AS:i
 value less than 1000.
-"""
+""")
     sys.exit(1)
 
 
@@ -760,10 +761,10 @@
             # guess at type...
             try:
                 self.value = int(value)
-            except:
+            except ValueError:
                 try:
                     self.value = float(value)
-                except:
+                except ValueError:
                     self.value = value
 
     def get_value(self, read):
@@ -960,7 +961,7 @@
             outfile = arg
         elif arg[0] == '-':
             if not arg[1:] in _criteria:
-                print "Unknown criterion: %s" % arg
+                print("Unknown criterion: %s" % arg)
                 fail = True
             if crit_args:
                 criteria.append(_criteria[crit_args[0][1:]](*crit_args[1:]))
@@ -968,7 +969,7 @@
         elif crit_args:
             crit_args.append(arg)
         else:
-            print "Unknown argument: %s" % arg
+            print("Unknown argument: %s" % arg)
             fail = True
 
     if not fail and crit_args:
@@ -979,11 +980,11 @@
             usage()
 
         if not infile:
-            print "Missing: input bamfile"
+            print("Missing: input bamfile")
         if not outfile:
-            print "Missing: output bamfile"
+            print("Missing: output bamfile")
         if not criteria:
-            print "Missing: filtering criteria"
+            print("Missing: filtering criteria")
         usage()
     else:
         bam_filter(infile, outfile, criteria, failed, verbose)