use of com.compomics.util.experiment.identification.filtering.PsmFilter in project peptide-shaker by compomics.
the class FiltersDialog method starredPsmTableKeyReleased.
// GEN-LAST:event_hiddenPeptidesTableKeyReleased
/**
* Update the starred PSMs table.
*
* @param evt the key event
*/
private void starredPsmTableKeyReleased(java.awt.event.KeyEvent evt) {
// GEN-FIRST:event_starredPsmTableKeyReleased
int column = starredPsmTable.getSelectedColumn();
int row = starredPsmTable.getSelectedRow();
if (column == 2) {
String newName = (String) starredPsmTable.getValueAt(row, column);
ArrayList<String> others = new ArrayList<>();
for (int i = 0; i < starredPsmTable.getRowCount(); i++) {
if (i != row) {
others.add((String) starredPsmTable.getValueAt(i, column));
}
}
if (others.contains(newName)) {
int outcome = JOptionPane.YES_OPTION;
if (peptideShakerGUI.getFilterParameters().filterExists(newName)) {
outcome = JOptionPane.showConfirmDialog(this, "Should psm filter " + newName + " be overwritten?", "Selected Name Already Exists", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
}
if (outcome != JOptionPane.YES_OPTION) {
for (PsmFilter psmFilter : psmStarFilters.values()) {
if (!others.contains(psmFilter.getName())) {
starredPsmTable.setValueAt(psmFilter.getName(), row, column);
}
}
return;
}
}
for (PsmFilter psmFilter : psmStarFilters.values()) {
if (!others.contains(psmFilter.getName())) {
String oldName = psmFilter.getName();
psmFilter.setName(newName);
psmStarFilters.remove(oldName);
psmStarFilters.put(newName, psmFilter);
}
}
}
if (column == 3) {
String name = (String) starredPsmTable.getValueAt(row, 2);
psmStarFilters.get(name).setDescription((String) starredPsmTable.getValueAt(row, column));
}
if (starredPsmTable.isEditing()) {
editStarredPsm.setEnabled(false);
deleteStarredPsm.setEnabled(false);
} else if (starredPsmTable.getSelectedRow() != -1) {
editStarredPsm.setEnabled(true);
deleteStarredPsm.setEnabled(true);
}
}
use of com.compomics.util.experiment.identification.filtering.PsmFilter in project peptide-shaker by compomics.
the class FiltersDialog method hiddenPsmTableKeyReleased.
// GEN-LAST:event_starredPsmTableKeyReleased
/**
* Update the hidden PSMs table.
*
* @param evt the key event
*/
private void hiddenPsmTableKeyReleased(java.awt.event.KeyEvent evt) {
// GEN-FIRST:event_hiddenPsmTableKeyReleased
int column = hiddenPsmTable.getSelectedColumn();
int row = hiddenPsmTable.getSelectedRow();
if (column == 2) {
String newName = (String) hiddenPsmTable.getValueAt(row, column);
ArrayList<String> others = new ArrayList<>();
for (int i = 0; i < hiddenPsmTable.getRowCount(); i++) {
if (i != row) {
others.add((String) hiddenPsmTable.getValueAt(i, column));
}
}
if (others.contains(newName)) {
int outcome = JOptionPane.YES_OPTION;
if (peptideShakerGUI.getFilterParameters().filterExists(newName)) {
outcome = JOptionPane.showConfirmDialog(this, "Should psm filter " + newName + " be overwritten?", "Selected Name Already Exists", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
}
if (outcome != JOptionPane.YES_OPTION) {
for (PsmFilter psmFilter : psmHideFilters.values()) {
if (!others.contains(psmFilter.getName())) {
hiddenPsmTable.setValueAt(psmFilter.getName(), row, column);
}
}
return;
}
}
for (PsmFilter psmFilter : psmHideFilters.values()) {
if (!others.contains(psmFilter.getName())) {
String oldName = psmFilter.getName();
psmFilter.setName(newName);
psmHideFilters.remove(oldName);
psmHideFilters.put(newName, psmFilter);
}
}
}
if (column == 3) {
String name = (String) hiddenPsmTable.getValueAt(row, 2);
psmHideFilters.get(name).setDescription((String) hiddenPsmTable.getValueAt(row, column));
}
if (row != -1) {
editHiddenPsm.setEnabled(true);
deleteHiddenPsm.setEnabled(true);
}
if (hiddenPsmTable.isEditing()) {
editHiddenPsm.setEnabled(false);
deleteHiddenPsm.setEnabled(false);
} else if (hiddenPsmTable.getSelectedRow() != -1) {
editHiddenPsm.setEnabled(true);
deleteHiddenPsm.setEnabled(true);
}
}
use of com.compomics.util.experiment.identification.filtering.PsmFilter in project peptide-shaker by compomics.
the class FiltersDialog method editStarredPsmActionPerformed.
// GEN-LAST:event_editHiddenPeptidesActionPerformed
/**
* Edit a starred PSM.
*
* @param evt the action event
*/
private void editStarredPsmActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_editStarredPsmActionPerformed
int row = starredPsmTable.getSelectedRow();
if (row >= 0) {
String selectedFilterName = (String) starredPsmTable.getValueAt(row, 2);
PsmFilter psmFilter = psmStarFilters.get(selectedFilterName);
editFilter(psmFilter);
updateTables();
}
}
use of com.compomics.util.experiment.identification.filtering.PsmFilter in project peptide-shaker by compomics.
the class FiltersDialog method addHiddenPsmActionPerformed.
// GEN-LAST:event_addHiddenPeptidesActionPerformed
/**
* Open the FindDialog to add/edit a filter.
*
* @param evt the action event
*/
private void addHiddenPsmActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_addHiddenPsmActionPerformed
PsmFilter newFilter = (PsmFilter) createPsmFilter();
if (newFilter != null) {
String filterName = newFilter.getName();
if (psmHideFilters.containsKey(filterName)) {
int value = JOptionPane.showConfirmDialog(this, "A filter named " + filterName + " already exists. Overwrite?", "Overwrite Filter?", JOptionPane.YES_NO_OPTION);
if (value == JOptionPane.NO_OPTION) {
return;
}
}
psmHideFilters.put(filterName, newFilter);
updateTables();
}
}
use of com.compomics.util.experiment.identification.filtering.PsmFilter in project peptide-shaker by compomics.
the class FiltersDialog method addStarredPsmActionPerformed.
// GEN-LAST:event_hiddenPsmTableMouseReleased
/**
* Open the FindDialog to add/edit a filter.
*
* @param evt the action event
*/
private void addStarredPsmActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_addStarredPsmActionPerformed
PsmFilter newFilter = (PsmFilter) createPsmFilter();
if (newFilter != null) {
String filterName = newFilter.getName();
if (psmStarFilters.containsKey(filterName)) {
int value = JOptionPane.showConfirmDialog(this, "A filter named " + filterName + " already exists. Overwrite?", "Overwrite Filter?", JOptionPane.YES_NO_OPTION);
if (value == JOptionPane.NO_OPTION) {
return;
}
}
psmStarFilters.put(filterName, newFilter);
updateTables();
}
}
Aggregations