Search in sources :

Example 1 with ProteinFilter

use of com.compomics.util.experiment.identification.filtering.ProteinFilter in project peptide-shaker by compomics.

the class FiltersDialog method addStarredProteinActionPerformed.

// GEN-LAST:event_addStarredPsmActionPerformed
/**
 * Open the FindDialog to add/edit a filter.
 *
 * @param evt the action event
 */
private void addStarredProteinActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_addStarredProteinActionPerformed
    ProteinFilter newFilter = (ProteinFilter) createProteinFilter();
    if (newFilter != null) {
        String filterName = newFilter.getName();
        if (proteinStarFilters.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;
            }
        }
        proteinStarFilters.put(filterName, newFilter);
        updateTables();
    }
}
Also used : ProteinFilter(com.compomics.util.experiment.identification.filtering.ProteinFilter)

Example 2 with ProteinFilter

use of com.compomics.util.experiment.identification.filtering.ProteinFilter in project peptide-shaker by compomics.

the class FiltersDialog method editHiddenProteinActionPerformed.

// GEN-LAST:event_editStarredProteinActionPerformed
/**
 * Edit a hidden protein.
 *
 * @param evt the action event
 */
private void editHiddenProteinActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_editHiddenProteinActionPerformed
    int row = hiddenProteinsTable.getSelectedRow();
    if (row >= 0) {
        String selectedFilterName = (String) hiddenProteinsTable.getValueAt(row, 2);
        ProteinFilter proteinFilter = proteinHideFilters.get(selectedFilterName);
        editFilter(proteinFilter);
        updateTables();
    }
}
Also used : ProteinFilter(com.compomics.util.experiment.identification.filtering.ProteinFilter)

Example 3 with ProteinFilter

use of com.compomics.util.experiment.identification.filtering.ProteinFilter in project peptide-shaker by compomics.

the class FiltersDialog method editStarredProteinActionPerformed.

// GEN-LAST:event_clearHiddenPsmActionPerformed
/**
 * Edit a starred protein.
 *
 * @param evt the action event
 */
private void editStarredProteinActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_editStarredProteinActionPerformed
    int row = starredProteinsTable.getSelectedRow();
    if (row >= 0) {
        String selectedFilterName = (String) starredProteinsTable.getValueAt(row, 2);
        ProteinFilter proteinFilter = proteinStarFilters.get(selectedFilterName);
        editFilter(proteinFilter);
        updateTables();
    }
}
Also used : ProteinFilter(com.compomics.util.experiment.identification.filtering.ProteinFilter)

Example 4 with ProteinFilter

use of com.compomics.util.experiment.identification.filtering.ProteinFilter in project peptide-shaker by compomics.

the class FiltersDialog method hiddenProteinsTableKeyReleased.

// GEN-LAST:event_editHiddenPsmActionPerformed
/**
 * Update the hidden proteins table.
 *
 * @param evt the key event
 */
private void hiddenProteinsTableKeyReleased(java.awt.event.KeyEvent evt) {
    // GEN-FIRST:event_hiddenProteinsTableKeyReleased
    int column = hiddenProteinsTable.getSelectedColumn();
    int row = hiddenProteinsTable.getSelectedRow();
    if (column == 2) {
        String newName = (String) hiddenProteinsTable.getValueAt(row, column);
        ArrayList<String> others = new ArrayList<>();
        for (int i = 0; i < hiddenProteinsTable.getRowCount(); i++) {
            if (i != row) {
                others.add((String) hiddenProteinsTable.getValueAt(i, column));
            }
        }
        if (others.contains(newName)) {
            int outcome = JOptionPane.YES_OPTION;
            if (peptideShakerGUI.getFilterParameters().filterExists(newName)) {
                outcome = JOptionPane.showConfirmDialog(this, "Should protein filter " + newName + " be overwritten?", "Selected Name Already Exists", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
            }
            if (outcome != JOptionPane.YES_OPTION) {
                for (ProteinFilter proteinFilter : proteinHideFilters.values()) {
                    if (!others.contains(proteinFilter.getName())) {
                        hiddenProteinsTable.setValueAt(proteinFilter.getName(), row, column);
                    }
                }
                return;
            }
        }
        for (ProteinFilter proteinFilter : proteinHideFilters.values()) {
            if (!others.contains(proteinFilter.getName())) {
                String oldName = proteinFilter.getName();
                proteinFilter.setName(newName);
                proteinHideFilters.remove(oldName);
                proteinHideFilters.put(newName, proteinFilter);
            }
        }
    }
    if (column == 3) {
        String name = (String) hiddenProteinsTable.getValueAt(row, 2);
        proteinHideFilters.get(name).setDescription((String) hiddenProteinsTable.getValueAt(row, column));
    }
    if (hiddenProteinsTable.isEditing()) {
        editHiddenProtein.setEnabled(false);
        deleteHiddenProtein.setEnabled(false);
    } else if (hiddenProteinsTable.getSelectedRow() != -1) {
        editHiddenProtein.setEnabled(true);
        deleteHiddenProtein.setEnabled(true);
    }
}
Also used : ArrayList(java.util.ArrayList) ProteinFilter(com.compomics.util.experiment.identification.filtering.ProteinFilter)

Example 5 with ProteinFilter

use of com.compomics.util.experiment.identification.filtering.ProteinFilter in project peptide-shaker by compomics.

the class FiltersDialog method starredProteinsTableKeyReleased.

// GEN-LAST:event_okButtonActionPerformed
/**
 * Update the starred proteins table.
 *
 * @param evt the key event
 */
private void starredProteinsTableKeyReleased(java.awt.event.KeyEvent evt) {
    // GEN-FIRST:event_starredProteinsTableKeyReleased
    int column = starredProteinsTable.getSelectedColumn();
    int row = starredProteinsTable.getSelectedRow();
    if (column == 2) {
        String newName = (String) starredProteinsTable.getValueAt(row, column);
        ArrayList<String> others = new ArrayList<>();
        for (int i = 0; i < starredProteinsTable.getRowCount(); i++) {
            if (i != row) {
                others.add((String) starredProteinsTable.getValueAt(i, column));
            }
        }
        if (others.contains(newName)) {
            int outcome = JOptionPane.YES_OPTION;
            if (peptideShakerGUI.getFilterParameters().filterExists(newName)) {
                outcome = JOptionPane.showConfirmDialog(this, "Should protein filter " + newName + " be overwritten?", "Selected Name Already Exists", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
            }
            if (outcome != JOptionPane.YES_OPTION) {
                for (ProteinFilter proteinFilter : proteinStarFilters.values()) {
                    if (!others.contains(proteinFilter.getName())) {
                        starredProteinsTable.setValueAt(proteinFilter.getName(), row, column);
                    }
                }
                return;
            }
        }
        // has to be done like this on order to avoid a ConcurrentModificationException
        final Collection<ProteinFilter> values = proteinStarFilters.values();
        Iterator<ProteinFilter> iterator = values.iterator();
        while (iterator.hasNext()) {
            ProteinFilter proteinFilter = iterator.next();
            if (!others.contains(proteinFilter.getName())) {
                String oldName = proteinFilter.getName();
                proteinFilter.setName(newName);
                proteinStarFilters.remove(oldName);
                proteinStarFilters.put(newName, proteinFilter);
            }
        }
    }
    if (column == 3) {
        String name = (String) starredProteinsTable.getValueAt(row, 2);
        proteinStarFilters.get(name).setDescription((String) starredProteinsTable.getValueAt(row, column));
    }
    if (starredProteinsTable.isEditing()) {
        editStarredProtein.setEnabled(false);
        deleteStarredProtein.setEnabled(false);
    } else if (starredProteinsTable.getSelectedRow() != -1) {
        editStarredProtein.setEnabled(true);
        deleteStarredProtein.setEnabled(true);
    }
}
Also used : ArrayList(java.util.ArrayList) ProteinFilter(com.compomics.util.experiment.identification.filtering.ProteinFilter)

Aggregations

ProteinFilter (com.compomics.util.experiment.identification.filtering.ProteinFilter)12 ProteinMatch (com.compomics.util.experiment.identification.matches.ProteinMatch)5 PSParameter (com.compomics.util.experiment.identification.peptide_shaker.PSParameter)5 ArrayList (java.util.ArrayList)3 Filter (com.compomics.util.experiment.filtering.Filter)2 AssumptionFilter (com.compomics.util.experiment.identification.filtering.AssumptionFilter)2 PeptideFilter (com.compomics.util.experiment.identification.filtering.PeptideFilter)2 PsmFilter (com.compomics.util.experiment.identification.filtering.PsmFilter)2 ValidationQcParameters (com.compomics.util.parameters.identification.advanced.ValidationQcParameters)1