public void appendPeptides(Appendable out) {
    try {
      List<String> proteins = new ArrayList<String>(proteinToHits.keySet());
      Collections.sort(proteins);
      for (String protein : proteins) {
        Set<IdentifiedPSM> pps = proteinToHits.get(protein);
        List<IdentifiedPSM> peptides = new ArrayList<IdentifiedPSM>(pps);
        Collections.sort(peptides);

        for (IdentifiedPSM psm : peptides) {
          Polypeptide peptide = (Polypeptide) psm.getPeptide(); // .getUnModified();
          out.append(peptide.toString());
          out.append("\t");
          out.append(psm.getId());
          out.append("\t");
          out.append(protein);
          out.append("\t");
          String rt = String.format("%11.3f", peptide.getRetentionTime()).trim();
          out.append(rt);
          out.append("\n");
        }
      }
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
 public static IdentifiedPSM processPeptide(final String line, double retentionTime, String id) {
   String peptide = XMLUtil.extractAttribute(line, "peptide");
   if (peptide == null) throw new IllegalArgumentException("bad line " + line);
   Polypeptide polypeptide = Polypeptide.fromString(peptide);
   polypeptide.setRetentionTime(retentionTime);
   return new IdentifiedPSM(id, polypeptide);
 }