public void setPeptideId(final String pPeptideId) {
    if (m_Peptide != null || m_PeptideId != null)
      throw new IllegalStateException("Cannot reset peptide"); // ToDo change
    m_PeptideId = pPeptideId;
    IMainData main = getMainData();
    if (main != null) {
      //   RawPeptideScan rawScan = main.getRawScan(getId());
      //    pMeasured = rawScan;

      ITaxonomy taxonomy = main.getTaxonomy();
      if (taxonomy != null) {
        String peptideId = getPeptideId();
        m_Peptide = taxonomy.getPeptideById(peptideId);
        if (m_Peptide == null)
          m_Peptide = Polypeptide.fromString(peptideId); // key may be all we need
      }
    } else {
      m_Peptide = Polypeptide.fromString(getPeptideId());
    }
    if (m_Peptide != null) {
      IPeptideDigester digester = PeptideBondDigester.getDefaultDigester();
      int missedCleavages = digester.probableNumberMissedCleavages(m_Peptide);
      ((Polypeptide) m_Peptide).setMissedCleavages(missedCleavages);
    }
  }
  /**
   * this is what a Mapper does
   *
   * @param keyin
   * @param valuein
   * @return iterator over mapped key values
   */
  @Nonnull
  @Override
  public Iterable<KeyValueObject<String, String>> mapValues(
      @Nonnull final String annotation, @Nonnull final String sequence) {

    List<KeyValueObject<String, String>> holder = new ArrayList<KeyValueObject<String, String>>();

    IPeptideDigester digester = getDigester();
    IProtein prot = Protein.getProtein(annotation, annotation, sequence, null);

    // do a boolean for a peptide belonging to a decoy protein, but use the public isDecoy
    // boolean/method in Protein class

    boolean isDecoy = prot.isDecoy();

    IPolypeptide[] pps = digester.digest(prot);
    PeptideModification[] modifications1 = getModifications();
    for (int i = 0; i < pps.length; i++) {
      IPolypeptide pp = pps[i];

      if (!pp.isValid()) continue;

      // hadoop write intermediate seq finder
      writePeptide(pp, holder);

      //   if(isDecoy)
      //       continue; // skip the rest of the loop

      // if it is decoy, don't add modifications to it
      if (!isDecoy || isGenerateDecoysForModifiedPeptides()) {
        //  generate modified peptides and add to the output
        IModifiedPeptide[] modifications =
            ModifiedPolypeptide.buildModifications(pp, modifications1);
        for (int m = 0; m < modifications.length; m++) {
          IModifiedPeptide modification = modifications[m];
          writePeptide(modification, holder);
        }
      }
    }

    boolean semiTryptic = digester.isSemiTryptic();
    if (semiTryptic) {
      IPolypeptide[] semipps = digester.addSemiCleavages(prot);
      for (int j = 0; j < semipps.length; j++) {
        IPolypeptide semipp = semipps[j];
        if (!semipp.isValid()) continue;
        writePeptide(semipp, holder);
        IModifiedPeptide[] modifications =
            ModifiedPolypeptide.buildModifications(semipp, modifications1);
        for (int k = 0; k < modifications.length; k++) {
          IModifiedPeptide modification = modifications[k];
          writePeptide(modification, holder);
        }
      }
    }
    return holder;
  }