Search in sources :

Example 1 with ProteinInferenceDialog

use of eu.isas.peptideshaker.gui.protein_inference.ProteinInferenceDialog 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 ProteinInferenceDialog

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

the class ProteinStructurePanel method proteinTableMouseReleased.

// GEN-LAST:event_pdbMatchesJTableKeyReleased
/**
 * Update the protein selection and the corresponding tables.
 *
 * @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 pdb file table
            updatePdbTable(proteinKey);
            // empty the jmol panel
            if (jmolStructureShown) {
                jmolPanel = new JmolPanel();
                pdbPanel.removeAll();
                pdbPanel.add(jmolPanel);
                pdbPanel.revalidate();
                pdbPanel.repaint();
                jmolStructureShown = false;
                currentlyDisplayedPdbFile = null;
                ((TitledBorder) pdbOuterPanel.getBorder()).setTitle(PeptideShakerGUI.TITLED_BORDER_HORIZONTAL_PADDING + "PDB Structure" + PeptideShakerGUI.TITLED_BORDER_HORIZONTAL_PADDING);
                pdbOuterPanel.repaint();
            }
            // update the peptide selection
            updatedPeptideSelection(proteinIndex);
            // remember the selection
            newItemSelection();
            this.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
            // open the gene details dialog
            if (column == proteinTable.getColumn("Chr").getModelIndex() && evt != null && evt.getButton() == MouseEvent.BUTTON1) {
                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());
            }
            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);
            }
        }
    }
}
Also used : GeneDetailsDialog(com.compomics.util.gui.genes.GeneDetailsDialog) SelfUpdatingTableModel(com.compomics.util.gui.tablemodels.SelfUpdatingTableModel) ProteinInferenceDialog(eu.isas.peptideshaker.gui.protein_inference.ProteinInferenceDialog) ProteinMatch(com.compomics.util.experiment.identification.matches.ProteinMatch) TitledBorder(javax.swing.border.TitledBorder) XYDataPoint(no.uib.jsparklines.data.XYDataPoint) PSParameter(com.compomics.util.experiment.identification.peptide_shaker.PSParameter)

Aggregations

PSParameter (com.compomics.util.experiment.identification.peptide_shaker.PSParameter)2 GeneDetailsDialog (com.compomics.util.gui.genes.GeneDetailsDialog)2 SelfUpdatingTableModel (com.compomics.util.gui.tablemodels.SelfUpdatingTableModel)2 ProteinInferenceDialog (eu.isas.peptideshaker.gui.protein_inference.ProteinInferenceDialog)2 Identification (com.compomics.util.experiment.identification.Identification)1 ProteinMatch (com.compomics.util.experiment.identification.matches.ProteinMatch)1 MatchValidationDialog (eu.isas.peptideshaker.gui.MatchValidationDialog)1 PSMaps (eu.isas.peptideshaker.scoring.PSMaps)1 java.awt (java.awt)1 TitledBorder (javax.swing.border.TitledBorder)1 XYDataPoint (no.uib.jsparklines.data.XYDataPoint)1