Search in sources :

Example 1 with MatchValidationDialog

use of eu.isas.peptideshaker.gui.MatchValidationDialog 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 2 with MatchValidationDialog

use of eu.isas.peptideshaker.gui.MatchValidationDialog 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 3 with MatchValidationDialog

use of eu.isas.peptideshaker.gui.MatchValidationDialog in project peptide-shaker by compomics.

the class OverviewPanel method peptideTableMouseReleased.

// GEN-LAST:event_proteinTableMouseReleased
/**
 * Updates the tables according to the currently selected peptide.
 *
 * @param evt
 */
private void peptideTableMouseReleased(java.awt.event.MouseEvent evt) {
    // GEN-FIRST:event_peptideTableMouseReleased
    int row = peptideTable.getSelectedRow();
    final int column = peptideTable.getSelectedColumn();
    if (row != -1) {
        SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) peptideTable.getModel();
        int peptideIndex = tableModel.getViewIndex(row);
        long peptideKey = peptideKeys[peptideIndex];
        peptideShakerGUI.setSelectedItems(peptideShakerGUI.getSelectedProteinKey(), peptideKey, null, null);
        // update the psm selection
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                updatePsmSelection(row, false);
            }
        });
        // new peptide, reset spectrum boundaries
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                if (psmTable.getSelectedRow() != -1) {
                    SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) psmTable.getModel();
                    updateSpectrum(tableModel.getViewIndex(psmTable.getSelectedRow()), true);
                    peptideShakerGUI.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
                }
            }
        });
        // star/unstar a peptide
        if (column == peptideTable.getColumn("  ").getModelIndex()) {
            PeptideMatch peptideMatch = peptideShakerGUI.getIdentification().getPeptideMatch(peptideKey);
            PSParameter psParameter = (PSParameter) peptideMatch.getUrParam(PSParameter.dummy);
            if (!psParameter.getStarred()) {
                peptideShakerGUI.getStarHider().starPeptide(peptideKey);
            } else {
                peptideShakerGUI.getStarHider().unStarPeptide(peptideKey);
            }
            peptideShakerGUI.setDataSaved(false);
        }
        // open the protein inference at the petide level dialog
        if (column == peptideTable.getColumn("PI").getModelIndex() && evt != null && evt.getButton() == MouseEvent.BUTTON1) {
            tableModel = (SelfUpdatingTableModel) proteinTable.getModel();
            long proteinKey = proteinKeys[tableModel.getViewIndex(proteinTable.getSelectedRow())];
            new ProteinInferencePeptideLevelDialog(peptideShakerGUI, true, peptideKey, proteinKey, peptideShakerGUI.getGeneMaps());
        }
        // open the match validation level dialog
        if (column == peptideTable.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.getPeptideMap(), peptideKey, peptideShakerGUI.getIdentificationParameters(), peptideShakerGUI.getProjectDetails().getFastaFile(), MatchType.PEPTIDE);
            if (matchValidationDialog.isValidationChanged()) {
                updateProteinPanelTitle();
                updatePeptidePanelTitle();
            }
        }
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                try {
                    updateSelection(true);
                } catch (Exception e) {
                    peptideShakerGUI.catchException(e);
                }
            }
        });
    }
}
Also used : PSMaps(eu.isas.peptideshaker.scoring.PSMaps) SelfUpdatingTableModel(com.compomics.util.gui.tablemodels.SelfUpdatingTableModel) Identification(com.compomics.util.experiment.identification.Identification) ProteinInferencePeptideLevelDialog(eu.isas.peptideshaker.gui.protein_inference.ProteinInferencePeptideLevelDialog) MatchValidationDialog(eu.isas.peptideshaker.gui.MatchValidationDialog) PSParameter(com.compomics.util.experiment.identification.peptide_shaker.PSParameter) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

Identification (com.compomics.util.experiment.identification.Identification)3 PSParameter (com.compomics.util.experiment.identification.peptide_shaker.PSParameter)3 SelfUpdatingTableModel (com.compomics.util.gui.tablemodels.SelfUpdatingTableModel)3 MatchValidationDialog (eu.isas.peptideshaker.gui.MatchValidationDialog)3 PSMaps (eu.isas.peptideshaker.scoring.PSMaps)3 java.awt (java.awt)2 GeneDetailsDialog (com.compomics.util.gui.genes.GeneDetailsDialog)1 ProteinInferenceDialog (eu.isas.peptideshaker.gui.protein_inference.ProteinInferenceDialog)1 ProteinInferencePeptideLevelDialog (eu.isas.peptideshaker.gui.protein_inference.ProteinInferencePeptideLevelDialog)1 FileNotFoundException (java.io.FileNotFoundException)1