def add_marker_to_qtls(qtlfile, mapfile, outputfile='qtls_with_mk.csv'):
    """This function adds to a list of QTLs, the closest marker to the
    QTL peak.

    :arg qtlfile: a CSV list of all the QTLs found.
        The file should be structured as follow::
            Trait, Linkage group, position, other columns

        The other columns will not matter as long as the first three
        columns are as such.
    :arg mapfile: a CSV representation of the map used for the QTL
        mapping analysis.
        The file should be structured as follow::
            Marker, Linkage group, position
    :kwarg outputfile: the name of the output file in which the list of
        QTLs with their closest marker will be written.

    """
    qtl_list = read_input_file(qtlfile, ',')
    map_list = read_input_file(mapfile, ',')
    if not qtl_list or not map_list:  # pragma: no cover
        return
    qtl_list[0].append('Closest marker')
    qtls = []
    qtls.append(qtl_list[0])
    for qtl in qtl_list[1:]:
        qtl.append(add_marker_to_qtl(qtl, map_list))
        qtls.append(qtl)
    LOG.info('- %s QTLs processed in %s' % (len(qtls), qtlfile))
    write_matrix(outputfile, qtls)
This function adds to a list of QTLs, the closest marker to the
    QTL peak.

    :arg qtlfile: a CSV list of all the QTLs found.
        The file should be structured as follow::
            Trait, Linkage group, position, other columns

        The other columns will not matter as long as the first three
        columns are as such.
    :arg mapfile: a CSV representation of the map used for the QTL
        mapping analysis.
        The file should be structured as follow::
            Marker, Linkage group, position
    :kwarg outputfile: the name of the output file in which the list of
        QTLs with their closest marker will be written.