Mercurial > repos > jay > pdaug_peptide_sequence_analysis
annotate PDAUG_AddClassLabel/PDAUG_AddClassLabel.py @ 0:e59674e3a391 draft
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
author | jay |
---|---|
date | Fri, 20 Nov 2020 19:47:44 +0000 |
parents | |
children |
rev | line source |
---|---|
0
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
1 import pandas as pd |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
2 import argparse |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
3 |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
4 parser = argparse.ArgumentParser() |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
5 |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
6 parser.add_argument("-I", "--InFile", required=True, default=None, help="Input data file") |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
7 parser.add_argument("-C", "--ClassLabel", required=False, default=0, help="Class Label 0 or 1") |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
8 parser.add_argument("-t", "--ClassLabelTitle", required=False, default='Class_label', help="Title to use for class label column (Class_label)") |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
9 parser.add_argument("-O", "--OutFile", required=False, default='OutFile.tsv', help="Output file name") |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
10 |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
11 args = parser.parse_args() |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
12 |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
13 df1 = pd.read_csv(args.InFile, sep="\t") |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
14 df2 = pd.DataFrame([args.ClassLabel]*df1.shape[0], columns=[args.ClassLabelTitle]) |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
15 |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
16 df = pd.concat([df1, df2], axis=1) |
e59674e3a391
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 6f53ad797ec1af02b41510063a86bec7d121abf3"
jay
parents:
diff
changeset
|
17 df.to_csv(args.OutFile, sep="\t", index=False) |