def read_mg_types(mgfile):
    """
    Read the metagenome types from a file where the first four columns
    are [domain, type, species, seqid]. For example, sharks_fish.distance.labelled.tsv
    which is the output from join.pl
    :param mgfile: the sharks_fish.distance.labelled.tsv file
    :return: a dict of all the metagenomes
    """
    
    val = {}
    with open(mgfile, 'r') as f:
        for l in f:
            p=l.strip().split("\t")
            if "Metagenome" in p[0]:
                val[p[3]] = [p[1], p[2]]
    return val