The main function.

    :param argString: the options.

    :type argString: list of strings

    These are the steps of the modules:

    1. Prints the options.
    2. Reads the population file (:py:func:`read_population_file`).
    3. Reads the ``mds`` file (:py:func:`read_mds_file`).
    4. Computes the three reference population clusters' centers
       (:py:func:`find_ref_centers`).
    5. Computes three clusters according to the reference population clusters'
       centers, and finds the outliers of a given reference population
       (:py:func:`find_outliers`). This steps also produce three different
       plots.
    6. Writes outliers in a file (``prefix.outliers``).

def main(argString=None):
    """The main function.

    :param argString: the options.

    :type argString: list of strings

    These are the steps of the modules:

    1. Prints the options.
    2. Reads the population file (:py:func:`read_population_file`).
    3. Reads the ``mds`` file (:py:func:`read_mds_file`).
    4. Computes the three reference population clusters' centers
       (:py:func:`find_ref_centers`).
    5. Computes three clusters according to the reference population clusters'
       centers, and finds the outliers of a given reference population
       (:py:func:`find_outliers`). This steps also produce three different
       plots.
    6. Writes outliers in a file (``prefix.outliers``).

    """
    # Getting and checking the options
    args = parseArgs(argString)
    checkArgs(args)

    logger.info("Options used:")
    for key, value in vars(args).iteritems():
        logger.info("  --{} {}".format(key.replace("_", "-"), value))

    # Reads the population file
    logger.info("Reading population file")
    populations = read_population_file(args.population_file)

    # Reads the MDS file
    logger.info("Reading MDS file")
    mds = read_mds_file(args.mds, args.xaxis, args.yaxis, populations)

    # Finds the population centers
    logger.info("Finding reference population centers")
    centers, center_info = find_ref_centers(mds)

    # Computes three clusters using KMeans and the reference cluster centers
    logger.info("Finding outliers")
    outliers = find_outliers(mds, centers, center_info, args.outliers_of, args)
    logger.info("  - There are {} outliers for the {} population".format(
        len(outliers),
        args.outliers_of,
    ))

    # Printing the outlier file
    try:
        with open(args.out + ".outliers", 'w') as output_file:
            for sample_id in outliers:
                print >>output_file, "\t".join(sample_id)
    except IOError:
        msg = "{}: can't write file".format(args.out + ".outliers")
        raise ProgramError(msg)

    # Printing the outlier population file
    try:
        with open(args.out + ".population_file_outliers", "w") as output_file:
            for sample_id, population in populations.iteritems():
                if sample_id in outliers:
                    population = "OUTLIER"
                print >>output_file, "\t".join(list(sample_id) + [population])
    except IOError:
        msg = "{}: can't write file".format(
            args.out + ".population_file_outliers",
        )
        raise ProgramError(msg)

    # If there is a summary file in the working directory (for LaTeX), we want
    # to modify it, because it means that this script is run after the pipeline
    # (to modify the multiplier, for example).
    if args.overwrite_tex:
        summary_file = glob(os.path.join(os.getcwd(), "*.summary.tex"))
        if len(summary_file) == 0:
            logger.warning("No TeX summary file found")
        if len(summary_file) > 1:
            raise ProgramError("More than one TeX summary file found")
        summary_file = summary_file[0]

        # Overwriting
        overwrite_tex(summary_file, len(outliers), args)