comparison PDAUG_AddClassLabel/PDAUG_AddClassLabel.py @ 0:7557b48b2872 draft

"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
author jay
date Wed, 28 Oct 2020 02:10:12 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:7557b48b2872
1 import pandas as pd
2 import argparse
3
4 parser = argparse.ArgumentParser()
5
6 parser.add_argument("-I", "--InFile", required=True, default=None, help="Input data file")
7 parser.add_argument("-C", "--ClassLabel", required=False, default=0, help="Class Label 0 or 1")
8 parser.add_argument("-t", "--ClassLabelTitle", required=False, default='Class_label', help="Title to use for class label column (Class_label)")
9 parser.add_argument("-O", "--OutFile", required=False, default='OutFile.tsv', help="Output file name")
10
11 args = parser.parse_args()
12
13 df1 = pd.read_csv(args.InFile, sep="\t")
14 df2 = pd.DataFrame([args.ClassLabel]*df1.shape[0], columns=[args.ClassLabelTitle])
15
16 df = pd.concat([df1, df2], axis=1)
17 df.to_csv(args.OutFile, sep="\t", index=False)