diff tools/mira4_0/mira4_validator.py @ 4:1713289d9908 draft default tip

v0.0.11 tweak for use with bioconda dependencies
author peterjc
date Thu, 10 Aug 2017 11:09:10 -0400
parents 4eb32a3d67d1
children
line wrap: on
line diff
--- a/tools/mira4_0/mira4_validator.py	Fri Oct 02 06:12:23 2015 -0400
+++ b/tools/mira4_0/mira4_validator.py	Thu Aug 10 11:09:10 2017 -0400
@@ -1,5 +1,6 @@
-#Called from the Galaxy Tool XML file
-#import sys
+# Called from the Galaxy Tool XML file
+# import sys
+
 
 def validate_input(trans, error_map, param_values, page_param_map):
     """Validates the min_size/max_size user input, before execution."""
@@ -13,41 +14,41 @@
 
         min_size = str(segments["min_size"]).strip()
         max_size = str(segments["max_size"]).strip()
-        #sys.stderr.write("DEBUG min_size=%r, max_size=%r\n" % (min_size, max_size))
+        # sys.stderr.write("DEBUG min_size=%r, max_size=%r\n" % (min_size, max_size))
 
-        #Somehow Galaxy seems to turn an empty field into string "None"...
-        if min_size=="None":
+        # Somehow Galaxy seems to turn an empty field into string "None"...
+        if min_size == "None":
             min_size = ""
-        if max_size=="None":
+        if max_size == "None":
             max_size = ""
 
-        if min_size=="" and max_size=="":
-            #Both missing is good
+        if min_size == "" and max_size == "":
+            # Both missing is good
             pass
-        elif min_size=="":
+        elif min_size == "":
             err["min_size"] = "Minimum size required if maximum size given"
-        elif max_size=="":
+        elif max_size == "":
             err["max_size"] = "Maximum size required if minimum size given"
-            
+
         if min_size:
             try:
                 min_size_int = int(min_size)
                 if min_size_int < 0:
                     err["min_size"] = "Minumum size must not be negative (%i)" % min_size_int
-                    min_size = None # Avoid doing comparison below
+                    min_size = None  # Avoid doing comparison below
             except ValueError:
                 err["min_size"] = "Minimum size is not an integer (%s)" % min_size
-                min_size = None # Avoid doing comparison below
+                min_size = None  # Avoid doing comparison below
 
         if max_size:
             try:
                 max_size_int = int(max_size)
-                if max_size_int< 0:
+                if max_size_int < 0:
                     err["max_size"] = "Maximum size must not be negative (%i)" % max_size_int
-                    max_size = None # Avoid doing comparison below
+                    max_size = None  # Avoid doing comparison below
             except ValueError:
                 err["max_size"] = "Maximum size is not an integer (%s)" % max_size
-                max_size = None # Avoid doing comparison below
+                max_size = None  # Avoid doing comparison below
 
         if min_size and max_size and min_size_int > max_size_int:
             msg = "Minimum size must be less than maximum size (%i vs %i)" % (min_size_int, max_size_int)
@@ -55,10 +56,10 @@
             err["max_size"] = msg
 
         if err:
-            err_list.append({"segments":err})
+            err_list.append({"segments": err})
         else:
             err_list.append(dict())
 
     if any(err_list):
-        #Return an error map only if any readgroup gave errors
+        # Return an error map only if any readgroup gave errors
         error_map["read_group"] = err_list