def checkArgs(args):
    """Checks the arguments and options.

    :param args: an object containing the options of the program.
    :type args: argparse.Namespace

    :returns: ``True`` if everything was OK.

    If there is a problem with an option, an exception is raised using the
    :py:class:`ProgramError` class, a message is printed to the
    :class:`sys.stderr` and the program exists with code 1.

    """
    # Check if we have the tped and the tfam files
    for fileName in [args.bfile + i for i in [".bed", ".bim", ".fam"]]:
        if not os.path.isfile(fileName):
            msg = "%(fileName)s: no such file" % locals()
            raise ProgramError(msg)

    # Ceck the number of markers on chromosome 23
    if args.nbChr23 < 0:
        msg = ("{}: number of markers on chr 23 must be "
               "positive".format(args.nbChr23))
        raise ProgramError(msg)

    # If we ask for LRR and BAF, we need a directory
    if args.lrr_baf:
        if not os.path.isdir(args.lrr_baf_raw_dir):
            msg = "{}: no such directory".format(args.lrr_baf_raw_dir)
            raise ProgramError(msg)
        if args.lrr_baf_dpi < 10:
            msg = "{}: DPI too low".format(args.dpi)
            raise ProgramError(msg)

    return True