Search in sources :

Example 1 with JSparklinesBarChartTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer in project peptide-shaker by compomics.

the class SpectrumIdentificationPanel method setTableProperties.

/**
 * Set up the properties of the tables.
 */
private void setTableProperties() {
    // correct the color for the upper right corner
    JPanel spectrumCorner = new JPanel();
    spectrumCorner.setBackground(spectrumTable.getTableHeader().getBackground());
    spectrumTableJScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, spectrumCorner);
    JPanel idResultsCorner = new JPanel();
    idResultsCorner.setBackground(searchResultsTable.getTableHeader().getBackground());
    idResultsTableJScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, idResultsCorner);
    peptideShakerJTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    searchResultsTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    peptideShakerJTable.getTableHeader().setReorderingAllowed(false);
    spectrumTable.getTableHeader().setReorderingAllowed(false);
    searchResultsTable.getTableHeader().setReorderingAllowed(false);
    spectrumTable.setAutoCreateRowSorter(true);
    // make sure that the user is made aware that the tool is doing something during sorting of the spectrum table
    spectrumTable.getRowSorter().addRowSorterListener(new RowSorterListener() {

        @Override
        public void sorterChanged(RowSorterEvent e) {
            if (e.getType() == RowSorterEvent.Type.SORT_ORDER_CHANGED) {
                peptideShakerGUI.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
                spectrumTable.getTableHeader().setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
                // change the peptide shaker icon to a "waiting version"
                peptideShakerGUI.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker-orange.gif")));
            } else if (e.getType() == RowSorterEvent.Type.SORTED) {
                peptideShakerGUI.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
                spectrumTable.getTableHeader().setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
                // change the peptide shaker icon to a "waiting version"
                peptideShakerGUI.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
            }
        }
    });
    spectrumTable.getTableHeader().addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            spectrumTableMouseClicked(e);
        }
    });
    peptideShakerJTable.getColumn(" ").setMinWidth(30);
    peptideShakerJTable.getColumn(" ").setMaxWidth(30);
    peptideShakerJTable.getColumn("  ").setMinWidth(30);
    peptideShakerJTable.getColumn("  ").setMaxWidth(30);
    spectrumTable.getColumn(" ").setMinWidth(50);
    spectrumTable.getColumn(" ").setMaxWidth(50);
    spectrumTable.getColumn("  ").setMinWidth(30);
    spectrumTable.getColumn("  ").setMaxWidth(30);
    spectrumTable.getColumn("Confidence").setMaxWidth(90);
    spectrumTable.getColumn("Confidence").setMinWidth(90);
    searchResultsTable.getColumn(" ").setMinWidth(30);
    searchResultsTable.getColumn(" ").setMaxWidth(30);
    searchResultsTable.getColumn("SE").setMinWidth(37);
    searchResultsTable.getColumn("SE").setMaxWidth(37);
    searchResultsTable.getColumn("Rnk").setMinWidth(37);
    searchResultsTable.getColumn("Rnk").setMaxWidth(37);
    searchResultsTable.getColumn("  ").setMinWidth(30);
    searchResultsTable.getColumn("  ").setMaxWidth(30);
    peptideShakerJTable.getColumn("ID").setMaxWidth(37);
    peptideShakerJTable.getColumn("ID").setMinWidth(37);
    spectrumTable.getColumn("ID").setMaxWidth(37);
    spectrumTable.getColumn("ID").setMinWidth(37);
    peptideShakerJTable.getColumn("Confidence").setMaxWidth(90);
    peptideShakerJTable.getColumn("Confidence").setMinWidth(90);
    searchResultsTable.getColumn("Confidence").setMaxWidth(90);
    searchResultsTable.getColumn("Confidence").setMinWidth(90);
    searchResultsTable.getColumn("Charge").setMaxWidth(90);
    searchResultsTable.getColumn("Charge").setMinWidth(90);
    // set up the psm color map
    HashMap<Integer, java.awt.Color> softwareAgreementColorMap = new HashMap<>();
    // id softwares agree with PTM certainty
    softwareAgreementColorMap.put(AGREEMENT_WITH_MODS, peptideShakerGUI.getSparklineColor());
    // id softwares agree on peptide but not ptm certainty
    softwareAgreementColorMap.put(AGREEMENT, java.awt.Color.CYAN);
    // id softwares don't agree
    softwareAgreementColorMap.put(CONFLICT, java.awt.Color.YELLOW);
    // some id softwares id'ed some didn't
    softwareAgreementColorMap.put(PARTIALLY_MISSING, java.awt.Color.ORANGE);
    // set up the psm tooltip map
    HashMap<Integer, String> idSoftwareTooltipMap = new HashMap<>();
    idSoftwareTooltipMap.put(AGREEMENT_WITH_MODS, "ID Software Agree");
    idSoftwareTooltipMap.put(AGREEMENT, "ID Software Agree - PTM Certainty Issues");
    idSoftwareTooltipMap.put(CONFLICT, "ID Software Disagree");
    idSoftwareTooltipMap.put(PARTIALLY_MISSING, "ID Software(s) Missing");
    peptideShakerJTable.getColumn("ID").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(java.awt.Color.lightGray, softwareAgreementColorMap, idSoftwareTooltipMap));
    peptideShakerJTable.getColumn("Protein(s)").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    peptideShakerJTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) peptideShakerJTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
    searchResultsTable.getColumn("SE").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(java.awt.Color.lightGray, Advocate.getAdvocateColorMap(), Advocate.getAdvocateToolTipMap()));
    searchResultsTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) searchResultsTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
    searchResultsTable.getColumn("Charge").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 10d, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) searchResultsTable.getColumn("Charge").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 30);
    // set up the psm color map
    HashMap<Integer, java.awt.Color> idSoftwareSpectrumLevelColorMap = new HashMap<>();
    // id softwares agree with PTM certainty
    idSoftwareSpectrumLevelColorMap.put(AGREEMENT_WITH_MODS, peptideShakerGUI.getSparklineColor());
    // id softwares agree on peptide but not ptm certainty
    idSoftwareSpectrumLevelColorMap.put(AGREEMENT, java.awt.Color.CYAN);
    // id softwares don't agree
    idSoftwareSpectrumLevelColorMap.put(CONFLICT, java.awt.Color.YELLOW);
    // some id softwares id'ed some didn't
    idSoftwareSpectrumLevelColorMap.put(PARTIALLY_MISSING, java.awt.Color.ORANGE);
    // no psm
    idSoftwareSpectrumLevelColorMap.put(NO_ID, java.awt.Color.lightGray);
    // set up the psm tooltip map
    HashMap<Integer, String> idSoftwareSpectrumLevelTooltipMap = new HashMap<>();
    idSoftwareSpectrumLevelTooltipMap.put(AGREEMENT_WITH_MODS, "ID Software Agree");
    idSoftwareSpectrumLevelTooltipMap.put(AGREEMENT, "ID Software Agree - PTM Certainty Issues");
    idSoftwareSpectrumLevelTooltipMap.put(CONFLICT, "ID Software Disagree");
    idSoftwareSpectrumLevelTooltipMap.put(PARTIALLY_MISSING, "ID Software(s) Missing");
    idSoftwareSpectrumLevelTooltipMap.put(NO_ID, "(No PSM)");
    spectrumTable.getColumn("ID").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(java.awt.Color.lightGray, idSoftwareSpectrumLevelColorMap, idSoftwareSpectrumLevelTooltipMap));
    spectrumTable.getColumn("m/z").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, peptideShakerGUI.getSparklineColor()));
    spectrumTable.getColumn("Charge").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 4d, peptideShakerGUI.getSparklineColor()));
    spectrumTable.getColumn("Int").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 1000d, peptideShakerGUI.getSparklineColor()));
    spectrumTable.getColumn("RT (min)").setCellRenderer(new JSparklinesIntervalChartTableCellRenderer(PlotOrientation.HORIZONTAL, 0d, 1000d, 10d, peptideShakerGUI.getSparklineColor(), peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("m/z").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
    ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Charge").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 30);
    ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Int").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
    ((JSparklinesIntervalChartTableCellRenderer) spectrumTable.getColumn("RT (min)").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() + 5);
    ((JSparklinesIntervalChartTableCellRenderer) spectrumTable.getColumn("RT (min)").getCellRenderer()).showReferenceLine(true, 0.02, java.awt.Color.BLACK);
    spectrumTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
    spectrumTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    spectrumTable.getColumn("Protein(s)").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    // set up the table header tooltips
    idSoftwareTableToolTips = new ArrayList<>();
    idSoftwareTableToolTips.add(null);
    idSoftwareTableToolTips.add("Identification Software");
    idSoftwareTableToolTips.add("Validated Peptide Spectrum Matches");
    idSoftwareTableToolTips.add("Unique Pepttide-Spectrum Matches");
    idSoftwareTableToolTips.add("Unassigned Spectra");
    idSoftwareTableToolTips.add("Identificaiton Rate (%)");
    if (peptideShakerGUI.getDisplayParameters().showScores()) {
        spectrumTable.getColumn("Score").setMaxWidth(90);
        spectrumTable.getColumn("Score").setMinWidth(90);
        peptideShakerJTable.getColumn("Score").setMaxWidth(90);
        peptideShakerJTable.getColumn("Score").setMinWidth(90);
        searchResultsTable.getColumn("Score").setMaxWidth(90);
        searchResultsTable.getColumn("Score").setMinWidth(90);
        spectrumTable.getColumn("Score").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
        ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Score").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
        peptideShakerJTable.getColumn("Score").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, peptideShakerGUI.getSparklineColor()));
        ((JSparklinesBarChartTableCellRenderer) peptideShakerJTable.getColumn("Score").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
        searchResultsTable.getColumn("Score").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, peptideShakerGUI.getSparklineColor()));
        ((JSparklinesBarChartTableCellRenderer) searchResultsTable.getColumn("Score").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
        spectrumTableToolTips = new ArrayList<>();
        spectrumTableToolTips.add(null);
        spectrumTableToolTips.add("ID Software Agreement");
        spectrumTableToolTips.add("Spectrum Title");
        spectrumTableToolTips.add("Precursor m/z");
        spectrumTableToolTips.add("Precursor Charge");
        spectrumTableToolTips.add("Precursor Intensity");
        spectrumTableToolTips.add("Precursor Retention Time in Minutes");
        spectrumTableToolTips.add("Peptide Sequence");
        spectrumTableToolTips.add("Mapping Protein(s)");
        spectrumTableToolTips.add("Peptide Spectrum Match Score");
        spectrumTableToolTips.add("Peptide Spectrum Match Confidence");
        spectrumTableToolTips.add("Validated");
        peptideShakerTableToolTips = new ArrayList<>();
        peptideShakerTableToolTips.add(null);
        peptideShakerTableToolTips.add("ID Software Agreement");
        peptideShakerTableToolTips.add("Peptide Sequence");
        peptideShakerTableToolTips.add("Mapping Protein(s)");
        peptideShakerTableToolTips.add("Peptide Spectrum Match score");
        peptideShakerTableToolTips.add("Peptide Spectrum Match Confidence");
        peptideShakerTableToolTips.add("Validated");
        idResultsTableToolTips = new ArrayList<>();
        idResultsTableToolTips.add("Peptide Rank");
        idResultsTableToolTips.add("Search Engine / Identification Software");
        idResultsTableToolTips.add("Search Engine Rank / Identification Software Rank");
        idResultsTableToolTips.add("Peptide Sequence");
        idResultsTableToolTips.add("Precursor Charge");
        idResultsTableToolTips.add("Peptide Spectrum Match Score");
        idResultsTableToolTips.add("Peptide Spectrum Match Confidence");
        idResultsTableToolTips.add("Validated");
    } else {
        // set up the table header tooltips
        spectrumTableToolTips = new ArrayList<>();
        spectrumTableToolTips.add(null);
        spectrumTableToolTips.add("ID Software Agreement");
        spectrumTableToolTips.add("Spectrum Title");
        spectrumTableToolTips.add("Precursor m/z");
        spectrumTableToolTips.add("Precursor Charge");
        spectrumTableToolTips.add("Precursor Intensity");
        spectrumTableToolTips.add("Precursor Retention Time in Minutes");
        spectrumTableToolTips.add("Peptide Sequence");
        spectrumTableToolTips.add("Mapping Protein(s)");
        spectrumTableToolTips.add("Peptide Spectrum Match Confidence");
        spectrumTableToolTips.add("Validated");
        peptideShakerTableToolTips = new ArrayList<>();
        peptideShakerTableToolTips.add(null);
        peptideShakerTableToolTips.add("ID Software Agreement");
        peptideShakerTableToolTips.add("Peptide Sequence");
        peptideShakerTableToolTips.add("Mapping Protein(s)");
        peptideShakerTableToolTips.add("Peptide Spectrum Match Confidence");
        peptideShakerTableToolTips.add("Validated");
        idResultsTableToolTips = new ArrayList<>();
        idResultsTableToolTips.add("Peptide Rank");
        idResultsTableToolTips.add("Search Engine / Identification Software");
        idResultsTableToolTips.add("Search Engine Rank / Identification Software Rank");
        idResultsTableToolTips.add("Peptide Sequence");
        idResultsTableToolTips.add("Precursor Charge");
        idResultsTableToolTips.add("Peptide Spectrum Match Confidence");
        idResultsTableToolTips.add("Validated");
    }
}
Also used : JPanel(javax.swing.JPanel) MouseEvent(java.awt.event.MouseEvent) HashMap(java.util.HashMap) MouseAdapter(java.awt.event.MouseAdapter) JSparklinesIntegerIconTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer) JSparklinesIntegerColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer) JSparklinesIntervalChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntervalChartTableCellRenderer) RowSorterEvent(javax.swing.event.RowSorterEvent) JSparklinesBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer) RowSorterListener(javax.swing.event.RowSorterListener) HtmlLinksRenderer(no.uib.jsparklines.extra.HtmlLinksRenderer)

Example 2 with JSparklinesBarChartTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer in project peptide-shaker by compomics.

the class SpectrumIdentificationPanel method updateSparklines.

/**
 * Update the sparklines.
 */
private void updateSparklines() {
    if (identification != null) {
        SpectrumProvider spectrumProvider = peptideShakerGUI.getSpectrumProvider();
        int maxCharge = peptideShakerGUI.getMetrics().getMaxCharge();
        spectrumTable.getColumn("Charge").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, (double) maxCharge, peptideShakerGUI.getSparklineColor()));
        spectrumTable.getColumn("Int").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, spectrumProvider.getMaxPrecInt(), peptideShakerGUI.getSparklineColor()));
        spectrumTable.getColumn("RT (min)").setCellRenderer(new JSparklinesIntervalChartTableCellRenderer(PlotOrientation.HORIZONTAL, 0.0, (spectrumProvider.getMaxPrecRT() / 60), (spectrumProvider.getMaxPrecRT() / 60) / 50, peptideShakerGUI.getSparklineColor(), peptideShakerGUI.getSparklineColor()));
        ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Charge").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 30);
        if (spectrumProvider.getMaxPrecInt() > 100000) {
            ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Int").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() + 20, new DecimalFormat("0.00E00"));
        } else {
            ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Int").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() + 20);
        }
        ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Int").getCellRenderer()).setLogScale(true);
        ((JSparklinesIntervalChartTableCellRenderer) spectrumTable.getColumn("RT (min)").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
        ((JSparklinesIntervalChartTableCellRenderer) spectrumTable.getColumn("RT (min)").getCellRenderer()).showReferenceLine(true, 0.02, java.awt.Color.BLACK);
    }
}
Also used : DecimalFormat(java.text.DecimalFormat) JSparklinesIntervalChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntervalChartTableCellRenderer) JSparklinesBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer) SpectrumProvider(com.compomics.util.experiment.mass_spectrometry.SpectrumProvider)

Example 3 with JSparklinesBarChartTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer in project peptide-shaker by compomics.

the class ProteinStructurePanel method setPdbTablesProperties.

/**
 * Set up the properties of the PDB and PDB chains tables.
 */
private void setPdbTablesProperties() {
    pdbMatchesJTable.getColumn(" ").setMaxWidth(50);
    pdbChainsJTable.getColumn(" ").setMaxWidth(50);
    pdbMatchesJTable.getColumn("PDB").setMaxWidth(50);
    pdbChainsJTable.getColumn("Chain").setMaxWidth(50);
    pdbMatchesJTable.getColumn(" ").setMinWidth(50);
    pdbChainsJTable.getColumn(" ").setMinWidth(50);
    pdbMatchesJTable.getColumn("PDB").setMinWidth(50);
    pdbChainsJTable.getColumn("Chain").setMinWidth(50);
    pdbMatchesJTable.getColumn("Chains").setMinWidth(100);
    pdbMatchesJTable.getColumn("Chains").setMaxWidth(100);
    pdbMatchesJTable.getTableHeader().setReorderingAllowed(false);
    pdbChainsJTable.getTableHeader().setReorderingAllowed(false);
    pdbChainsJTable.setAutoCreateRowSorter(true);
    pdbMatchesJTable.setAutoCreateRowSorter(true);
    pdbMatchesJTable.getColumn("PDB").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    pdbMatchesJTable.getColumn("Chains").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 10.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) pdbMatchesJTable.getColumn("Chains").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
    pdbChainsJTable.getColumn("Coverage").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) pdbChainsJTable.getColumn("Coverage").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
    pdbChainsJTable.getColumn("PDB-Protein").setCellRenderer(new JSparklinesIntervalChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, 10.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesIntervalChartTableCellRenderer) pdbChainsJTable.getColumn("PDB-Protein").getCellRenderer()).showReferenceLine(true, 0.02, Color.BLACK);
}
Also used : JSparklinesIntervalChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntervalChartTableCellRenderer) JSparklinesBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer) HtmlLinksRenderer(no.uib.jsparklines.extra.HtmlLinksRenderer)

Example 4 with JSparklinesBarChartTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer in project peptide-shaker by compomics.

the class GOEAPanel method setUpGUI.

/**
 * Set up the GUI details.
 */
private void setUpGUI() {
    // correct the color for the upper right corner
    JPanel proteinCorner = new JPanel();
    proteinCorner.setBackground(goMappingsTable.getTableHeader().getBackground());
    proteinsScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, proteinCorner);
    JPanel goMappingsCorner = new JPanel();
    goMappingsCorner.setBackground(goMappingsTable.getTableHeader().getBackground());
    proteinGoMappingsScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, goMappingsCorner);
    JTableHeader header = goMappingsTable.getTableHeader();
    header.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            super.mouseClicked(e);
            if (peptideShakerGUI.getIdentification() != null) {
                updateGoPlots();
            }
        }
    });
    goMappingsTable.getTableHeader().setReorderingAllowed(false);
    proteinTable.getTableHeader().setReorderingAllowed(false);
    goMappingsTable.setAutoCreateRowSorter(true);
    proteinTable.setAutoCreateRowSorter(true);
    // make sure that the scroll panes are see-through
    proteinGoMappingsScrollPane.getViewport().setOpaque(false);
    proteinsScrollPane.getViewport().setOpaque(false);
    // the index column
    goMappingsTable.getColumn("").setMaxWidth(60);
    goMappingsTable.getColumn("").setMinWidth(60);
    goMappingsTable.getColumn("  ").setMaxWidth(30);
    goMappingsTable.getColumn("  ").setMinWidth(30);
    double significanceLevel = 0.05;
    if (onePercentRadioButton.isSelected()) {
        significanceLevel = 0.01;
    }
    // cell renderers
    goMappingsTable.getColumn("GO Accession").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    goMappingsTable.getColumn("Frequency All (%)").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, Color.RED));
    ((JSparklinesBarChartTableCellRenderer) goMappingsTable.getColumn("Frequency All (%)").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
    goMappingsTable.getColumn("Frequency Dataset (%)").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) goMappingsTable.getColumn("Frequency Dataset (%)").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
    goMappingsTable.getColumn("p-value").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 1.0, peptideShakerGUI.getSparklineColor(), Color.lightGray, significanceLevel));
    ((JSparklinesBarChartTableCellRenderer) goMappingsTable.getColumn("p-value").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
    goMappingsTable.getColumn("Log2 Diff").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, -10.0, 10.0, Color.RED, peptideShakerGUI.getSparklineColor(), Color.lightGray, 0));
    ((JSparklinesBarChartTableCellRenderer) goMappingsTable.getColumn("Log2 Diff").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
    goMappingsTable.getColumn("Frequency (%)").setCellRenderer(new JSparklinesTableCellRenderer(JSparklinesTableCellRenderer.PlotType.barChart, PlotOrientation.HORIZONTAL, 0.0, 100.0));
    goMappingsTable.getColumn("  ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/selected_green-new.png")), null, "Selected", null));
    // make the tabs in the tabbed pane go from right to left
    goPlotsTabbedPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    // set up the table header tooltips
    mappingsTableToolTips = new ArrayList<>();
    mappingsTableToolTips.add(null);
    mappingsTableToolTips.add("Gene Ontology Accession");
    mappingsTableToolTips.add("Gene Ontology Term");
    mappingsTableToolTips.add("Gene Ontology Domain");
    mappingsTableToolTips.add("Frequency All (%)");
    mappingsTableToolTips.add("Frequency Dataset (%)");
    mappingsTableToolTips.add("Frequency (%) (All & Dataset))");
    mappingsTableToolTips.add("Log2 Difference (Dataset / All)");
    mappingsTableToolTips.add("<html>Hypergeometic Test<br>FDR-Corrected</html>");
    mappingsTableToolTips.add("Selected for Plots");
    proteinTableToolTips = new ArrayList<>();
    proteinTableToolTips.add(null);
    proteinTableToolTips.add("Protein Accession Number");
    proteinTableToolTips.add("Protein Description");
    proteinTableToolTips.add("Protein Sequence Coverage (%) (Confident / Doubtful / Not Validated / Possible)");
    proteinTableToolTips.add("Number of Peptides (Validated / Doubtful / Not Validated)");
    proteinTableToolTips.add("Number of Spectra (Validated / Doubtful / Not Validated)");
    proteinTableToolTips.add("MS2 Quantification");
    proteinTableToolTips.add("Protein Confidence");
    proteinTableToolTips.add("Validated");
}
Also used : JSparklinesTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesTableCellRenderer) ChartMouseEvent(org.jfree.chart.ChartMouseEvent) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) JTableHeader(javax.swing.table.JTableHeader) JSparklinesBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer) HtmlLinksRenderer(no.uib.jsparklines.extra.HtmlLinksRenderer) TrueFalseIconRenderer(no.uib.jsparklines.extra.TrueFalseIconRenderer)

Example 5 with JSparklinesBarChartTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer in project peptide-shaker by compomics.

the class ProteinInferenceDialog method setColumnProperies.

/**
 * Set the properties for the columns in the results tables.
 */
private void setColumnProperies() {
    proteinMatchTable.getTableHeader().setReorderingAllowed(false);
    uniqueHitsTable.getTableHeader().setReorderingAllowed(false);
    relatedHitsTable.getTableHeader().setReorderingAllowed(false);
    proteinMatchTable.getColumn("  ").setMinWidth(50);
    proteinMatchTable.getColumn("  ").setMaxWidth(50);
    proteinMatchTable.getColumn("Gene").setMinWidth(90);
    proteinMatchTable.getColumn("Gene").setMaxWidth(90);
    proteinMatchTable.getColumn("Chr").setMinWidth(90);
    proteinMatchTable.getColumn("Chr").setMaxWidth(90);
    proteinMatchTable.getColumn("Evidence").setMinWidth(90);
    proteinMatchTable.getColumn("Evidence").setMaxWidth(90);
    proteinMatchTable.getColumn("Enz").setMinWidth(50);
    proteinMatchTable.getColumn("Enz").setMaxWidth(50);
    // set the preferred size of the accession column
    Integer width = ProteinTableModel.getPreferredAccessionColumnWidth(proteinMatchTable, proteinMatchTable.getColumn("Accession").getModelIndex(), 6, peptideShakerGUI.getMetrics().getMaxProteinAccessionLength());
    if (width != null) {
        proteinMatchTable.getColumn("Accession").setMinWidth(width);
        proteinMatchTable.getColumn("Accession").setMaxWidth(width);
    } else {
        proteinMatchTable.getColumn("Accession").setMinWidth(15);
        proteinMatchTable.getColumn("Accession").setMaxWidth(Integer.MAX_VALUE);
    }
    // the validated column
    uniqueHitsTable.getColumn(" ").setMaxWidth(30);
    relatedHitsTable.getColumn(" ").setMaxWidth(30);
    uniqueHitsTable.getColumn(" ").setMinWidth(30);
    relatedHitsTable.getColumn(" ").setMinWidth(30);
    proteinMatchTable.getColumn("").setMaxWidth(50);
    uniqueHitsTable.getColumn("").setMaxWidth(50);
    relatedHitsTable.getColumn("").setMaxWidth(50);
    proteinMatchTable.getColumn("").setMinWidth(50);
    uniqueHitsTable.getColumn("").setMinWidth(50);
    relatedHitsTable.getColumn("").setMinWidth(50);
    // the score and confidence columns
    uniqueHitsTable.getColumn("Confidence").setMaxWidth(90);
    uniqueHitsTable.getColumn("Confidence").setMinWidth(90);
    relatedHitsTable.getColumn("Confidence").setMaxWidth(90);
    relatedHitsTable.getColumn("Confidence").setMinWidth(90);
    // change the cell renderer to fix a problem in Nimbus and alternating row colors
    proteinMatchTable.getColumn("  ").setCellRenderer(new NimbusCheckBoxRenderer());
    proteinMatchTable.getColumn("Accession").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    proteinMatchTable.getColumn("Chr").setCellRenderer(new ChromosomeTableCellRenderer(Color.WHITE, Color.BLACK));
    proteinMatchTable.getColumn("Enz").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/selected_green-new.png")), null, "Enzymatic", "Not Enzymatic"));
    uniqueHitsTable.getColumn("Protein(s)").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    uniqueHitsTable.getColumn(" ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    uniqueHitsTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) uniqueHitsTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() + 5);
    relatedHitsTable.getColumn("Protein(s)").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    relatedHitsTable.getColumn(" ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    relatedHitsTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) relatedHitsTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() + 5);
    // set up the table header tooltips
    candidateProteinsTableToolTips = new ArrayList<>();
    candidateProteinsTableToolTips.add(null);
    candidateProteinsTableToolTips.add("Protein Group Representative");
    candidateProteinsTableToolTips.add("Protein Accession");
    candidateProteinsTableToolTips.add("Protein Description");
    candidateProteinsTableToolTips.add("Gene Name");
    candidateProteinsTableToolTips.add("Chromosome Number");
    candidateProteinsTableToolTips.add("Protein Evidence Level");
    candidateProteinsTableToolTips.add("Contains Enzymatic Peptides");
    uniqueHitsTableToolTips = new ArrayList<>();
    uniqueHitsTableToolTips.add(null);
    uniqueHitsTableToolTips.add("Protein Accession(s)");
    uniqueHitsTableToolTips.add("Protein Confidence");
    uniqueHitsTableToolTips.add("Validated");
    relatedHitsTableToolTips = new ArrayList<>();
    relatedHitsTableToolTips.add(null);
    relatedHitsTableToolTips.add("Protein Accession(s)");
    relatedHitsTableToolTips.add("Protein Confidence");
    relatedHitsTableToolTips.add("Validated");
}
Also used : ImageIcon(javax.swing.ImageIcon) ChromosomeTableCellRenderer(no.uib.jsparklines.extra.ChromosomeTableCellRenderer) NimbusCheckBoxRenderer(no.uib.jsparklines.extra.NimbusCheckBoxRenderer) JSparklinesIntegerIconTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer) JSparklinesBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer) HtmlLinksRenderer(no.uib.jsparklines.extra.HtmlLinksRenderer) TrueFalseIconRenderer(no.uib.jsparklines.extra.TrueFalseIconRenderer)

Aggregations

JSparklinesBarChartTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer)17 DefaultTableModel (javax.swing.table.DefaultTableModel)7 HtmlLinksRenderer (no.uib.jsparklines.extra.HtmlLinksRenderer)6 FileNotFoundException (java.io.FileNotFoundException)5 IOException (java.io.IOException)5 MalformedURLException (java.net.MalformedURLException)5 JSparklinesIntegerIconTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer)5 HttpMessageNotReadableException (org.springframework.http.converter.HttpMessageNotReadableException)5 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)5 HttpServerErrorException (org.springframework.web.client.HttpServerErrorException)5 ResourceAccessException (org.springframework.web.client.ResourceAccessException)5 RestTemplate (org.springframework.web.client.RestTemplate)5 ArrayList (java.util.ArrayList)4 TitledBorder (javax.swing.border.TitledBorder)4 TrueFalseIconRenderer (no.uib.jsparklines.extra.TrueFalseIconRenderer)4 ProgressDialogX (com.compomics.util.gui.waiting.waitinghandlers.ProgressDialogX)3 DecimalFormat (java.text.DecimalFormat)3 HashMap (java.util.HashMap)3 JSparklinesIntegerColorTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer)3 JSparklinesIntervalChartTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntervalChartTableCellRenderer)3