-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.py
37 lines (27 loc) · 917 Bytes
/
data.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
36
37
from argparse import ArgumentParser
from contextlib import redirect_stdout
from pathlib import Path
import sys
from benchmarks import fasta
def write(path, n):
if Path(path).exists():
print(f'data: target exists: {path}')
else:
print(f'data: generate {n} -> {path}')
with open(path, 'w', encoding='UTF8') as file:
with redirect_stdout(file):
fasta.execute(n)
def execute(data_dir='my_data'):
if not Path(data_dir).exists():
Path(data_dir).mkdir(parents=True)
write(Path(data_dir, 'knucleotide-input25000000.txt'), 25000000)
write(Path(data_dir, 'regexredux-input5000000.txt'), 5000000)
write(Path(data_dir, 'revcomp-input100000000.txt'), 100000000)
def main():
"""Build benchmark input data
"""
parser = ArgumentParser()
_ = parser.parse_args()
execute()
if __name__ == '__main__':
sys.exit(main())