-
Notifications
You must be signed in to change notification settings - Fork 2
/
indexing.py
35 lines (27 loc) · 1.13 KB
/
indexing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import random
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--wq', help='operator <clean, index>')
parser.add_argument('--path', help='file path for indexing')
args = parser.parse_args()
if args.wq == "clean_seq":
with open("sequencer.txt", 'w', encoding='utf-8') as outfile:
outfile.write("0")
if args.wq == "clean_hist":
with open("histoutputs.csv.txt", 'w', encoding='utf-8') as outfile:
outfile.write("0:1,1:2")
if args.wq == "index":
sequencer = 0
with open("sequencer.txt", 'r', encoding='utf-8') as infile:
for line in infile:
sequencer = int(line.replace("\n",""))
break
# print(sequencer)
# print(args.file.replace(".txt","") + "_write.txt")
with open(args.path + ".upa", 'w') as outfile:
with open(args.path, 'r', encoding='utf-8') as infile:
for line in infile:
line1 = line.replace("\n","") + ';' + str(random.randint(sequencer, sequencer + 1)) + '\n'
outfile.write(line1)
with open("sequencer.txt", 'w', encoding='utf-8') as outfile:
outfile.write(str(sequencer + 1))