Search in sources :

Example 1 with PSMaps

use of eu.isas.peptideshaker.scoring.PSMaps in project peptide-shaker by compomics.

the class ValidationPanel method displayResults.

// End of variables declaration//GEN-END:variables
/**
 * This method displays results in the panel.
 */
public void displayResults() {
    progressDialog = new ProgressDialogX(peptideShakerGUI, Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")), Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker-orange.gif")), true);
    progressDialog.setPrimaryProgressCounterIndeterminate(true);
    progressDialog.setTitle("Updating Validation Data. Please Wait...");
    new Thread(new Runnable() {

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

        @Override
        public void run() {
            groupSelectionTable.setEnabled(true);
            // empty the group table
            DefaultTableModel dm = (DefaultTableModel) groupSelectionTable.getModel();
            dm.getDataVector().removeAllElements();
            dm.fireTableDataChanged();
            PSMaps pSMaps = new PSMaps();
            pSMaps = (PSMaps) peptideShakerGUI.getIdentification().getUrParam(pSMaps);
            int cpt = 0;
            if (null != peptideShakerGUI.getProjectType()) {
                switch(peptideShakerGUI.getProjectType()) {
                    case protein:
                        modifiedMaps.put("Proteins", false);
                        ((DefaultTableModel) groupSelectionTable.getModel()).addRow(new Object[] { cpt + 1, "Proteins" });
                        TargetDecoyMap targetDecoyMap = pSMaps.getProteinMap();
                        TargetDecoyResults targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                        originalThresholdTypes.put("Proteins", targetDecoyResults.getInputType());
                        originalThresholds.put("Proteins", targetDecoyResults.getUserInput());
                        cpt++;
                        modifiedMaps.put("Peptides", false);
                        ((DefaultTableModel) groupSelectionTable.getModel()).addRow(new Object[] { cpt + 1, "Peptides" });
                        targetDecoyMap = pSMaps.getPeptideMap();
                        targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                        originalThresholdTypes.put("Peptides", targetDecoyResults.getInputType());
                        originalThresholds.put("Peptides", targetDecoyResults.getUserInput());
                        cpt++;
                        modifiedMaps.put("PSMs", false);
                        ((DefaultTableModel) groupSelectionTable.getModel()).addRow(new Object[] { cpt + 1, "PSMs" });
                        targetDecoyMap = pSMaps.getPsmMap();
                        targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                        originalThresholdTypes.put("PSMs", targetDecoyResults.getInputType());
                        originalThresholds.put("PSMs", targetDecoyResults.getUserInput());
                        break;
                    case peptide:
                        modifiedMaps.put("Peptides", false);
                        ((DefaultTableModel) groupSelectionTable.getModel()).addRow(new Object[] { cpt + 1, "Peptides" });
                        targetDecoyMap = pSMaps.getPeptideMap();
                        targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                        originalThresholdTypes.put("Peptides", targetDecoyResults.getInputType());
                        originalThresholds.put("Peptides", targetDecoyResults.getUserInput());
                        cpt++;
                        modifiedMaps.put("PSMs", false);
                        ((DefaultTableModel) groupSelectionTable.getModel()).addRow(new Object[] { cpt + 1, "PSMs" });
                        targetDecoyMap = pSMaps.getPsmMap();
                        targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                        originalThresholdTypes.put("PSMs", targetDecoyResults.getInputType());
                        originalThresholds.put("PSMs", targetDecoyResults.getUserInput());
                        break;
                    case psm:
                        modifiedMaps.put("PSMs", false);
                        ((DefaultTableModel) groupSelectionTable.getModel()).addRow(new Object[] { cpt + 1, "PSMs" });
                        targetDecoyMap = pSMaps.getPsmMap();
                        targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
                        originalThresholdTypes.put("PSMs", targetDecoyResults.getInputType());
                        originalThresholds.put("PSMs", targetDecoyResults.getUserInput());
                        break;
                    default:
                        break;
                }
            }
            if (groupSelectionTable.getRowCount() > 0) {
                groupSelectionTable.setRowSelectionInterval(0, 0);
            }
            if (!progressDialog.isRunCanceled()) {
                groupSelectionChanged();
                // enable the contextual export options
                confidencePlotExportJButton.setEnabled(true);
                fdrFnrPlotExportJButton.setEnabled(true);
                costBenefitPlotExportJButton.setEnabled(true);
                tabInitiated = true;
            }
            progressDialog.setRunFinished();
        }
    }.start();
}
Also used : ProgressDialogX(com.compomics.util.gui.waiting.waitinghandlers.ProgressDialogX) TargetDecoyMap(eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyMap) PSMaps(eu.isas.peptideshaker.scoring.PSMaps) DefaultTableModel(javax.swing.table.DefaultTableModel) TargetDecoyResults(eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyResults)

Example 2 with PSMaps

use of eu.isas.peptideshaker.scoring.PSMaps in project peptide-shaker by compomics.

the class OverviewPanel method proteinTableMouseReleased.

// GEN-LAST:event_psmTableMouseReleased
/**
 * Updates the tables according to the currently selected protein.
 *
 * @param evt
 */
private void proteinTableMouseReleased(java.awt.event.MouseEvent evt) {
    // GEN-FIRST:event_proteinTableMouseReleased
    int row = proteinTable.getSelectedRow();
    int column = proteinTable.getSelectedColumn();
    int proteinIndex = -1;
    if (row != -1) {
        SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) proteinTable.getModel();
        proteinIndex = tableModel.getViewIndex(row);
    }
    if (evt == null || (evt.getButton() == MouseEvent.BUTTON1 && (proteinIndex != -1 && column != -1))) {
        if (proteinIndex != -1) {
            this.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
            long proteinKey = proteinKeys[proteinIndex];
            peptideShakerGUI.setSelectedItems(proteinKey, NO_KEY, null, null);
            // update the peptide selection
            updatePeptideSelection(proteinIndex);
            // remember the selection
            newItemSelection();
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    peptideShakerGUI.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
                }
            });
            this.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
            // star/unstar a protein
            if (column == proteinTable.getColumn("  ").getModelIndex()) {
                ProteinMatch proteinMatch = peptideShakerGUI.getIdentification().getProteinMatch(proteinKey);
                PSParameter psParameter = (PSParameter) proteinMatch.getUrParam(PSParameter.dummy);
                if (!psParameter.getStarred()) {
                    peptideShakerGUI.getStarHider().starProtein(proteinKey);
                } else {
                    peptideShakerGUI.getStarHider().unStarProtein(proteinKey);
                }
                peptideShakerGUI.setDataSaved(false);
            }
            // open the gene details dialog
            if (column == proteinTable.getColumn("Chr").getModelIndex() && evt != null && evt.getButton() == MouseEvent.BUTTON1) {
                // @TODO: check if the gene maps exist...
                ProteinMatch proteinMatch = peptideShakerGUI.getIdentification().getProteinMatch(proteinKey);
                new GeneDetailsDialog(peptideShakerGUI, proteinMatch, peptideShakerGUI.getGeneMaps(), peptideShakerGUI.getProteinDetailsProvider());
            }
            // open protein link in web browser
            if (column == proteinTable.getColumn("Accession").getModelIndex() && evt != null && evt.getButton() == MouseEvent.BUTTON1 && ((String) proteinTable.getValueAt(row, column)).lastIndexOf("<a href=\"") != -1) {
                String link = (String) proteinTable.getValueAt(row, column);
                link = link.substring(link.indexOf("\"") + 1);
                link = link.substring(0, link.indexOf("\""));
                this.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
                BareBonesBrowserLaunch.openURL(link);
                this.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
            }
            // open the protein inference dialog
            if (column == proteinTable.getColumn("PI").getModelIndex() && evt != null && evt.getButton() == MouseEvent.BUTTON1) {
                new ProteinInferenceDialog(peptideShakerGUI, peptideShakerGUI.getGeneMaps(), proteinKey, peptideShakerGUI.getIdentification());
            }
            // open the match validation level dialog
            if (column == proteinTable.getColumn("").getModelIndex() && evt != null && evt.getButton() == MouseEvent.BUTTON1) {
                Identification identification = peptideShakerGUI.getIdentification();
                PSMaps pSMaps = new PSMaps();
                pSMaps = (PSMaps) identification.getUrParam(pSMaps);
                MatchValidationDialog matchValidationDialog = new MatchValidationDialog(peptideShakerGUI, identification, pSMaps.getProteinMap(), proteinKey, peptideShakerGUI.getIdentificationParameters(), peptideShakerGUI.getProjectDetails().getFastaFile(), MatchType.PROTEIN);
                if (matchValidationDialog.isValidationChanged()) {
                    updateProteinPanelTitle();
                }
            }
        }
    } else if (evt.getButton() == MouseEvent.BUTTON3) {
        if (proteinTable.columnAtPoint(evt.getPoint()) == proteinTable.getColumn("  ").getModelIndex()) {
            selectJPopupMenu.show(proteinTable, evt.getX(), evt.getY());
        }
    }
}
Also used : PSMaps(eu.isas.peptideshaker.scoring.PSMaps) ProteinInferenceDialog(eu.isas.peptideshaker.gui.protein_inference.ProteinInferenceDialog) Identification(com.compomics.util.experiment.identification.Identification) GeneDetailsDialog(com.compomics.util.gui.genes.GeneDetailsDialog) SelfUpdatingTableModel(com.compomics.util.gui.tablemodels.SelfUpdatingTableModel) MatchValidationDialog(eu.isas.peptideshaker.gui.MatchValidationDialog) PSParameter(com.compomics.util.experiment.identification.peptide_shaker.PSParameter) java.awt(java.awt)

Example 3 with PSMaps

use of eu.isas.peptideshaker.scoring.PSMaps in project peptide-shaker by compomics.

the class OverviewPanel method psmTableMouseReleased.

// GEN-LAST:event_proteinTableMouseExited
/**
 * Updates the spectrum, bubble plot and ion table.
 *
 * @param evt
 */
private void psmTableMouseReleased(java.awt.event.MouseEvent evt) {
    // GEN-FIRST:event_psmTableMouseReleased
    int row = psmTable.getSelectedRow();
    int column = psmTable.getSelectedColumn();
    if (row != -1) {
        this.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
        newItemSelection();
        updateSpectrum(row, false);
        Identification identification = peptideShakerGUI.getIdentification();
        // star/unstar a psm
        if (column == psmTable.getColumn("  ").getModelIndex()) {
            SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) psmTable.getModel();
            int psmIndex = tableModel.getViewIndex(row);
            long psmKey = psmKeys[tableModel.getViewIndex(psmIndex)];
            SpectrumMatch spectrumMatch = identification.getSpectrumMatch(psmKey);
            PSParameter psParameter = (PSParameter) spectrumMatch.getUrParam(PSParameter.dummy);
            if (!psParameter.getStarred()) {
                peptideShakerGUI.getStarHider().starPsm(psmKey);
            } else {
                peptideShakerGUI.getStarHider().unStarPsm(psmKey);
            }
            peptideShakerGUI.setDataSaved(false);
        }
        if (column == 2 && evt != null && evt.getButton() == 1) {
            peptideShakerGUI.jumpToTab(PeptideShakerGUI.SPECTRUM_ID_TAB_INDEX);
        }
        // open the match validation level dialog
        if (column == psmTable.getColumn("").getModelIndex() && evt != null && evt.getButton() == MouseEvent.BUTTON1) {
            SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) psmTable.getModel();
            int psmIndex = tableModel.getViewIndex(row);
            long psmKey = psmKeys[tableModel.getViewIndex(psmIndex)];
            PSMaps pSMaps = new PSMaps();
            pSMaps = (PSMaps) identification.getUrParam(pSMaps);
            MatchValidationDialog matchValidationDialog = new MatchValidationDialog(peptideShakerGUI, identification, pSMaps.getPsmMap(), psmKey, peptideShakerGUI.getIdentificationParameters(), peptideShakerGUI.getProjectDetails().getFastaFile(), MatchType.PSM);
            if (matchValidationDialog.isValidationChanged()) {
                updatePsmPanelTitle();
                peptidesPanel.repaint();
                proteinsLayeredPanel.repaint();
            }
        }
        this.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    }
    // update the annotation menu
    spectrumJTabbedPaneStateChanged(null);
}
Also used : PSMaps(eu.isas.peptideshaker.scoring.PSMaps) SelfUpdatingTableModel(com.compomics.util.gui.tablemodels.SelfUpdatingTableModel) Identification(com.compomics.util.experiment.identification.Identification) MatchValidationDialog(eu.isas.peptideshaker.gui.MatchValidationDialog) PSParameter(com.compomics.util.experiment.identification.peptide_shaker.PSParameter) java.awt(java.awt)

Example 4 with PSMaps

use of eu.isas.peptideshaker.scoring.PSMaps in project peptide-shaker by compomics.

the class PsmTableModel method updateDataModel.

/**
 * Update the data in the table model without having to reset the whole
 * table model. This keeps the sorting order of the table.
 *
 * @param identification the identification object containing the matches
 * @param displayFeaturesGenerator the display features generator
 * @param identificationParameters the identification parameters
 * @param psmKeys the PSM keys
 */
public void updateDataModel(Identification identification, DisplayFeaturesGenerator displayFeaturesGenerator, IdentificationParameters identificationParameters, long[] psmKeys) {
    this.identification = identification;
    this.displayFeaturesGenerator = displayFeaturesGenerator;
    this.identificationParameters = identificationParameters;
    this.psmKeys = psmKeys;
    PSMaps pSMaps = new PSMaps();
    pSMaps = (PSMaps) identification.getUrParam(pSMaps);
    this.inputMap = pSMaps.getInputMap();
}
Also used : PSMaps(eu.isas.peptideshaker.scoring.PSMaps)

Example 5 with PSMaps

use of eu.isas.peptideshaker.scoring.PSMaps in project peptide-shaker by compomics.

the class PeptideShaker method createProject.

/**
 * Creates a PeptideShaker project.
 *
 * @param waitingHandler the handler displaying feedback to the user
 * @param exceptionHandler handler for exceptions
 * @param identificationParameters the identification parameters
 * @param processingParameters the processing parameters
 * @param projectType the project type
 * @param spectrumCountingParameters the spectrum counting parameters
 * @param spectrumProvider the spectrum provider
 * @param setWaitingHandlerFinshedWhenDone if true, the waiting handler is
 * set to finished when the project is created
 * @param projectDetails the project details
 *
 * @throws java.lang.InterruptedException exception thrown if a thread gets
 * interrupted
 * @throws java.util.concurrent.TimeoutException exception thrown if a
 * process times out
 * @throws java.io.IOException if an exception occurs when parsing files
 */
public void createProject(IdentificationParameters identificationParameters, ProcessingParameters processingParameters, SpectrumCountingParameters spectrumCountingParameters, SpectrumProvider spectrumProvider, ProjectDetails projectDetails, ProjectType projectType, WaitingHandler waitingHandler, boolean setWaitingHandlerFinshedWhenDone, ExceptionHandler exceptionHandler) throws InterruptedException, TimeoutException, IOException {
    identification.getObjectsDB().commit();
    identificationFeaturesGenerator = new IdentificationFeaturesGenerator(identification, identificationParameters, sequenceProvider, spectrumProvider, metrics, spectrumCountingParameters);
    matchesValidator = new MatchesValidator(new TargetDecoyMap(), new TargetDecoyMap(), new TargetDecoyMap());
    if (waitingHandler.isRunCanceled()) {
        return;
    }
    PsmScoringParameters psmScoringPreferences = identificationParameters.getPsmScoringParameters();
    FastaParameters fastaParameters = identificationParameters.getFastaParameters();
    FastaSummary fastaSummary = FastaSummary.getSummary(projectDetails.getFastaFile(), fastaParameters, waitingHandler);
    // set the background species
    identificationParameters.getGeneParameters().setBackgroundSpeciesFromFastaSummary(fastaSummary);
    ArrayList<Integer> usedAlgorithms = projectDetails.getIdentificationAlgorithms();
    if (psmScoringPreferences.isScoringNeeded(usedAlgorithms)) {
        waitingHandler.appendReport("Estimating PSM scores.", true, true);
        PsmScorer psmScorer = new PsmScorer(fastaParameters, sequenceProvider, spectrumProvider);
        psmScorer.estimateIntermediateScores(identification, inputMap, processingParameters, identificationParameters, waitingHandler, exceptionHandler);
        if (psmScoringPreferences.isTargetDecoyNeededForPsmScoring(usedAlgorithms)) {
            if (fastaParameters.isTargetDecoy()) {
                waitingHandler.appendReport("Estimating intermediate scores probabilities.", true, true);
                psmScorer.estimateIntermediateScoreProbabilities(identification, inputMap, processingParameters, waitingHandler);
            } else {
                waitingHandler.appendReport("No decoy sequences found. Impossible to " + "estimate intermediate scores probabilities.", true, true);
            }
        }
        waitingHandler.appendReport("Scoring PSMs.", true, true);
        psmScorer.scorePsms(identification, inputMap, processingParameters, identificationParameters, waitingHandler);
    }
    identification.getObjectsDB().commit();
    System.gc();
    if (fastaParameters.isTargetDecoy()) {
        waitingHandler.appendReport("Computing assumptions probabilities.", true, true);
    } else {
        waitingHandler.appendReport("Importing assumptions scores.", true, true);
    }
    inputMap.estimateProbabilities(waitingHandler);
    waitingHandler.increasePrimaryProgressCounter();
    if (waitingHandler.isRunCanceled()) {
        return;
    }
    identification.getObjectsDB().commit();
    System.gc();
    waitingHandler.appendReport("Saving assumptions probabilities, selecting best match, scoring modification localization.", true, true);
    PsmProcessor psmProcessor = new PsmProcessor(identification);
    psmProcessor.processPsms(inputMap, identificationParameters, matchesValidator, modificationLocalizationScorer, sequenceProvider, spectrumProvider, modificationFactory, proteinCount, processingParameters.getnThreads(), waitingHandler, exceptionHandler);
    waitingHandler.increasePrimaryProgressCounter();
    if (waitingHandler.isRunCanceled()) {
        return;
    }
    identification.getObjectsDB().commit();
    System.gc();
    waitingHandler.appendReport("Computing PSM probabilities.", true, true);
    matchesValidator.getPsmMap().estimateProbabilities(waitingHandler);
    if (waitingHandler.isRunCanceled()) {
        return;
    }
    identification.getObjectsDB().commit();
    System.gc();
    if (projectType == ProjectType.peptide || projectType == ProjectType.protein) {
        PeptideInference peptideInference = new PeptideInference();
        ModificationLocalizationParameters modificationScoringPreferences = identificationParameters.getModificationLocalizationParameters();
        if (modificationScoringPreferences.getAlignNonConfidentModifications()) {
            waitingHandler.appendReport("Resolving peptide inference issues.", true, true);
            peptideInference.peptideInference(identification, identificationParameters, sequenceProvider, modificationFactory, waitingHandler);
            waitingHandler.increasePrimaryProgressCounter();
            if (waitingHandler.isRunCanceled()) {
                return;
            }
        }
        identification.getObjectsDB().commit();
        System.gc();
    }
    String reportTxt = "Saving probabilities";
    String waitingTitle = "Saving Probabilities.";
    ;
    switch(projectType) {
        case psm:
            reportTxt += ".";
            break;
        case peptide:
            reportTxt += ", building peptides.";
            waitingTitle += " Building Peptides.";
            break;
        default:
            reportTxt += ", building peptides and proteins.";
            waitingTitle += " Building Peptides and Proteins.";
    }
    waitingHandler.appendReport(reportTxt, true, true);
    waitingHandler.setWaitingText(waitingTitle + " Please Wait...");
    attachSpectrumProbabilitiesAndBuildPeptidesAndProteins(sequenceProvider, identificationParameters.getSequenceMatchingParameters(), projectType, fastaParameters, waitingHandler);
    waitingHandler.increasePrimaryProgressCounter();
    if (waitingHandler.isRunCanceled()) {
        return;
    }
    identification.getObjectsDB().commit();
    System.gc();
    if (projectType == ProjectType.peptide || projectType == ProjectType.protein) {
        waitingHandler.appendReport("Generating peptide map.", true, true);
        matchesValidator.fillPeptideMaps(identification, metrics, waitingHandler, identificationParameters, sequenceProvider, spectrumProvider);
        if (waitingHandler.isRunCanceled()) {
            return;
        }
        identification.getObjectsDB().commit();
        System.gc();
        waitingHandler.appendReport("Computing peptide probabilities.", true, true);
        matchesValidator.getPeptideMap().estimateProbabilities(waitingHandler);
        if (waitingHandler.isRunCanceled()) {
            return;
        }
        identification.getObjectsDB().commit();
        System.gc();
        waitingHandler.appendReport("Saving peptide probabilities.", true, true);
        matchesValidator.attachPeptideProbabilities(identification, fastaParameters, waitingHandler);
        waitingHandler.increasePrimaryProgressCounter();
        if (waitingHandler.isRunCanceled()) {
            return;
        }
        identification.getObjectsDB().commit();
        System.gc();
        if (projectType == ProjectType.protein) {
            if (identificationParameters.getProteinInferenceParameters().getSimplifyGroups()) {
                waitingHandler.appendReport("Simplifying protein groups.", true, true);
                GroupSimplification groupSimplification = new GroupSimplification();
                groupSimplification.removeRedundantGroups(identification, identificationParameters, sequenceProvider, proteinDetailsProvider, waitingHandler);
                waitingHandler.increasePrimaryProgressCounter();
                if (waitingHandler.isRunCanceled()) {
                    return;
                }
            }
            identification.getObjectsDB().commit();
            System.gc();
            ProteinInference proteinInference = new ProteinInference();
            waitingHandler.appendReport("Mapping shared peptides.", true, true);
            proteinInference.distributeSharedPeptides(identification, waitingHandler);
            waitingHandler.increasePrimaryProgressCounter();
            if (waitingHandler.isRunCanceled()) {
                return;
            }
            identification.getObjectsDB().commit();
            System.gc();
            waitingHandler.appendReport("Generating protein map.", true, true);
            matchesValidator.fillProteinMap(identification, spectrumProvider, waitingHandler);
            waitingHandler.increasePrimaryProgressCounter();
            if (waitingHandler.isRunCanceled()) {
                return;
            }
            identification.getObjectsDB().commit();
            System.gc();
            waitingHandler.appendReport("Selecting leading proteins, inferring peptide and protein inference status.", true, true);
            proteinInference.inferPiStatus(identification, metrics, matchesValidator.getProteinMap(), identificationParameters, sequenceProvider, proteinDetailsProvider, waitingHandler);
            waitingHandler.increasePrimaryProgressCounter();
            if (waitingHandler.isRunCanceled()) {
                return;
            }
            identification.getObjectsDB().commit();
            System.gc();
            waitingHandler.appendReport("Computing protein probabilities.", true, true);
            matchesValidator.getProteinMap().estimateProbabilities(waitingHandler);
            if (waitingHandler.isRunCanceled()) {
                return;
            }
            identification.getObjectsDB().commit();
            System.gc();
            waitingHandler.appendReport("Saving protein probabilities.", true, true);
            matchesValidator.attachProteinProbabilities(identification, sequenceProvider, fastaParameters, metrics, waitingHandler, identificationParameters.getFractionParameters());
            waitingHandler.increasePrimaryProgressCounter();
            if (waitingHandler.isRunCanceled()) {
                return;
            }
            identification.getObjectsDB().commit();
            System.gc();
        }
    }
    if (fastaParameters.isTargetDecoy()) {
        IdMatchValidationParameters idMatchValidationParameters = identificationParameters.getIdValidationParameters();
        if (idMatchValidationParameters.getDefaultPsmFDR() == 1 && idMatchValidationParameters.getDefaultPeptideFDR() == 1 && idMatchValidationParameters.getDefaultProteinFDR() == 1) {
            waitingHandler.appendReport("Validating identifications at 1% FDR, quality control of matches.", true, true);
        } else {
            waitingHandler.appendReport("Validating identifications, quality control of matches.", true, true);
        }
    } else {
        waitingHandler.appendReport("Quality control of matches.", true, true);
    }
    matchesValidator.validateIdentifications(identification, metrics, inputMap, waitingHandler, exceptionHandler, identificationFeaturesGenerator, sequenceProvider, proteinDetailsProvider, spectrumProvider, geneMaps, identificationParameters, projectType, processingParameters);
    waitingHandler.increasePrimaryProgressCounter();
    if (waitingHandler.isRunCanceled()) {
        return;
    }
    identification.getObjectsDB().commit();
    System.gc();
    if (projectType == ProjectType.peptide || projectType == ProjectType.protein) {
        waitingHandler.appendReport("Scoring PTMs in peptides.", true, true);
        modificationLocalizationScorer.scorePeptidePtms(identification, modificationFactory, waitingHandler, identificationParameters);
        waitingHandler.increasePrimaryProgressCounter();
        if (waitingHandler.isRunCanceled()) {
            return;
        }
        identification.getObjectsDB().commit();
        System.gc();
        if (projectType == ProjectType.protein) {
            waitingHandler.appendReport("Estimating spectrum counting scaling values.", true, true);
            ScalingFactorsEstimators scalingFactors = new ScalingFactorsEstimators(spectrumCountingParameters);
            scalingFactors.estimateScalingFactors(identification, metrics, sequenceProvider, identificationFeaturesGenerator, waitingHandler, exceptionHandler, processingParameters);
            waitingHandler.increasePrimaryProgressCounter();
            if (waitingHandler.isRunCanceled()) {
                return;
            }
            identification.getObjectsDB().commit();
            System.gc();
            waitingHandler.appendReport("Scoring PTMs in proteins, gathering summary metrics.", true, true);
            ProteinProcessor proteinProcessor = new ProteinProcessor(identification, identificationParameters, identificationFeaturesGenerator, sequenceProvider);
            proteinProcessor.processProteins(modificationLocalizationScorer, metrics, modificationFactory, waitingHandler, exceptionHandler, processingParameters);
            waitingHandler.increasePrimaryProgressCounter();
            if (waitingHandler.isRunCanceled()) {
                return;
            }
            identification.getObjectsDB().commit();
            System.gc();
        }
    }
    projectCreationDuration.end();
    String report = "Identification processing completed (" + projectCreationDuration.toString() + ").";
    waitingHandler.appendReport(report, true, true);
    waitingHandler.appendReportEndLine();
    waitingHandler.appendReportEndLine();
    identification.addUrParam(new PSMaps(inputMap, matchesValidator.getPsmMap(), matchesValidator.getPeptideMap(), matchesValidator.getProteinMap()));
    if (setWaitingHandlerFinshedWhenDone) {
        waitingHandler.setRunFinished();
    }
}
Also used : ProteinInference(eu.isas.peptideshaker.protein_inference.ProteinInference) IdentificationFeaturesGenerator(com.compomics.util.experiment.identification.features.IdentificationFeaturesGenerator) PeptideInference(com.compomics.util.experiment.identification.peptide_inference.PeptideInference) MatchesValidator(eu.isas.peptideshaker.validation.MatchesValidator) ScalingFactorsEstimators(com.compomics.util.experiment.quantification.spectrumcounting.ScalingFactorsEstimators) PSMaps(eu.isas.peptideshaker.scoring.PSMaps) IdMatchValidationParameters(com.compomics.util.parameters.identification.advanced.IdMatchValidationParameters) FastaSummary(com.compomics.util.experiment.io.biology.protein.FastaSummary) PsmScorer(eu.isas.peptideshaker.scoring.psm_scoring.PsmScorer) TargetDecoyMap(eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyMap) PsmScoringParameters(com.compomics.util.parameters.identification.advanced.PsmScoringParameters) ModificationLocalizationParameters(com.compomics.util.parameters.identification.advanced.ModificationLocalizationParameters) ProteinProcessor(eu.isas.peptideshaker.processing.ProteinProcessor) GroupSimplification(eu.isas.peptideshaker.protein_inference.GroupSimplification) FastaParameters(com.compomics.util.experiment.io.biology.protein.FastaParameters) PsmProcessor(eu.isas.peptideshaker.processing.PsmProcessor)

Aggregations

PSMaps (eu.isas.peptideshaker.scoring.PSMaps)15 Identification (com.compomics.util.experiment.identification.Identification)4 ProgressDialogX (com.compomics.util.gui.waiting.waitinghandlers.ProgressDialogX)4 PSParameter (com.compomics.util.experiment.identification.peptide_shaker.PSParameter)3 SelfUpdatingTableModel (com.compomics.util.gui.tablemodels.SelfUpdatingTableModel)3 IdMatchValidationParameters (com.compomics.util.parameters.identification.advanced.IdMatchValidationParameters)3 MatchValidationDialog (eu.isas.peptideshaker.gui.MatchValidationDialog)3 ProteinProcessor (eu.isas.peptideshaker.processing.ProteinProcessor)3 TargetDecoyMap (eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyMap)3 TargetDecoyResults (eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyResults)3 MatchesValidator (eu.isas.peptideshaker.validation.MatchesValidator)3 IdentificationFeaturesGenerator (com.compomics.util.experiment.identification.features.IdentificationFeaturesGenerator)2 FastaSummary (com.compomics.util.experiment.io.biology.protein.FastaSummary)2 ModificationLocalizationParameters (com.compomics.util.parameters.identification.advanced.ModificationLocalizationParameters)2 SearchParameters (com.compomics.util.parameters.identification.search.SearchParameters)2 PeptideShakerParameters (eu.isas.peptideshaker.parameters.PeptideShakerParameters)2 ModificationLocalizationScorer (eu.isas.peptideshaker.ptm.ModificationLocalizationScorer)2 java.awt (java.awt)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2