Runs the bafRegress function.

    :param filenames: the set of all sample files.
    :param out_prefix: the output prefix.
    :param extract_filename: the name of the markers to extract.
    :param freq_filename: the name of the file containing the frequency.
    :param options: the other options.

    :type filenames: set
    :type out_prefix: str
    :type extract_filename: str
    :type freq_filename: str
    :type options: argparse.Namespace

def run_bafRegress(filenames, out_prefix, extract_filename, freq_filename,
                   options):
    """Runs the bafRegress function.

    :param filenames: the set of all sample files.
    :param out_prefix: the output prefix.
    :param extract_filename: the name of the markers to extract.
    :param freq_filename: the name of the file containing the frequency.
    :param options: the other options.

    :type filenames: set
    :type out_prefix: str
    :type extract_filename: str
    :type freq_filename: str
    :type options: argparse.Namespace

    """
    # The command
    command = [
        "bafRegress.py",
        "estimate",
        "--freqfile", freq_filename,
        "--freqcol", "2,5",
        "--extract", extract_filename,
        "--colsample", options.colsample,
        "--colmarker", options.colmarker,
        "--colbaf", options.colbaf,
        "--colab1", options.colab1,
        "--colab2", options.colab2,
    ]
    command.extend(filenames)

    output = None
    try:
        output = subprocess.check_output(command, stderr=subprocess.STDOUT,
                                         shell=False)
    except subprocess.CalledProcessError as exc:
        raise ProgramError("bafRegress.py: couldn't run "
                           "bafRegress.py\n{}".format(exc.output))

    # Saving the output
    try:
        with open(out_prefix + ".bafRegress", "w") as o_file:
            o_file.write(output)
    except IOError:
        raise ProgramError("{}: cannot write file".format(
            out_prefix + ".bafRegress",
        ))