def main(args, prog_name):
<EOL>ui = getUI(prog_name, args)<EOL>if ui.optionIsSet("<STR_LIT:test>"):<EOL><INDENT>unittest.main(argv=[sys.argv[<NUM_LIT:0>]])<EOL><DEDENT>elif ui.optionIsSet("<STR_LIT>"):<EOL><INDENT>ui.usage()<EOL><DEDENT>else:<EOL><INDENT>verbose = (ui.optionIsSet("<STR_LIT>") is True) or DEFAULT_VERBOSITY<EOL>out_fh = sys.stdout<EOL>if ui.optionIsSet("<STR_LIT>"):<EOL><INDENT>out_fh = open(ui.getValue("<STR_LIT>"), "<STR_LIT:w>")<EOL><DEDENT>window_size = DEFAULT_WINDOW_SIZE<EOL>if ui.optionIsSet("<STR_LIT>"):<EOL><INDENT>window_size = ui.getValue("<STR_LIT>")<EOL><DEDENT>windowCentre = DEFAULT_WINDOW_CENTRE<EOL>if ui.optionIsSet("<STR_LIT>"):<EOL><INDENT>windowCentre = ui.getValue("<STR_LIT>")<EOL>if windowCentre not in WINDOW_CENTRE_OPTIONS:<EOL><INDENT>sys.stderr.write("<STR_LIT>" +<EOL>str(windowCentre) + "<STR_LIT:\n>")<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>args = ui.getAllArguments()<EOL>assert(len(args) == <NUM_LIT:3> or len(args) == <NUM_LIT:4>)<EOL>region_fn = ui.getArgument(<NUM_LIT:0>)<EOL>ga_path = ui.getArgument(<NUM_LIT:1>)<EOL>index_fn = None<EOL>if len(args) == <NUM_LIT:3>:<EOL><INDENT>spec = ui.getArgument(<NUM_LIT:2>)<EOL><DEDENT>else:<EOL><INDENT>index_fn = ui.getArgument(<NUM_LIT:2>)<EOL>spec = ui.getArgument(<NUM_LIT:3>)<EOL><DEDENT>extensions = (ui.getValue("<STR_LIT>").strip().split("<STR_LIT:U+002C>") if<EOL>ui.optionIsSet("<STR_LIT>") else None)<EOL>index_extensions = (ui.getValue("<STR_LIT>").strip().split("<STR_LIT:U+002C>") if<EOL>ui.optionIsSet("<STR_LIT>") else None)<EOL>fail_no_index = ui.optionIsSet("<STR_LIT>")<EOL>mi_seqs = (MissingSequenceHandler[ui.getValue("<STR_LIT>")]<EOL>if ui.optionIsSet("<STR_LIT>")<EOL>else MissingSequenceHandler.TREAT_AS_ALL_GAPS)<EOL>species = ([x.strip() for x in ui.getValue("<STR_LIT>").split("<STR_LIT:U+002C>")] if<EOL>ui.optionIsSet("<STR_LIT>") else None)<EOL>alig = (load_just_in_time_genome_alignment(ga_path, spec, extensions,<EOL>index_extensions, fail_no_index,<EOL>verbose)<EOL>if os.path.isdir(ga_path)<EOL>else build_genome_alignment_from_file(ga_path, spec, index_fn,<EOL>verbose))<EOL>profile = processBED(open(region_fn), alig, window_size, CENTRE,<EOL>mi_seqs, species, verbose)<EOL>out_fh.write("<STR_LIT>" + "<STR_LIT:U+002CU+0020>".join(str(x) for x in profile) + "<STR_LIT:\n>")<EOL><DEDENT>
Process the command line arguments of this script and dispatch.