def map_to_2D_dict(mapping_data):
    """ Converts mapping file to 2D dictionary

    INPUT:
        mapping_data -- a tab delimited string from the opened mapping file

    OUTPUT:
        D2 -- a two dimensional dictionary where each sample ID is keyed to a
                    dictionary of meta data containing headers and observations
    """

    lines = [l.strip().split('\t') for l in mapping_data]
    header = lines[0]
    D2 = {}
    for l in lines[1:]:
        inner = {k: v for k, v in zip(header, l)}
        sample_id = inner['#SampleID']
        D2[sample_id] = inner

    return D2