Find proteins which peptides are a sub-set, but not a same-set to other
    proteins.

    :param proteins: iterable, proteins that are tested for being a subset
    :param pepToProts: dict, for each peptide (=key) contains a set of parent
        proteins (=value). For Example {peptide: {protein, ...}, ...}
    :param protToPeps: dict, for each protein (=key) contains a set of
        associated peptides (=value). For Example {protein: {peptide, ...}, ...}
    :returns: a list of pairs of protein and their superset proteins.
        [(protein, {superset protein, ...}), ...]

def _findSubsetProteins(proteins, protToPeps, pepToProts):
    """Find proteins which peptides are a sub-set, but not a same-set to other
    proteins.

    :param proteins: iterable, proteins that are tested for being a subset
    :param pepToProts: dict, for each peptide (=key) contains a set of parent
        proteins (=value). For Example {peptide: {protein, ...}, ...}
    :param protToPeps: dict, for each protein (=key) contains a set of
        associated peptides (=value). For Example {protein: {peptide, ...}, ...}
    :returns: a list of pairs of protein and their superset proteins.
        [(protein, {superset protein, ...}), ...]
    """
    proteinsEqual = lambda prot1, prot2: protToPeps[prot1] == protToPeps[prot2]

    subGroups = list()
    for protein in proteins:
        peptideCounts = Counter()
        for peptide in protToPeps[protein]:
            proteins = pepToProts[peptide]
            peptideCounts.update(proteins)
        peptideCount = peptideCounts.pop(protein)

        superGroups = set()
        for sharingProtein, sharedPeptides in peptideCounts.most_common():
            if peptideCount == sharedPeptides:
                if not proteinsEqual(protein, sharingProtein):
                    superGroups.add(sharingProtein)
            else:
                break
        if superGroups:
            subGroups.append((protein, superGroups))
    return subGroups