Ejemplo n.º 1
0
  @Override
  public void addData(Peptide peptide) {

    String sequence = peptide.getSequence();
    int seqLength = sequence.length();
    List<Modification> mods = peptide.getModifications();
    if (mods != null) {
      for (Modification mod : mods) {
        List<Object> content = new ArrayList<Object>();
        // row number
        content.add(this.getRowCount() + 1);
        // accession
        content.add(mod.getAccession());
        // name
        content.add(mod.getName());
        // location
        int location = mod.getLocation();
        if (location == 0) {
          location = 1;
          content.add("N Terminal");
        } else if (location == seqLength) {
          content.add("C Terminal");
        } else if (location == -1) {
          content.add(null);
        } else {
          content.add(location + "");
        }
        // modified residue
        if (sequence.length() >= location && location > 0) {
          content.add(sequence.charAt(location - 1));
        } else {
          content.add(null);
        }
        // mono mass
        List<Double> monoMasses = mod.getMonoMassDeltas();
        if (monoMasses != null && !monoMasses.isEmpty()) {
          content.add(monoMasses.get(0));
        } else {
          content.add(null);
        }
        // average mass
        List<Double> avgMasses = mod.getAvgMassDeltas();
        if (avgMasses != null && !avgMasses.isEmpty()) {
          content.add(avgMasses.get(0));
        } else {
          content.add(null);
        }
        // ptm database
        content.add(mod.getModDatabase());
        // ptm database version
        content.add(mod.getModDatabaseVersion());
        contents.add(content);
      }
    }
  }
 private String getToolTipText(java.util.List<Modification> mods, int seqLength) {
   StringBuilder tip = new StringBuilder();
   if (mods != null && !mods.isEmpty()) {
     tip.append("<html>");
     for (Modification mod : mods) {
       tip.append("<p>");
       tip.append("<b><font size=\"3\" color=\"red\">");
       tip.append(mod.getAccession());
       tip.append("</font></b><br>");
       tip.append("<b>Name</b>:");
       tip.append(mod.getName());
       tip.append("<br>");
       tip.append("<b>Location</b>:");
       int location = mod.getLocation();
       if (location == 0) {
         tip.append("N-Terminal");
       } else if (location == seqLength) {
         tip.append("C-Terminal");
       } else {
         tip.append(location);
       }
       tip.append("<br>");
       java.util.List<Double> avgs = mod.getAvgMassDeltas();
       if (avgs != null) {
         for (Double avg : avgs) {
           tip.append("<b>Average Mass Delta</b>:");
           tip.append(avg);
           tip.append("<br>");
         }
       }
       java.util.List<Double> monos = mod.getMonoMassDeltas();
       if (monos != null) {
         for (Double mono : monos) {
           tip.append("<b>Mono Mass Delta</b>:");
           tip.append(mono);
           tip.append("<br>");
         }
       }
       tip.append("</p>");
       tip.append("<br>");
     }
     tip.append("</html>");
   }
   return tip.toString();
 }