def read_pgroups(in_file):
    """Read HLAs and the pgroups they fall in.
    """
    out = {}
    with open(in_file) as in_handle:
        for line in (l for l in in_handle if not l.startswith("#")):
            locus, alleles, group = line.strip().split(";")
            for allele in alleles.split("/"):
                out["HLA-%s%s" % (locus, allele)] = group
    return out
def read_pgroups ( in_file ) : out = { } with open ( in_file ) as in_handle : for line in ( l for l in in_handle if not l . startswith ( "#" ) ) : locus , alleles , group = line . strip ( ) . split ( ";" ) for allele in alleles . split ( "/" ) : out [ "HLA-%s%s" % ( locus , allele ) ] = group return out
Read HLAs and the pgroups they fall in.