def matches_truth(call_alleles, truth_alleles, data):
    """Flexibly check if truth and call alleles match, using p-groups.
    """
    if not truth_alleles:
        return ""
    else:
        def _remove_p(x):
            return x[:-1] if x.endswith("P") else x
        t_cmp = set([_remove_p(hla_groups.hla_protein(x, data)) for x in truth_alleles])
        c_cmp = set([_remove_p(hla_groups.hla_protein(x, data)) for x in call_alleles])
        return "yes" if len(t_cmp.intersection(c_cmp)) == len(t_cmp) else "no"