def alignment_mapping_from_file(f, char_mapping=DNA):
    """
    Create a mapping from a file of alignment columns.
    """
    columns, symbols = [], []
    for line in f:
        column, symbol = line.split()
        columns.append(column)
        symbols.append(int(symbol))

    align_count = len(columns[0])

    mapping = IntToIntMapping(char_mapping.get_out_size() ** align_count)

    for column, symbol in zip(columns, symbols):
        index = char_mapping.translate_list(list(column))[0]
        mapping.set_mapping(index, symbol)

    return align_count, mapping