comparison pre_process.xml @ 23:792ae8a93b07 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 2a058459e6daf0486871f93845f00fdb4a4eaca1
author bgruening
date Sat, 29 Sep 2018 07:20:37 -0400
parents 4dea5a431d45
children a089c1b54c84
comparison
equal deleted inserted replaced
22:315d65cf9e17 23:792ae8a93b07
21 import pickle 21 import pickle
22 from scipy.io import mmread 22 from scipy.io import mmread
23 from scipy.io import mmwrite 23 from scipy.io import mmwrite
24 from sklearn import preprocessing 24 from sklearn import preprocessing
25 25
26 execfile("$__tool_directory__/utils.py") 26 exec(open("$__tool_directory__/utils.py").read(), globals())
27 27
28 input_json_path = sys.argv[1] 28 input_json_path = sys.argv[1]
29 with open(input_json_path, "r") as param_handler: 29 with open(input_json_path, "r") as param_handler:
30 params = json.load(param_handler) 30 params = json.load(param_handler)
31 31
58 estimator = my_class(**options) 58 estimator = my_class(**options)
59 estimator.fit(X) 59 estimator.fit(X)
60 result = estimator.transform(X) 60 result = estimator.transform(X)
61 61
62 #if $input_type.selected_input_type == "sparse": 62 #if $input_type.selected_input_type == "sparse":
63 with open("$outfile_transform", "w+") as transform_handler: 63 with open("$outfile_transform", "wb") as transform_handler:
64 mmwrite(transform_handler, result) 64 mmwrite(transform_handler, result)
65 #else: 65 #else:
66 res = pandas.DataFrame(result) 66 res = pandas.DataFrame(result)
67 res.to_csv(path_or_buf = "$outfile_transform", sep="\t", index=False, header=None) 67 res.to_csv(path_or_buf = "$outfile_transform", sep="\t", index=False, header=None)
68 #end if 68 #end if