/** * 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); } }
/** * Creates a panel, which contains the settings for the wizard on PSM level * * @return */ private JPanel initializeSettingsPanel() { JPanel psmPanel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(5, 5, 5, 5); // >> create PSM sets and general FDR threshold --- c.gridx = 0; c.gridy = 0; checkCreatePSMSets = new JCheckBox("Create PSM sets"); checkCreatePSMSets.setSelected(true); psmPanel.add(checkCreatePSMSets, c); c.gridx = 0; c.gridy = 1; psmPanel.add(new JLabel("FDR threshold:"), c); NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMaximumFractionDigits(32); fdrThreshold = new JFormattedTextField(nf); fdrThreshold.setValue(0.01); c.gridx = 1; c.gridy = 1; psmPanel.add(fdrThreshold, c); // << create PSM sets and general FDR threshold --- // >> how to define decoys ------------------------ c.gridx = 0; c.gridy = 2; psmPanel.add(new JLabel("How to define decoys:"), c); decoyStrategy_pattern = new JRadioButton("accession pattern"); decoyStrategy_pattern.setActionCommand(FDRData.DecoyStrategy.ACCESSIONPATTERN.toString()); decoyStrategy_pattern.addActionListener(this); decoyStrategy_searchengine = new JRadioButton("by searchengine"); decoyStrategy_searchengine.setActionCommand(FDRData.DecoyStrategy.SEARCHENGINE.toString()); decoyStrategy_searchengine.addActionListener(this); decoyStrategyGroup = new ButtonGroup(); decoyStrategyGroup.add(decoyStrategy_pattern); decoyStrategyGroup.add(decoyStrategy_searchengine); c.insets = new Insets(0, 5, 0, 5); c.gridx = 1; c.gridy = 2; psmPanel.add(decoyStrategy_pattern, c); c.gridx = 1; c.gridy = 3; psmPanel.add(decoyStrategy_searchengine, c); c.insets = new Insets(5, 5, 5, 5); // << how to define decoys ------------------------ // >> decoy pattern ------------------------------- c.gridx = 0; c.gridy = 4; psmPanel.add(new JLabel("Decoy pattern:"), c); decoyPattern_pattern = new JTextField("rev_.*", 10); c.gridx = 1; c.gridy = 4; psmPanel.add(decoyPattern_pattern, c); // << decoy pattern ------------------------------- // >> used identifications ------------------------ c.gridx = 0; c.gridy = 5; psmPanel.add(new JLabel("Used identifications:"), c); usedIdentifications_top = new JRadioButton("only top identification"); usedIdentifications_top.setActionCommand("1"); usedIdentifications_top.setSelected(true); usedIdentifications_all = new JRadioButton("all identifications"); usedIdentifications_all.setActionCommand("0"); usedIdentificationsGroup = new ButtonGroup(); usedIdentificationsGroup.add(usedIdentifications_top); usedIdentificationsGroup.add(usedIdentifications_all); c.insets = new Insets(0, 5, 0, 5); c.gridx = 1; c.gridy = 5; psmPanel.add(usedIdentifications_top, c); c.gridx = 1; c.gridy = 6; psmPanel.add(usedIdentifications_all, c); c.insets = new Insets(5, 5, 5, 5); // << used identifications ------------------------ // >> Preferred score(s) -------------------------- c.gridx = 0; c.gridy = 7; psmPanel.add(new JLabel("Preferred score(s):"), c); JPanel fdrScorePanel = new JPanel(new GridBagLayout()); GridBagConstraints layoutFdrScorePanel = new GridBagConstraints(); layoutFdrScorePanel.fill = GridBagConstraints.HORIZONTAL; layoutFdrScorePanel.gridx = 0; layoutFdrScorePanel.gridy = 0; fdrScorePanel.add(new JLabel("Available PSM scores"), layoutFdrScorePanel); availableScoresModel = new DefaultListModel<ScoreModel>(); availableScoresList = new JList<ScoreModel>(availableScoresModel); availableScoresList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); availableScoresList.setLayoutOrientation(JList.VERTICAL); availableScoresList.setVisibleRowCount(-1); availableScoresList.setCellRenderer(new ScoreNameListCellRenderer()); JScrollPane listScroller = new JScrollPane(availableScoresList); listScroller.setPreferredSize(new Dimension(200, 100)); layoutFdrScorePanel.gridx = 0; layoutFdrScorePanel.gridy = 1; fdrScorePanel.add(listScroller, layoutFdrScorePanel); layoutFdrScorePanel.gridx = 2; layoutFdrScorePanel.gridy = 0; fdrScorePanel.add(new JLabel("Preferred PSM scores"), layoutFdrScorePanel); preferredScoresModel = new DefaultListModel<ScoreModel>(); preferredScoresList = new JList<ScoreModel>(preferredScoresModel); preferredScoresList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); preferredScoresList.setLayoutOrientation(JList.VERTICAL); preferredScoresList.setVisibleRowCount(-1); preferredScoresList.setCellRenderer(new ScoreNameListCellRenderer()); listScroller = new JScrollPane(preferredScoresList); listScroller.setPreferredSize(new Dimension(200, 100)); layoutFdrScorePanel.gridx = 2; layoutFdrScorePanel.gridy = 1; fdrScorePanel.add(listScroller, layoutFdrScorePanel); JPanel psmScoreButtonsPanel = new JPanel(); psmScoreButtonsPanel.setLayout(new BoxLayout(psmScoreButtonsPanel, BoxLayout.Y_AXIS)); psmScoreButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); addToPreferred_button = new JButton("Add >>"); addToPreferred_button.setAlignmentX(Component.CENTER_ALIGNMENT); addToPreferred_button.addActionListener(this); psmScoreButtonsPanel.add(addToPreferred_button); psmScoreButtonsPanel.add(Box.createRigidArea(new Dimension(0, 5))); removeFromPreferred_button = new JButton("Remove <<"); removeFromPreferred_button.setAlignmentX(Component.CENTER_ALIGNMENT); removeFromPreferred_button.addActionListener(this); psmScoreButtonsPanel.add(removeFromPreferred_button); layoutFdrScorePanel.gridx = 1; layoutFdrScorePanel.gridy = 1; fdrScorePanel.add(psmScoreButtonsPanel, layoutFdrScorePanel); c.gridx = 1; c.gridy = 7; psmPanel.add(fdrScorePanel, c); // << Preferred score(s) -------------------------- // >> calculate the FDR --------------------------- calculatePSMFDR = new JButton("Calculate FDR"); calculatePSMFDR.addActionListener(this); c.gridx = 0; c.gridy = 8; c.fill = GridBagConstraints.CENTER; c.gridwidth = 2; psmPanel.add(calculatePSMFDR, c); // >> calculate the FDR --------------------------- updateAvailableSettings(); return psmPanel; }