Search in sources :

Example 1 with PsmFilter

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);
    }
}
Also used : ArrayList(java.util.ArrayList) PsmFilter(com.compomics.util.experiment.identification.filtering.PsmFilter)

Example 2 with PsmFilter

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);
    }
}
Also used : ArrayList(java.util.ArrayList) PsmFilter(com.compomics.util.experiment.identification.filtering.PsmFilter)

Example 3 with PsmFilter

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();
    }
}
Also used : PsmFilter(com.compomics.util.experiment.identification.filtering.PsmFilter)

Example 4 with PsmFilter

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();
    }
}
Also used : PsmFilter(com.compomics.util.experiment.identification.filtering.PsmFilter)

Example 5 with PsmFilter

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();
    }
}
Also used : PsmFilter(com.compomics.util.experiment.identification.filtering.PsmFilter)

Aggregations

PsmFilter (com.compomics.util.experiment.identification.filtering.PsmFilter)15 SpectrumMatch (com.compomics.util.experiment.identification.matches.SpectrumMatch)7 PSParameter (com.compomics.util.experiment.identification.peptide_shaker.PSParameter)7 Filter (com.compomics.util.experiment.filtering.Filter)5 AssumptionFilter (com.compomics.util.experiment.identification.filtering.AssumptionFilter)5 PeptideFilter (com.compomics.util.experiment.identification.filtering.PeptideFilter)4 ProteinFilter (com.compomics.util.experiment.identification.filtering.ProteinFilter)4 ValidationQcParameters (com.compomics.util.parameters.identification.advanced.ValidationQcParameters)4 ArrayList (java.util.ArrayList)4 TargetDecoyResults (eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyResults)3 IdMatchValidationParameters (com.compomics.util.parameters.identification.advanced.IdMatchValidationParameters)2 TargetDecoyMap (eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyMap)2 ExceptionHandler (com.compomics.util.exceptions.ExceptionHandler)1 GeneMaps (com.compomics.util.experiment.biology.genes.GeneMaps)1 Peptide (com.compomics.util.experiment.biology.proteins.Peptide)1 FilterItemComparator (com.compomics.util.experiment.filtering.FilterItemComparator)1 Identification (com.compomics.util.experiment.identification.Identification)1 SpectrumIdentificationAssumption (com.compomics.util.experiment.identification.SpectrumIdentificationAssumption)1 IdentificationFeaturesGenerator (com.compomics.util.experiment.identification.features.IdentificationFeaturesGenerator)1 AssumptionFilterItem (com.compomics.util.experiment.identification.filtering.items.AssumptionFilterItem)1