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

    :param argString: the options.

    :type argString: list

    Here are the steps for this function:

    1. Prints the options.
    2. Uses Plink to extract markers according to LD
       (:py:func:`selectSNPsAccordingToLD`).
    3. Checks if there is enough markers after pruning
       (:py:func:`checkNumberOfSNP`). If not, then quits.
    4. Extract markers according to LD (:py:func:`extractSNPs`).
    5. Runs Plink with the ``genome`` option (:py:func:`runGenome`). Quits here
       if the user asker only for the ``genome`` file.
    6. Finds related individuals and gets values for plotting
       (:py:func:`extractRelatedIndividuals`).
    7. Plots ``Z1`` in function of ``IBS2 ratio`` for related individuals
       (:py:func:`plot_related_data`).
    8. Plots ``Z2`` in function of ``IBS2 ratio`` for related individuals
       (:py:func:`plot_related_data`).

    """
    # 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))

    # Run plink
    logger.info("Running Plink to extract SNPs according to LD")
    snpsToExtract = selectSNPsAccordingToLD(args)

    # Check there is enough SNP in the output file
    logger.info("Checking if there are enough extracted SNP")
    if not checkNumberOfSNP(snpsToExtract, args.min_nb_snp):
        # There are not enough markers
        logger.info("There are not enough SNPs: STOPPING NOW!")

    else:
        # Extract the SNPs
        logger.info("Extracting the SNPs using Plink")
        newBfile = extractSNPs(snpsToExtract, args)

        # Run the genome command from plink
        logger.info("Creating the genome file using Plink")
        genomeFileName = runGenome(newBfile, args)

        if args.genome_only:
            # We just want the genome file
            return newBfile

        # Extract related individuals
        logger.info("Finding related individuals from genome file")
        related_data = extractRelatedIndividuals(genomeFileName, args.out,
                                                 args.ibs2_ratio)
        # Are there related samples?
        if related_data is None:
            logger.info("There are no related samples in the dataset")

        else:
            # Plot the related data
            logger.info("Plotting related individuals")
            plot_related_data(related_data["IBS2_RATIO"], related_data["Z1"],
                              related_data["CODE"], r"$Z_1$",
                              args.out + ".related_individuals_z1.png", args)
            plot_related_data(related_data["IBS2_RATIO"], related_data["Z2"],
                              related_data["CODE"], r"$Z_2$",
                              args.out + ".related_individuals_z2.png", args)
def main ( argString = None ) : args = parseArgs ( argString ) checkArgs ( args ) logger . info ( "Options used:" ) for key , value in vars ( args ) . iteritems ( ) : logger . info ( "  --{} {}" . format ( key . replace ( "_" , "-" ) , value ) ) logger . info ( "Running Plink to extract SNPs according to LD" ) snpsToExtract = selectSNPsAccordingToLD ( args ) logger . info ( "Checking if there are enough extracted SNP" ) if not checkNumberOfSNP ( snpsToExtract , args . min_nb_snp ) : logger . info ( "There are not enough SNPs: STOPPING NOW!" ) else : logger . info ( "Extracting the SNPs using Plink" ) newBfile = extractSNPs ( snpsToExtract , args ) logger . info ( "Creating the genome file using Plink" ) genomeFileName = runGenome ( newBfile , args ) if args . genome_only : return newBfile logger . info ( "Finding related individuals from genome file" ) related_data = extractRelatedIndividuals ( genomeFileName , args . out , args . ibs2_ratio ) if related_data is None : logger . info ( "There are no related samples in the dataset" ) else : logger . info ( "Plotting related individuals" ) plot_related_data ( related_data [ "IBS2_RATIO" ] , related_data [ "Z1" ] , related_data [ "CODE" ] , r"$Z_1$" , args . out + ".related_individuals_z1.png" , args ) plot_related_data ( related_data [ "IBS2_RATIO" ] , related_data [ "Z2" ] , related_data [ "CODE" ] , r"$Z_2$" , args . out + ".related_individuals_z2.png" , args )
The main function of this module.

    :param argString: the options.

    :type argString: list

    Here are the steps for this function:

    1. Prints the options.
    2. Uses Plink to extract markers according to LD
       (:py:func:`selectSNPsAccordingToLD`).
    3. Checks if there is enough markers after pruning
       (:py:func:`checkNumberOfSNP`). If not, then quits.
    4. Extract markers according to LD (:py:func:`extractSNPs`).
    5. Runs Plink with the ``genome`` option (:py:func:`runGenome`). Quits here
       if the user asker only for the ``genome`` file.
    6. Finds related individuals and gets values for plotting
       (:py:func:`extractRelatedIndividuals`).
    7. Plots ``Z1`` in function of ``IBS2 ratio`` for related individuals
       (:py:func:`plot_related_data`).
    8. Plots ``Z2`` in function of ``IBS2 ratio`` for related individuals
       (:py:func:`plot_related_data`).