main entry point for the FDR script.

  :param args: the arguments for this script, as a list of string. Should
               already have had things like the script name stripped. That
               is, if there are no args provided, this should be an empty
               list.

def main(args):
  """
  main entry point for the FDR script.

  :param args: the arguments for this script, as a list of string. Should
               already have had things like the script name stripped. That
               is, if there are no args provided, this should be an empty
               list.
  """
  # get options and arguments
  ui = getUI(args)

  if ui.optionIsSet("test"):
    # just run unit tests
    unittest.main(argv=[sys.argv[0]])
  elif ui.optionIsSet("help"):
    # just show help
    ui.usage()
  else:
    verbose = (ui.optionIsSet("verbose") is True) or DEFAULT_VERBOSITY

    # header?
    header = ui.optionIsSet("header")

    # get field value
    field = ui.getValue("field") - 1

    # get output handle
    out_fh = sys.stdout
    if ui.optionIsSet("output"):
      out_fh = open(ui.getValue("output"), "w")

    # get input file-handle
    in_fh = sys.stdin
    if ui.hasArgument(0):
      in_fh = open(ui.getArgument(0))

    delim = DEFAULT_DELIM

    # load data, do conversion, write out results.
    data_table = DataTable()
    data_table.load(in_fh, header, delim, verbose)
    data_table.frame[field] =\
        correct_pvals(data_table.frame[field], verbose=verbose)
    data_table.write(out_fh, delim, verbose)