import csv


def read_barcode_lineno_map(stream):
    """Build a map of barcodes to line number from a stream

    This builds a one based dictionary of barcode to line numbers.
    """
    barcodes = {}
    reader = csv.reader(stream, delimiter="\t")
    for i, line in enumerate(reader):
        barcodes[line[0]] = i + 1

    return barcodes