def parse_centrifuge(f, sbj2g=None):
    """Parse a read-to-reference map generated by Centrifuge.

    Parameters
    ----------
    f : file handle
        map file to parse
    sbj2g : dict (optional)
        subject ID to genome ID map

    Returns
    -------
    dict of
        `all`, `norm`, `uniq`

    Notes
    -----
    In a Centrifuge-generated map, columns are:
        readID, seqID, taxID, score, 2ndBestScore, hitLength, queryLength,
        numMatches
    """
    res = {x: {} for x in ('all', 'norm', 'uniq')}
    next(f)  # skip header
    for line in f:
        x = line.rstrip('\r\n').split('\t')
        g = x[1]  # subject Id
        if g == 'unclassified':
            continue
        if sbj2g:
            if g not in sbj2g:
                continue
            g = sbj2g[g]
        n = int(x[7])  # number of matches
        res['all'][g] = res['all'].get(g, 0) + 1
        res['norm'][g] = res['norm'].get(g, 0) + 1 / n
        if n == 1:  # unique match
            res['uniq'][g] = res['uniq'].get(g, 0) + 1
    for g in res['norm']:
        res['norm'][g] = int(res['norm'][g])
    return res