Computes the frequency of the SNPs using Plink.

    :param prefix: the prefix of the input files.
    :param outPrefix: the prefix of the output files.

    :type prefix: str
    :type outPrefix: str

    :returns: a :py:class:`dict` containing the frequency of each marker.

    Start by computing the frequency of all markers using Plink. Then, it reads
    the output file, and saves the frequency and allele information.

def computeFrequency(prefix, outPrefix):
    """Computes the frequency of the SNPs using Plink.

    :param prefix: the prefix of the input files.
    :param outPrefix: the prefix of the output files.

    :type prefix: str
    :type outPrefix: str

    :returns: a :py:class:`dict` containing the frequency of each marker.

    Start by computing the frequency of all markers using Plink. Then, it reads
    the output file, and saves the frequency and allele information.

    """
    # The plink command
    plinkCommand = ["plink", "--noweb", "--tfile", prefix, "--freq", "--out",
                    outPrefix + ".duplicated_snps"]
    runCommand(plinkCommand)

    # Reading the frequency file
    snpFreq = {}
    try:
        with open(outPrefix + ".duplicated_snps.frq", "r") as inputFile:
            headerIndex = None
            for i, line in enumerate(inputFile):
                row = createRowFromPlinkSpacedOutput(line)
                if i == 0:
                    # This is the header
                    headerIndex = dict([
                        (row[j], j) for j in xrange(len(row))
                    ])

                    # Checking the column titles
                    for columnTitle in ["SNP", "MAF", "A1", "A2"]:
                        if columnTitle not in headerIndex:
                            msg = "%(outPrefix)s.duplicated_snps.frq: no " \
                                  "column called %(columnTitle)s" % locals()
                            raise ProgramError(msg)
                else:
                    # This is data
                    snpName = row[headerIndex["SNP"]]
                    maf = row[headerIndex["MAF"]]
                    a1 = row[headerIndex["A1"]]
                    a2 = row[headerIndex["A2"]]
                    try:
                        if maf == "NA":
                            maf = 0.0
                        else:
                            maf = float(maf)
                    except ValueError:
                        msg = "%(outPrefix)s.duplicated_snps.frq: %(maf)s: " \
                              "not a valid MAF" % locals()
                        raise ProgramError(msg)
                    snpFreq[snpName] = (maf, (a1, a2))
    except IOError:
        msg = "%(outPrefix)s.duplicated_snps.freq: no such file" % locals()
        raise ProgramError(msg)

    return snpFreq