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.

    """
    # Checking if there are input files
    if args.summarized_intensities is None:
        if args.bfile is None and args.intensities is None:
            msg = ("need to specify either '--bfile' and '--intensities', or "
                   "'--summarized-intensities'")
            raise ProgramError(msg)

        # Checking the fam file bim
        for suffix in {".bim", ".fam"}:
            if not os.path.isfile(args.bfile + suffix):
                msg = "{}: no such file".format(args.bfile + suffix)
                raise ProgramError(msg)

        # Checking the intensity file
        if not os.path.isfile(args.intensities):
            msg = "{}: no such file".format(args.intensities)
            raise ProgramError(msg)
    else:
        if args.bfile is not None or args.intensities is not None:
            msg = ("need to specify either '--bfile' and '--intensities', or "
                   "'--summarized-intensities'")
            raise ProgramError(msg)

        for suffix in {".ok_females.txt", ".ok_males.txt", ".ok_unknowns.txt",
                       ".problematic_females.txt", ".problematic_males.txt",
                       ".problematic_unknowns.txt"}:
            if not os.path.isfile(args.summarized_intensities + suffix):
                msg = "{}: no such file".format(args.summarized_intensities +
                                                suffix)
                raise ProgramError(msg)

    # Checking the sex problem file
    if args.sex_problems is not None:
        if not os.path.isfile(args.sex_problems):
            msg = "{}: no such file".format(args.sex_problems)
            raise ProgramError(msg)

    return True