diff nn_classifier.xml @ 15:adec53d64383 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit f54ff2ba2f8e7542d68966ce5a6b17d7f624ac48
author bgruening
date Fri, 13 Jul 2018 03:54:53 -0400
parents 478034e9826b
children
line wrap: on
line diff
--- a/nn_classifier.xml	Tue Jul 10 03:11:10 2018 -0400
+++ b/nn_classifier.xml	Fri Jul 13 03:54:53 2018 -0400
@@ -25,12 +25,13 @@
 @GET_X_y_FUNCTION@
 
 input_json_path = sys.argv[1]
-params = json.load(open(input_json_path, "r"))
-
+with open(input_json_path, "r") as param_handler:
+    params = json.load(param_handler)
 
 #if $selected_tasks.selected_task == "load":
 
-classifier_object = pickle.load(open("$infile_model", 'r'))
+with open("$infile_model", 'rb') as model_handler:
+    classifier_object = pickle.load(model_handler)
 
 header = 'infer' if params["selected_tasks"]["header"] else None
 data = pandas.read_csv("$selected_tasks.infile_data", sep='\t', header=header, index_col=None, parse_dates=True, encoding=None, tupleize_cols=False)
@@ -58,7 +59,8 @@
 classifier_object = my_class(**options)
 classifier_object.fit(X, y)
 
-pickle.dump(classifier_object,open("$outfile_fit", 'w+'))
+with open("$outfile_fit", 'wb') as out_handler:
+    pickle.dump(classifier_object, out_handler)
 
 #end if