arguments.py 1.94 KB
Newer Older
peguerin's avatar
peguerin committed
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
39
40
41
42
43
44
45
46
47
48
49
50
import argparse
import sys



HELPER_TEXT ="""
.___  ___.  __  ___ .______    _______  .______      
|   \/   | |  |/  / |   _  \  |       \ |   _  \     
|  \  /  | |  '  /  |  |_)  | |  .--.  ||  |_)  |    
|  |\/|  | |    <   |   _  <  |  |  |  ||      /     
|  |  |  | |  .  \  |  |_)  | |  '--'  ||  |\  \----.
|__|  |__| |__|\__\ |______/  |_______/ | _| `._____|
                                                     
_______________________________________________________________________________


Pierre-Edouard GUERIN, Laetitia MATHON, Virginie MARQUES, Stephanie MANEL
CNRS, EPHE, Sorbonne University, Montpellier, France
version 0.1 "" March 2021
Usage:
> python3 mkbdr [options]
For help:
> python3 mkbdr --help
"""




def parse_args(usage=HELPER_TEXT):
    parser = argparse.ArgumentParser(description='mkbdr - to build a custom metabarcoding reference database.')

    subprasers = parser.add_subparsers(dest='command')

    validate = subprasers.add_parser('validate', help='check format and taxonomy')
    validate.add_argument("-f","--fasta", type=str, help='path of the barcodes sequences FASTA file', required=True)
    validate.add_argument("-c","--curate", type=str, help='path of the curated taxonomy CSV file', required=False, default="NA")
    validate.add_argument("-n","--ncbi_taxdump", type=str, help='path of NCBI taxdump.tar.gz file', required=False, default="NA")    
    validate.add_argument("-o","--output_prefix", type=str, help='prefix of the output FASTA such as [PREFIX].fasta')

    curate = subprasers.add_parser('curate', help='try to correct wrong taxonomy')
    curate.add_argument("-f","--fasta", type=str, help='path of the barcodes sequences FASTA file', required=True)
    curate.add_argument("-o","--output_prefix", type=str, help='prefix of the output curated taxonomy CSV such as [PREFIX].csv')

    args = parser.parse_args()

    if args.command not in ['validate', 'curate']:
        print(usage)
        sys.exit(0)

    return args