From 02a561b4f677554457652611eb3401abaf8cb695 Mon Sep 17 00:00:00 2001 From: coolneng Date: Sat, 13 Nov 2021 14:40:07 +0100 Subject: [PATCH] Add CLI argument parsing --- src/parser.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/parser.py b/src/parser.py index c3d96b4..3885be3 100644 --- a/src/parser.py +++ b/src/parser.py @@ -1,3 +1,4 @@ +from argparse import ArgumentParser from glob import glob 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") +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(): - file_list = find_html_files("data") + args = parse_arguments() + file_list = find_html_files(args.input) adapters = extract_adapters(file_list) - save_to_file("placeholder.txt", adapters) + save_to_file(args.output, adapters) if __name__ == "__main__":