Search in sources :

Example 1 with ValidationQCParametersDialog

use of com.compomics.util.gui.parameters.identification.advanced.ValidationQCParametersDialog in project peptide-shaker by compomics.

the class PeptideShakerGUI method validationQcMenuItemActionPerformed.

// GEN-LAST:event_configurationFilesSettingsActionPerformed
/**
 * Open the ValidationQCPreferencesDialog.
 *
 * @param evt
 */
private void validationQcMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_validationQcMenuItemActionPerformed
    final IdMatchValidationParameters idValidationParameters = getIdentificationParameters().getIdValidationParameters();
    final ValidationQcParameters validationQCParameters = idValidationParameters.getValidationQCParameters();
    ValidationQCParametersDialog validationQCParametersDialog = new ValidationQCParametersDialog(this, validationQCParameters, getIdentificationParameters().getSearchParameters().getModificationParameters().getAllModifications(), true);
    if (!validationQCParametersDialog.isCanceled()) {
        ValidationQcParameters newParameters = validationQCParametersDialog.getValidationQCParameters();
        if (!newParameters.isSameAs(validationQCParameters)) {
            idValidationParameters.setValidationQCParameters(newParameters);
            // Update the assumptions QC filters
            for (Filter filter : newParameters.getPsmFilters()) {
                PsmFilter psmFilter = (PsmFilter) filter;
                AssumptionFilter assumptionFilter = psmFilter.getAssumptionFilter();
                assumptionFilter.clear();
                for (String itemName : psmFilter.getItemsNames()) {
                    assumptionFilter.setFilterItem(itemName, psmFilter.getComparatorForItem(itemName), psmFilter.getValue(itemName));
                }
            }
            progressDialog = new ProgressDialogX(PeptideShakerGUI.this, Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")), Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker-orange.gif")), true);
            progressDialog.setTitle("Validating. Please Wait...");
            progressDialog.setPrimaryProgressCounterIndeterminate(false);
            new Thread(new Runnable() {

                public void run() {
                    try {
                        progressDialog.setVisible(true);
                    } catch (IndexOutOfBoundsException e) {
                    // ignore
                    }
                }
            }, "ProgressDialog").start();
            new Thread("RecalculateThread") {

                @Override
                public void run() {
                    PeptideShakerGUI peptideShakerGUI = PeptideShakerGUI.this;
                    try {
                        PSMaps pSMaps = new PSMaps();
                        pSMaps = (PSMaps) peptideShakerGUI.getIdentification().getUrParam(pSMaps);
                        MatchesValidator matchesValidator = new MatchesValidator(pSMaps.getPsmMap(), pSMaps.getPeptideMap(), pSMaps.getProteinMap());
                        matchesValidator.validateIdentifications(peptideShakerGUI.getIdentification(), peptideShakerGUI.getMetrics(), pSMaps.getInputMap(), progressDialog, exceptionHandler, peptideShakerGUI.getIdentificationFeaturesGenerator(), peptideShakerGUI.getSequenceProvider(), peptideShakerGUI.getProteinDetailsProvider(), peptideShakerGUI.getSpectrumProvider(), peptideShakerGUI.getGeneMaps(), peptideShakerGUI.getIdentificationParameters(), peptideShakerGUI.getProjectType(), peptideShakerGUI.getProcessingParameters());
                        progressDialog.setPrimaryProgressCounterIndeterminate(true);
                        ProteinProcessor proteinProcessor = new ProteinProcessor(peptideShakerGUI.getIdentification(), peptideShakerGUI.getIdentificationParameters(), peptideShakerGUI.getIdentificationFeaturesGenerator(), peptideShakerGUI.getSequenceProvider());
                        proteinProcessor.processProteins(new ModificationLocalizationScorer(), peptideShakerGUI.getMetrics(), modificationFactory, progressDialog, peptideShakerGUI.getExceptionHandler(), peptideShakerGUI.getProcessingParameters());
                        if (!progressDialog.isRunCanceled()) {
                            // update the other tabs
                            peptideShakerGUI.getMetrics().setnValidatedProteins(-1);
                            peptideShakerGUI.getMetrics().setnConfidentProteins(-1);
                            peptideShakerGUI.setUpdated(PeptideShakerGUI.OVER_VIEW_TAB_INDEX, false);
                            peptideShakerGUI.setUpdated(PeptideShakerGUI.PROTEIN_FRACTIONS_TAB_INDEX, false);
                            peptideShakerGUI.setUpdated(PeptideShakerGUI.STRUCTURES_TAB_INDEX, false);
                            peptideShakerGUI.setUpdated(PeptideShakerGUI.MODIFICATIONS_TAB_INDEX, false);
                            peptideShakerGUI.setUpdated(PeptideShakerGUI.QC_PLOTS_TAB_INDEX, false);
                            peptideShakerGUI.setUpdated(PeptideShakerGUI.SPECTRUM_ID_TAB_INDEX, false);
                            peptideShakerGUI.setDataSaved(false);
                        } else {
                            idValidationParameters.setValidationQCParameters(validationQCParameters);
                        }
                    } catch (Exception e) {
                        peptideShakerGUI.catchException(e);
                    }
                    progressDialog.setRunFinished();
                    PeptideShakerGUI.this.repaintPanels();
                }
            }.start();
        }
    }
}
Also used : MatchesValidator(eu.isas.peptideshaker.validation.MatchesValidator) PSMaps(eu.isas.peptideshaker.scoring.PSMaps) IdMatchValidationParameters(com.compomics.util.parameters.identification.advanced.IdMatchValidationParameters) ModificationLocalizationScorer(eu.isas.peptideshaker.ptm.ModificationLocalizationScorer) AssumptionFilter(com.compomics.util.experiment.identification.filtering.AssumptionFilter) ConnectException(java.net.ConnectException) UnknownHostException(java.net.UnknownHostException) ProgressDialogX(com.compomics.util.gui.waiting.waitinghandlers.ProgressDialogX) PsmFilter(com.compomics.util.experiment.identification.filtering.PsmFilter) FileFilter(javax.swing.filechooser.FileFilter) Filter(com.compomics.util.experiment.filtering.Filter) FileAndFileFilter(com.compomics.util.gui.file_handling.FileAndFileFilter) AssumptionFilter(com.compomics.util.experiment.identification.filtering.AssumptionFilter) ValidationQcParameters(com.compomics.util.parameters.identification.advanced.ValidationQcParameters) ProteinProcessor(eu.isas.peptideshaker.processing.ProteinProcessor) PsmFilter(com.compomics.util.experiment.identification.filtering.PsmFilter) ValidationQCParametersDialog(com.compomics.util.gui.parameters.identification.advanced.ValidationQCParametersDialog)

Aggregations

Filter (com.compomics.util.experiment.filtering.Filter)1 AssumptionFilter (com.compomics.util.experiment.identification.filtering.AssumptionFilter)1 PsmFilter (com.compomics.util.experiment.identification.filtering.PsmFilter)1 FileAndFileFilter (com.compomics.util.gui.file_handling.FileAndFileFilter)1 ValidationQCParametersDialog (com.compomics.util.gui.parameters.identification.advanced.ValidationQCParametersDialog)1 ProgressDialogX (com.compomics.util.gui.waiting.waitinghandlers.ProgressDialogX)1 IdMatchValidationParameters (com.compomics.util.parameters.identification.advanced.IdMatchValidationParameters)1 ValidationQcParameters (com.compomics.util.parameters.identification.advanced.ValidationQcParameters)1 ProteinProcessor (eu.isas.peptideshaker.processing.ProteinProcessor)1 ModificationLocalizationScorer (eu.isas.peptideshaker.ptm.ModificationLocalizationScorer)1 PSMaps (eu.isas.peptideshaker.scoring.PSMaps)1 MatchesValidator (eu.isas.peptideshaker.validation.MatchesValidator)1 ConnectException (java.net.ConnectException)1 UnknownHostException (java.net.UnknownHostException)1 FileFilter (javax.swing.filechooser.FileFilter)1