Search in sources :

Example 1 with PeptideFilter

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

the class StarHider method hidePeptide.

/**
 * Hides a peptide match.
 *
 * @param matchKey the key of the match
 */
public void hidePeptide(long matchKey) {
    PeptideMatch peptideMatch = identification.getPeptideMatch(matchKey);
    PSParameter psParameter = (PSParameter) peptideMatch.getUrParam(PSParameter.dummy);
    boolean validated = false;
    for (PeptideFilter matchFilter : filterPreferences.getPeptideHideFilters().values()) {
        if (matchFilter.getExceptions().contains(matchKey)) {
            matchFilter.removeException(matchKey);
        }
        if (matchFilter.isValidated(matchKey, identification, geneMaps, identificationFeaturesGenerator, identificationParameters, sequenceProvider, proteinDetailsProvider, spectrumProvider)) {
            validated = true;
        }
    }
    if (!validated) {
        PeptideFilter peptideFilter;
        if (!filterPreferences.getPeptideHideFilters().containsKey(MatchFilter.MANUAL_SELECTION)) {
            peptideFilter = new PeptideFilter(MatchFilter.MANUAL_SELECTION);
            peptideFilter.setDescription("Manual selection via the graphical interface");
            filterPreferences.getPeptideHideFilters().put(peptideFilter.getName(), peptideFilter);
        } else {
            peptideFilter = filterPreferences.getPeptideHideFilters().get(MatchFilter.MANUAL_SELECTION);
        }
        peptideFilter.addManualValidation(matchKey);
    }
    psParameter.setHidden(true);
}
Also used : PeptideMatch(com.compomics.util.experiment.identification.matches.PeptideMatch) PSParameter(com.compomics.util.experiment.identification.peptide_shaker.PSParameter) PeptideFilter(com.compomics.util.experiment.identification.filtering.PeptideFilter)

Example 2 with PeptideFilter

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

the class StarHider method unHidePeptide.

/**
 * Unhides a peptide match.
 *
 * @param matchKey the key of the match
 */
public void unHidePeptide(long matchKey) {
    PeptideMatch peptideMatch = identification.getPeptideMatch(matchKey);
    PSParameter psParameter = (PSParameter) peptideMatch.getUrParam(PSParameter.dummy);
    for (PeptideFilter matchFilter : filterPreferences.getPeptideHideFilters().values()) {
        if (matchFilter.getManualValidation().contains(matchKey)) {
            matchFilter.removeManualValidation(matchKey);
        }
        if (matchFilter.isValidated(matchKey, identification, geneMaps, identificationFeaturesGenerator, identificationParameters, sequenceProvider, proteinDetailsProvider, spectrumProvider)) {
            matchFilter.addException(matchKey);
        }
    }
    psParameter.setHidden(false);
}
Also used : PeptideMatch(com.compomics.util.experiment.identification.matches.PeptideMatch) PSParameter(com.compomics.util.experiment.identification.peptide_shaker.PSParameter) PeptideFilter(com.compomics.util.experiment.identification.filtering.PeptideFilter)

Example 3 with PeptideFilter

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

the class FiltersDialog method editHiddenPeptidesActionPerformed.

// GEN-LAST:event_editStarredPeptidesActionPerformed
/**
 * Edit a hidden peptide.
 *
 * @param evt the action event
 */
private void editHiddenPeptidesActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_editHiddenPeptidesActionPerformed
    int row = hiddenPeptidesTable.getSelectedRow();
    if (row >= 0) {
        String selectedFilterName = (String) hiddenPeptidesTable.getValueAt(row, 2);
        PeptideFilter peptideFilter = peptideHideFilters.get(selectedFilterName);
        editFilter(peptideFilter);
        updateTables();
    }
}
Also used : PeptideFilter(com.compomics.util.experiment.identification.filtering.PeptideFilter)

Example 4 with PeptideFilter

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

the class FiltersDialog method starredPeptidesTableKeyReleased.

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

Example 5 with PeptideFilter

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

the class FiltersDialog method addHiddenPeptidesActionPerformed.

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

Aggregations

PeptideFilter (com.compomics.util.experiment.identification.filtering.PeptideFilter)12 PeptideMatch (com.compomics.util.experiment.identification.matches.PeptideMatch)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 ProteinFilter (com.compomics.util.experiment.identification.filtering.ProteinFilter)2 PsmFilter (com.compomics.util.experiment.identification.filtering.PsmFilter)2 ValidationQcParameters (com.compomics.util.parameters.identification.advanced.ValidationQcParameters)1 TargetDecoyResults (eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyResults)1