comparison label_encoder.py @ 25:b878e4cdd63a draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/sklearn commit 9981e25b00de29ed881b2229a173a8c812ded9bb
author bgruening
date Wed, 09 Aug 2023 12:24:57 +0000
parents 14fa42b095c4
children
comparison
equal deleted inserted replaced
24:b7c3e9a3b954 25:b878e4cdd63a
19 19
20 outfile : str 20 outfile : str
21 File path to output vector 21 File path to output vector
22 22
23 """ 23 """
24 warnings.simplefilter('ignore') 24 warnings.simplefilter("ignore")
25 25
26 with open(inputs, 'r') as param_handler: 26 with open(inputs, "r") as param_handler:
27 params = json.load(param_handler) 27 params = json.load(param_handler)
28 28
29 input_header = params['header0'] 29 input_header = params["header0"]
30 header = 'infer' if input_header else None 30 header = "infer" if input_header else None
31 31
32 input_vector = pd.read_csv(infile, sep='\t', header=header) 32 input_vector = pd.read_csv(infile, sep="\t", header=header)
33 33
34 le = LabelEncoder() 34 le = LabelEncoder()
35 35
36 output_vector = le.fit_transform(input_vector) 36 output_vector = le.fit_transform(input_vector)
37 37
38 np.savetxt(outfile, output_vector, fmt="%d", delimiter='\t') 38 np.savetxt(outfile, output_vector, fmt="%d", delimiter="\t")
39 39
40 40
41 if __name__ == '__main__': 41 if __name__ == "__main__":
42 aparser = argparse.ArgumentParser() 42 aparser = argparse.ArgumentParser()
43 aparser.add_argument("-i", "--inputs", dest="inputs", required=True) 43 aparser.add_argument("-i", "--inputs", dest="inputs", required=True)
44 aparser.add_argument("-y", "--infile", dest="infile") 44 aparser.add_argument("-y", "--infile", dest="infile")
45 aparser.add_argument("-o", "--outfile", dest="outfile") 45 aparser.add_argument("-o", "--outfile", dest="outfile")
46 args = aparser.parse_args() 46 args = aparser.parse_args()