def parse_arguments()

in src/main/scripts/dna_capture_var_fastq.py [0:0]


def parse_arguments(script_name, argv):
    species = None
    read_type = None
    genome = None
    targeted_kit = None
    job_name = None
    dir_out = None
    fastq_list = None
    fastq_list_r2 = None
    library_type = None
    project = None
    run = None
    toolset = None
    flag_xenome = None
    cores_per_sample = None
    sync = None
    master_mode = None
    verbose = None
    sample_name_list = None
    novoalign_tune = None
    try:
        opts, args = getopt.getopt(argv, "hs:t:g:k:j:d:f:q:l:p:r:n:x:c:i:a:v", ["help", "species=", "read_type=",
                                                                                "genome=", "targeted_kit=", "job_name=",
                                                                                "dir_out=", "fastq_list=",
                                                                                "fastq_list_r2", "library_type=",
                                                                                "project=", "run=",
                                                                                "toolset=", "flag_xenome=",
                                                                                "cores_per_sample=", "sync=",
                                                                                "sample_name_list", "novoalign_tune",
                                                                                "master_mode", "verbose"])
        for opt, arg in opts:
            if opt == '-h':
                print(script_name + ' -s <species> -t <read_type> -g <genome> -k <targeted_kit> -j <job_name> '
                                    '-d <dir_out> -f <fastq_list> -q <fastq_list_r2> -l <library_type> -p <project> '
                                    '-r <run> -n <toolset> -x <flag_xenome> -c <cores_per_sample> <sync> '
                                    '-i <sample_name_list> -a <novoalign_tune> <master_mode> -v <verbose>')
                sys.exit()
            elif opt in ("-s", "--species"):
                species = arg
            elif opt in ("-t", "--read_type"):
                read_type = arg
            elif opt in ("-g", "--genome"):
                genome = arg
            elif opt in ("-k", "--targeted_kit"):
                targeted_kit = arg
            elif opt in ("-j", "--job_name"):
                job_name = arg
            elif opt in ("-d", "--dir_out"):
                dir_out = arg
            elif opt in ("-f", "--fastq_list"):
                fastq_list = arg
            elif opt in ("-q", "--fastq_list_r2"):
                fastq_list_r2 = arg
            elif opt in ("-l", "--library_type"):
                library_type = arg
            elif opt in ("-p", "--project"):
                project = arg
            elif opt in ("-r", "--run"):
                run = arg
            elif opt in ("-n", "--toolset"):
                toolset = arg
            elif opt in ("-x", "--flag_xenome"):
                flag_xenome = arg
            elif opt in ("-c", "--cores_per_sample"):
                cores_per_sample = arg
            elif opt in "--sync":
                sync = arg
            elif opt in "--master_mode":
                master_mode = True
            elif opt in ("-v", "--verbose"):
                verbose = 'True'
            elif opt in ("-i", "--sample_name_list"):
                sample_name_list = arg
            elif opt in ("-a", "--novoalign_tune"):
                novoalign_tune = arg
        if not species:
            print('Species (-s <species>) is required')
            usage()
            sys.exit(2)
        if not read_type:
            print('Read type (-t <read_type>) is required')
            usage()
            sys.exit(2)
        if not fastq_list:
            print('The path to the input manifest fastq file (-f <fastq_list>) is required')
            usage()
            sys.exit(2)
        if not dir_out:
            print('The output directory for the analysis (-d <dir_out>) is required')
            usage()
            sys.exit(2)
        if not toolset:
            print('The set of tools (-n <toolset>) is required')
            usage()
            sys.exit(2)
        if not targeted_kit:
            print('The targeted kit name (-k <targeted_kit>) is required')
            usage()
            sys.exit(2)
        return species, read_type, job_name, dir_out, fastq_list, fastq_list_r2, library_type, project, run, toolset, \
            flag_xenome, cores_per_sample, verbose, sync, genome, targeted_kit, sample_name_list, master_mode, \
            novoalign_tune
    except getopt.GetoptError:
        usage()
        sys.exit(2)