コード例 #1
0
  /**
   * Updates the available settings according to the opened file. This should be called e.g. after
   * loading a PIA intermediate file
   */
  public void applyLoadedSettings(NodeSettingsRO settings) {

    checkCreatePSMSets.setSelected(
        settings.getBoolean(
            PIASettings.CREATE_PSMSETS.getKey(), PIASettings.CREATE_PSMSETS.getDefaultBoolean()));
    fdrThreshold.setValue(
        settings.getDouble(
            PIASettings.FDR_THRESHOLD.getKey(), PIASettings.FDR_THRESHOLD.getDefaultDouble()));

    if (settings
        .getString(
            PIASettings.ALL_DECOY_STRATEGY.getKey(),
            PIASettings.ALL_DECOY_STRATEGY.getDefaultString())
        .equals(FDRData.DecoyStrategy.ACCESSIONPATTERN.toString())) {
      decoyStrategy_pattern.setSelected(true);
    } else {
      decoyStrategy_searchengine.setSelected(true);
    }

    decoyPattern_pattern.setText(
        settings.getString(
            PIASettings.ALL_DECOY_PATTERN.getKey(),
            PIASettings.ALL_DECOY_PATTERN.getDefaultString()));

    if (settings.getInt(
            PIASettings.ALL_USED_IDENTIFICATIONS.getKey(),
            PIASettings.ALL_USED_IDENTIFICATIONS.getDefaultInteger())
        == 0) {
      usedIdentifications_all.setSelected(true);
    } else {
      usedIdentifications_top.setSelected(true);
    }

    preferredScoresModel.removeAllElements();
    for (String scoreShort :
        settings.getStringArray(
            PIASettings.FDR_PREFERRED_SCORES.getKey(),
            PIASettings.FDR_PREFERRED_SCORES.getDefaultStringArray())) {
      ScoreModelEnum modelType = ScoreModelEnum.getModelByDescription(scoreShort);
      ScoreModel model;

      if (modelType.equals(ScoreModelEnum.UNKNOWN_SCORE)) {
        model = new ScoreModel(0.0, scoreShort, scoreShort);
      } else {
        model = new ScoreModel(0.0, modelType);
      }

      preferredScoresModel.addElement(model);
    }
  }
コード例 #2
0
  /**
   * creates a settings map with the current settings
   *
   * @param key
   * @return
   */
  public Map<String, Object> getSettings() {
    HashMap<String, Object> settings = new HashMap<String, Object>();

    settings.put(PIASettings.CREATE_PSMSETS.getKey(), checkCreatePSMSets.isSelected());
    settings.put(PIASettings.FDR_THRESHOLD.getKey(), (Double) fdrThreshold.getValue());

    settings.put(
        PIASettings.ALL_DECOY_STRATEGY.getKey(),
        decoyStrategyGroup.getSelection().getActionCommand());
    settings.put(PIASettings.ALL_DECOY_PATTERN.getKey(), decoyPattern_pattern.getText());
    settings.put(
        PIASettings.ALL_USED_IDENTIFICATIONS.getKey(),
        Integer.parseInt(usedIdentificationsGroup.getSelection().getActionCommand()));

    String[] preferredScoreShorts = new String[preferredScoresModel.getSize()];
    for (int i = 0; i < preferredScoresModel.getSize(); i++) {
      preferredScoreShorts[i] = preferredScoresModel.getElementAt(i).getShortName();
    }
    settings.put(PIASettings.FDR_PREFERRED_SCORES.getKey(), preferredScoreShorts);

    return settings;
  }