-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_read_args.py
More file actions
38 lines (31 loc) · 908 Bytes
/
Copy pathPython_read_args.py
File metadata and controls
38 lines (31 loc) · 908 Bytes
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
38
#!/usr/bin/env python
import argparse
import sys
import subprocess
print("this is script.py")
def parse_args():
parser=argparse.ArgumentParser(description="a script to do stuff")
parser.add_argument("R1_file")
parser.add_argument("--threads", type=int, default=16)
args=parser.parse_args()
print("the inputs are:")
for arg in vars(args):
print("{} is {}".format(arg, getattr(args, arg)))
return args
def stats(file):
cmd=["seqkit", "stats", file]
subprocess.run(cmd)
def process_files(things):
print("this is the process files function")
print(things.R1_file)
# cmd=["seqkit", "stats", things.R1_file]
# subprocess.run(cmd)
stats(things.R1_file)
def main():
print("this is the main function")
inputs=parse_args()
print(inputs.R1_file)
print(inputs.threads)
process_files(inputs)
if __name__ == '__main__':
main()