def get_qtls_from_mapqtl_data(matrix, threshold, inputfile):
    """Extract the QTLs found by MapQTL reading its file.
    This assume that there is only one QTL per linkage group.

    :arg matrix, the MapQTL file read in memory
    :arg threshold, threshold used to determine if a given LOD value is
        reflective the presence of a QTL.
    :arg inputfile, name of the inputfile in which the QTLs have been
        found

    """
    trait_name = inputfile.split(')_', 1)[1].split('.mqo')[0]
    qtls = []
    qtl = None
    for entry in matrix[1:]:
        if qtl is None:
            qtl = entry
        if qtl[1] != entry[1]:
            if float(qtl[4]) > float(threshold):
                qtl[0] = trait_name
                qtls.append(qtl)
            qtl = entry
        if entry[4] == '':  # pragma: no cover
            entry[4] = 0
        if qtl[4] == '':  # pragma: no cover
            qtl[4] = 0
        if float(entry[4]) > float(qtl[4]):
            qtl = entry

    if float(qtl[4]) > float(threshold):
        qtl[0] = trait_name
        if qtl not in qtls:
            qtls.append(qtl)

    return qtls