def parse_media_file(mediafile):
    """
    Get the media compounds present
    :param mediafile: filepath to the tab-delimited media file.
    :return: dictionary with first level of keys as compound IDs. The values are another dictionary of
    compound name, formula, and charge.
    """

    readmedia = {}
    with open(mediafile, "r") as f:
        for li, ls in enumerate(f):
            # Skip header line
            if li == 0:
                continue
            ls = ls.rstrip("\n")
            cpid, name, formula, charge = ls.split("\t")
            readmedia[cpid] = {"name": name, "formula": formula, "charge": charge}
    return readmedia