Beispiel #1
0
  /**
   * 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 = reporterGUI.getIdentification();

    // some necessary pre-caching
    ArrayList<Type> typeList = types.get(jumpType);
    ArrayList<String> keys = possibilities.get(jumpType);
    ArrayList<String> proteinKeys = 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);
      }
    }
    if (!proteinKeys.isEmpty()) {
      identification.loadProteinMatches(proteinKeys, 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;
  }
Beispiel #2
0
  /** Updates the item selection in the selected tab. */
  public void updateSelectionInTab() {

    indexLabel.setForeground(Color.BLACK);

    if (types.get(jumpType).get(currentSelection.get(jumpType)) == Type.PROTEIN) {
      String selectedProtein = possibilities.get(jumpType).get(currentSelection.get(jumpType));
      ArrayList<String> selectedProteins = new ArrayList<String>();
      selectedProteins.add(selectedProtein);
      reporterGUI.minimizeChart();
      reporterGUI.setSelectedProteins(selectedProteins, true, true);
    }

    String label =
        "("
            + (currentSelection.get(jumpType) + 1)
            + " of "
            + possibilities.get(jumpType).size()
            + ")";
    indexLabel.setText(label);
    lastLabel.put(jumpType, label);
  }
Beispiel #3
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 = reporterGUI.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;
     default:
       return "Unknown";
   }
 }