Ejemplo n.º 1
1
  /**
   * Returns a list of descriptions corresponding to every item matching the search.
   *
   * @return a list of descriptions
   * @throws SQLException thrown if an SQLException occurs
   * @throws ClassNotFoundException thrown if a ClassNotFoundException occurs
   * @throws IOException thrown if an IOException occurs
   * @throws InterruptedException thrown if an InterruptedException occurs
   */
  public ArrayList<String> getPossibilitiesDescriptions()
      throws SQLException, ClassNotFoundException, IOException, InterruptedException {

    Identification identification = peptideShakerGUI.getIdentification();

    // Some necessary pre-caching
    ArrayList<Type> typeList = types.get(jumpType);
    ArrayList<String> keys = possibilities.get(jumpType),
        proteinKeys = new ArrayList<String>(),
        peptideKeys = new ArrayList<String>();
    for (int i = 0; i < keys.size(); i++) {
      String key = keys.get(i);
      if (typeList.get(i) == Type.PROTEIN) {
        proteinKeys.add(key);
      } else if (typeList.get(i) == Type.PEPTIDE) {
        peptideKeys.add(key);
      }
    }
    if (!proteinKeys.isEmpty()) {
      identification.loadProteinMatches(proteinKeys, null, false);
    }
    if (!peptideKeys.isEmpty()) {
      identification.loadPeptideMatches(peptideKeys, null, false);
    }

    ArrayList<String> descriptions = new ArrayList<String>();
    for (int i = 0; i < keys.size(); i++) {
      String key = keys.get(i);
      Type type = typeList.get(i);
      String description = getItemDescription(key, type);
      descriptions.add(description);
    }
    return descriptions;
  }
Ejemplo n.º 2
0
 /**
  * Returns the description of an item.
  *
  * @param key the key of the item
  * @param itemType the type of the item
  * @return the description of an item
  * @throws SQLException thrown if an SQLException occurs
  * @throws ClassNotFoundException thrown if a ClassNotFoundException occurs
  * @throws IOException thrown if an IOException occurs
  * @throws InterruptedException thrown if an InterruptedException occurs
  */
 private String getItemDescription(String key, Type itemType)
     throws IllegalArgumentException, SQLException, IOException, ClassNotFoundException,
         InterruptedException {
   Identification identification = peptideShakerGUI.getIdentification();
   switch (itemType) {
     case PROTEIN:
       ProteinMatch proteinMatch = identification.getProteinMatch(key);
       String mainMatch = proteinMatch.getMainMatch();
       String description = sequenceFactory.getHeader(mainMatch).getSimpleProteinDescription();
       String result = mainMatch;
       for (String accession : ProteinMatch.getAccessions(key)) {
         if (!accession.equals(mainMatch)) {
           if (!result.equals(mainMatch)) {
             result += ", ";
           }
           result += accession;
         }
       }
       result += " - " + description;
       return result;
     case PEPTIDE:
       PeptideMatch peptideMatch = identification.getPeptideMatch(key);
       return peptideShakerGUI
           .getDisplayFeaturesGenerator()
           .getTaggedPeptideSequence(peptideMatch, true, true, true);
     case SPECTRUM:
       return Spectrum.getSpectrumTitle(key) + " (" + Spectrum.getSpectrumFile(key) + ")";
     default:
       return "Unknown";
   }
 }