diff keras_deep_learning.py @ 24:a5aed87b2cc0 draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 5b2ac730ec6d3b762faa9034eddd19ad1b347476"
author bgruening
date Mon, 16 Dec 2019 05:28:32 -0500
parents 5895fe0b8bde
children 9b017b0da56e
line wrap: on
line diff
--- a/keras_deep_learning.py	Thu Nov 07 05:35:17 2019 -0500
+++ b/keras_deep_learning.py	Mon Dec 16 05:28:32 2019 -0500
@@ -73,7 +73,7 @@
             }
     """
     constraint_type = config['constraint_type']
-    if constraint_type == 'None':
+    if constraint_type in ('None', ''):
         return None
 
     klass = getattr(keras.constraints, constraint_type)
@@ -92,7 +92,7 @@
     """Access to handle all kinds of parameters
     """
     for key, value in six.iteritems(params):
-        if value == 'None':
+        if value in ('None', ''):
             params[key] = None
             continue
 
@@ -205,6 +205,9 @@
     config : dictionary, galaxy tool parameters loaded by JSON
     """
     generator_type = config.pop('generator_type')
+    if generator_type == 'none':
+        return None
+
     klass = try_get_attr('galaxy_ml.preprocessors', generator_type)
 
     if generator_type == 'GenomicIntervalBatchGenerator':
@@ -240,7 +243,7 @@
     json_string = model.to_json()
 
     with open(outfile, 'w') as f:
-        f.write(json_string)
+        json.dump(json.loads(json_string), f, indent=2)
 
 
 def build_keras_model(inputs, outfile, model_json, infile_weights=None,