Add CLI argument parsing

This commit is contained in:
coolneng 2021-11-13 14:40:07 +01:00
parent d3f7677423
commit 02a561b4f6
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,4 @@
from argparse import ArgumentParser
from glob import glob from glob import glob
from typing import List, Union from typing import List, Union
@ -22,10 +23,18 @@ def save_to_file(filename, adapters) -> None:
adapters.to_csv(filename, index=False, header=False, sep="\n") adapters.to_csv(filename, index=False, header=False, sep="\n")
def parse_arguments():
parser = ArgumentParser()
parser.add_argument("input", help="directory containing the fastqc reports")
parser.add_argument("output", help="file where to export the sequences")
return parser.parse_args()
def main(): def main():
file_list = find_html_files("data") args = parse_arguments()
file_list = find_html_files(args.input)
adapters = extract_adapters(file_list) adapters = extract_adapters(file_list)
save_to_file("placeholder.txt", adapters) save_to_file(args.output, adapters)
if __name__ == "__main__": if __name__ == "__main__":