def parseArgs():
    import argparse
    apars = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    requiredNamed = apars.add_argument_group('required arguments')
    requiredNamed.add_argument('--dinosaur_jar_path', metavar='JAR', required=True, help='Path to the Dinosaur .jar file.\n                          ')
    apars.add_argument('--mzml_fns', default=None, metavar='M', nargs='*', help='mzML file(s). To easily specify multiple files one can use wildcards, e.g. my_spectrum_files/*.mzML\n                          ')
    apars.add_argument('--file_list_file', default=None, metavar='L', help='Text file with paths to mzML files, one per line.\n                          ')
    apars.add_argument('--output_folder', default='./dinosaur/', metavar='O', help='Output folder.\n                          ')
    apars.add_argument('--dinosaur_mem', default=8.0, metavar='M', type=float, help='Memory for allocated for Dinosaur in GB.\n                          ')
    apars.add_argument('--dinosaur_flags', default='', metavar='O', help="Extra command line flags to pass to Dinosaur, as indicated in Dinosaur's help text.\n                          ")
    apars.add_argument('--spectrum_output_format', default=None, metavar='F', help='If you want updated spectrum files with the new MS1 features assigned to the MS2 spectra, set this to the desired output format (ms2, mgf or mzML).\n                          ')
    apars.add_argument('--split_precursors', help='for .mzML or .ms2 output this creates a new spectrum for each precursor, e.g. \n                             if spectrum with scan number 132 matches two precursors, we generate two spectra \n                             with scan numbers 13201 and 13202. This can be useful if your downstream \n                             analysis includes tools that do not support multiple precursors per spectrum,\n                             such as MSGF+. For MGF output this flag is always set, as it does not support \n                             multiple precursors per spectrum.\n                          ', action='store_true')
    args = apars.parse_args()
    if (not args.mzml_fns):
        if (args.file_list_file and (len(args.file_list_file) > 0)):
            with open(args.file_list_file, 'r') as f:
                args.mzml_fns = list(filter((lambda x: (len(x) > 0)), map((lambda x: re.sub('[\\n\\t\\s]*', '', x)), f.read().splitlines())))
        else:
            sys.exit('No input mzML files specified. Use either --mzml_fns or --file_list_file.')
    elif (args.file_list_file and (len(args.file_list_file) > 0)):
        sys.exit('Ambiguous mzML input. Use either --mzml_fns or --file_list_file, not both.')
    params = dict()
    params['splitPrecursors'] = args.split_precursors
    params['dinosaurMemory'] = args.dinosaur_mem
    params['dinosaurFlags'] = args.dinosaur_flags
    return (args, params)
def parseArgs():
    import argparse
    apars = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    requiredNamed = apars.add_argument_group('required arguments')
    requiredNamed.add_argument('--dinosaur_jar_path', metavar='JAR', required=True, help='Path to the Dinosaur .jar file.\n                          ')
    apars.add_argument('--mzml_fns', default=None, metavar='M', nargs='*', help='mzML file(s). To easily specify multiple files one can use wildcards, e.g. my_spectrum_files/*.mzML\n                          ')
    apars.add_argument('--file_list_file', default=None, metavar='L', help='Text file with paths to mzML files, one per line.\n                          ')
    apars.add_argument('--output_folder', default='./dinosaur/', metavar='O', help='Output folder.\n                          ')
    apars.add_argument('--dinosaur_mem', default=8.0, metavar='M', type=float, help='Memory for allocated for Dinosaur in GB.\n                          ')
    apars.add_argument('--dinosaur_flags', default=, metavar='O', help="Extra command line flags to pass to Dinosaur, as indicated in Dinosaur's help text.\n                          ")
    apars.add_argument('--spectrum_output_format', default=None, metavar='F', help='If you want updated spectrum files with the new MS1 features assigned to the MS2 spectra, set this to the desired output format (ms2, mgf or mzML).\n                          ')
    apars.add_argument('--split_precursors', help='for .mzML or .ms2 output this creates a new spectrum for each precursor, e.g. \n                             if spectrum with scan number 132 matches two precursors, we generate two spectra \n                             with scan numbers 13201 and 13202. This can be useful if your downstream \n                             analysis includes tools that do not support multiple precursors per spectrum,\n                             such as MSGF+. For MGF output this flag is always set, as it does not support \n                             multiple precursors per spectrum.\n                          ', action='store_true')
    args = apars.parse_args()
    if (not args.mzml_fns):
        if (args.file_list_file and (len(args.file_list_file) > 0)):
            with open(args.file_list_file, 'r') as f:
                args.mzml_fns = list(filter((lambda x: (len(x) > 0)), map((lambda x: re.sub('[\\n\\t\\s]*', , x)), f.read().splitlines())))
        else:
            sys.exit('No input mzML files specified. Use either --mzml_fns or --file_list_file.')
    elif (args.file_list_file and (len(args.file_list_file) > 0)):
        sys.exit('Ambiguous mzML input. Use either --mzml_fns or --file_list_file, not both.')
    params = dict()
    params['splitPrecursors'] = args.split_precursors
    params['dinosaurMemory'] = args.dinosaur_mem
    params['dinosaurFlags'] = args.dinosaur_flags
    return (args, params)