nodes: 0, module; 1, function_definition; 2, function_name:_mergeProteinEntries; 3, parameters; 4, block; 5, identifier:proteinLists; 6, identifier:protToPeps; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Returns a new "protToPeps" dictionary with entries merged that are
      present in proteinLists.
  
      NOTE:
          The key of the merged entry is a tuple of the sorted protein keys. This
          behaviour might change in the future; the tuple might be replaced by
          simply one of the protein entries which is then representative for all.
  
      :param proteinLists: a list of protein groups that will be merged
          [{protein, ...}, ...]
      :param protToPeps: dict, for each protein (=key) contains a set of
          associated peptides (=value). For Example {protein: {peptide, ...}, ...}
      :returns: dict, {protein: set([peptid, ...])}
      """; 12, assignment; 13, identifier:proteins; 14, identifier:proteinLists; 15, block; 16, identifier:mergedProtToPeps; 17, identifier:mergedProtToPeps; 18, call; 19, for_statement; 20, expression_statement; 21, expression_statement; 22, identifier:dict; 23, argument_list; 24, identifier:protein; 25, identifier:proteins; 26, block; 27, assignment; 28, assignment; 29, identifier:protToPeps; 30, expression_statement; 31, identifier:mergedProtein; 32, call; 33, subscript; 34, identifier:peptides; 35, assignment; 36, identifier:tuple; 37, argument_list; 38, identifier:mergedProtToPeps; 39, identifier:mergedProtein; 40, identifier:peptides; 41, call; 42, call; 43, attribute; 44, argument_list; 45, identifier:sorted; 46, argument_list; 47, identifier:mergedProtToPeps; 48, identifier:pop; 49, identifier:protein; 50, identifier:proteins
code: def _mergeProteinEntries(proteinLists, protToPeps):
      """Returns a new "protToPeps" dictionary with entries merged that are
      present in proteinLists.
  
      NOTE:
          The key of the merged entry is a tuple of the sorted protein keys. This
          behaviour might change in the future; the tuple might be replaced by
          simply one of the protein entries which is then representative for all.
  
      :param proteinLists: a list of protein groups that will be merged
          [{protein, ...}, ...]
      :param protToPeps: dict, for each protein (=key) contains a set of
          associated peptides (=value). For Example {protein: {peptide, ...}, ...}
      :returns: dict, {protein: set([peptid, ...])}
      """
      mergedProtToPeps = dict(protToPeps)
      for proteins in proteinLists:
          for protein in proteins:
              peptides = mergedProtToPeps.pop(protein)
          mergedProtein = tuple(sorted(proteins))
          mergedProtToPeps[mergedProtein] = peptides
      return mergedProtToPeps