Checks the arguments and options.

    :param args: a 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.

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

    :param args: a 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
    required_file_extensions = {".tfam", ".tped"}
    if args.is_bfile:
        required_file_extensions = {".bed", ".bim", ".fam"}
    for fileName in [args.ifile + i for i in required_file_extensions]:
        if not os.path.isfile(fileName):
            msg = "{}: no such file".format(fileName)
            raise ProgramError(msg)

    # Check the mind option (between 0 and 1, inclusive)
    if (args.mind < 0) or (args.mind > 1):
        msg = "mind=%f: must be between 0 and 1 (inclusive)" % args.mind
        raise ProgramError(msg)

    return True