Search in sources :

Example 1 with TrueFalseIconRenderer

use of no.uib.jsparklines.extra.TrueFalseIconRenderer in project peptide-shaker by compomics.

the class ProteinStructurePanel method setPeptideTableProperties.

/**
 * Set up the properties of the peptide table.
 */
private void setPeptideTableProperties() {
    peptideTable.getColumn(" ").setMaxWidth(50);
    peptideTable.getColumn(" ").setMinWidth(50);
    peptideTable.getColumn("PDB").setMinWidth(50);
    peptideTable.getColumn("PDB").setMaxWidth(50);
    peptideTable.getColumn("Start").setMinWidth(50);
    // the validated column
    peptideTable.getColumn("").setMaxWidth(30);
    peptideTable.getColumn("").setMinWidth(30);
    // the selected columns
    peptideTable.getColumn("  ").setMaxWidth(30);
    peptideTable.getColumn("  ").setMinWidth(30);
    // the protein inference column
    peptideTable.getColumn("PI").setMaxWidth(37);
    peptideTable.getColumn("PI").setMinWidth(37);
    peptideTable.getTableHeader().setReorderingAllowed(false);
    // set up the peptide inference color map
    HashMap<Integer, Color> peptideInferenceColorMap = new HashMap<>();
    peptideInferenceColorMap.put(PSParameter.NOT_GROUP, peptideShakerGUI.getSparklineColor());
    peptideInferenceColorMap.put(PSParameter.RELATED, Color.YELLOW);
    peptideInferenceColorMap.put(PSParameter.RELATED_AND_UNRELATED, Color.ORANGE);
    peptideInferenceColorMap.put(PSParameter.UNRELATED, Color.RED);
    // set up the peptide inference tooltip map
    HashMap<Integer, String> peptideInferenceTooltipMap = new HashMap<>();
    peptideInferenceTooltipMap.put(PSParameter.NOT_GROUP, "Unique to a single protein");
    peptideInferenceTooltipMap.put(PSParameter.RELATED, "Belongs to a group of related proteins");
    peptideInferenceTooltipMap.put(PSParameter.RELATED_AND_UNRELATED, "Belongs to a group of related and unrelated proteins");
    peptideInferenceTooltipMap.put(PSParameter.UNRELATED, "Belongs to unrelated proteins");
    peptideTable.getColumn("PI").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(peptideShakerGUI.getSparklineColor(), peptideInferenceColorMap, peptideInferenceTooltipMap));
    peptideTable.getColumn("Start").setCellRenderer(new JSparklinesMultiIntervalChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, 100d, peptideShakerGUI.getSparklineColor()));
    peptideTable.getColumn("PDB").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/pdb.png")), null, "Mapped to PDB Structure", null));
    peptideTable.getColumn("").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    peptideTable.getColumn("  ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/star_yellow.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), "Starred", null, null));
}
Also used : JSparklinesIntegerColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer) HashMap(java.util.HashMap) JSparklinesMultiIntervalChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesMultiIntervalChartTableCellRenderer) Color(java.awt.Color) JSparklinesIntegerIconTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer) TrueFalseIconRenderer(no.uib.jsparklines.extra.TrueFalseIconRenderer)

Example 2 with TrueFalseIconRenderer

use of no.uib.jsparklines.extra.TrueFalseIconRenderer 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 3 with TrueFalseIconRenderer

use of no.uib.jsparklines.extra.TrueFalseIconRenderer in project peptide-shaker by compomics.

the class PrideReshakeGUI method setUpGui.

/**
 * Set up the GUI.
 */
private void setUpGui() {
    clearProjectFiltersLabel.setVisible(false);
    setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
    // set up the reshakeable files
    reshakeableFiles = new HashMap<>();
    // add pride xml and mgf
    reshakeableFiles.put("RESULT", new ArrayList<>());
    reshakeableFiles.get("RESULT").add(".xml");
    reshakeableFiles.get("RESULT").add(".xml.gz");
    reshakeableFiles.get("RESULT").add(".xml.zip");
    reshakeableFiles.put("PEAK", new ArrayList<>());
    reshakeableFiles.get("PEAK").add(ProteoWizardMsFormat.mgf.fileNameEnding);
    reshakeableFiles.get("PEAK").add(ProteoWizardMsFormat.mgf.fileNameEnding + ".gz");
    reshakeableFiles.get("PEAK").add(ProteoWizardMsFormat.mgf.fileNameEnding + ".zip");
    // add the raw file formats
    reshakeableFiles.put("RAW", new ArrayList<>());
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.raw.fileNameEnding);
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.raw.fileNameEnding + ".gz");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.raw.fileNameEnding + ".zip");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.mzML.fileNameEnding);
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.mzML.fileNameEnding + ".gz");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.mzML.fileNameEnding + ".zip");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.mzXML.fileNameEnding);
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.mzXML.fileNameEnding + ".gz");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.mzXML.fileNameEnding + ".zip");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.baf.fileNameEnding);
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.baf.fileNameEnding + ".gz");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.baf.fileNameEnding + ".zip");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.fid.fileNameEnding);
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.fid.fileNameEnding + ".gz");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.fid.fileNameEnding + ".zip");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.yep.fileNameEnding);
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.yep.fileNameEnding + ".gz");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.yep.fileNameEnding + ".zip");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.d.fileNameEnding);
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.d.fileNameEnding + ".gz");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.d.fileNameEnding + ".zip");
    // reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.wiff.fileNameEnding); // @TODO: also requries the corresponding .scan file...
    // reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.wiff.fileNameEnding + ".gz");
    // reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.wiff.fileNameEnding + ".zip");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.mz5.fileNameEnding);
    // then check for incorrect labeling...
    reshakeableFiles.put("OTHER", new ArrayList<>());
    reshakeableFiles.get("OTHER").add(ProteoWizardMsFormat.mgf.fileNameEnding);
    reshakeableFiles.get("OTHER").add(ProteoWizardMsFormat.mgf.fileNameEnding + ".gz");
    reshakeableFiles.get("OTHER").add(ProteoWizardMsFormat.mgf.fileNameEnding + ".zip");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.mgf.fileNameEnding);
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.mgf.fileNameEnding + ".gz");
    reshakeableFiles.get("RAW").add(ProteoWizardMsFormat.mgf.fileNameEnding + ".zip");
    // the files from which settings can be extracted
    searchSettingsFiles = new HashMap<>();
    searchSettingsFiles.put("RESULT", new ArrayList<>());
    searchSettingsFiles.get("RESULT").add(".xml");
    searchSettingsFiles.get("RESULT").add(".xml.gz");
    searchSettingsFiles.get("RESULT").add(".xml.zip");
    searchSettingsFiles.get("RESULT").add(".mzid");
    searchSettingsFiles.get("RESULT").add(".mzid.gz");
    searchSettingsFiles.get("RESULT").add(".mzid.zip");
    int fixedColumnWidth = 110;
    projectsTable.getColumn("Accession").setMaxWidth(fixedColumnWidth);
    projectsTable.getColumn("Accession").setMinWidth(fixedColumnWidth);
    projectsTable.getColumn(" ").setMaxWidth(50);
    projectsTable.getColumn(" ").setMinWidth(50);
    projectsTable.getColumn("#Assays").setMaxWidth(fixedColumnWidth);
    projectsTable.getColumn("#Assays").setMinWidth(fixedColumnWidth);
    projectsTable.getColumn("Date").setMaxWidth(fixedColumnWidth);
    projectsTable.getColumn("Date").setMinWidth(fixedColumnWidth);
    projectsTable.getColumn("Type").setMaxWidth(fixedColumnWidth);
    projectsTable.getColumn("Type").setMinWidth(fixedColumnWidth);
    projectsTable.getColumn("  ").setMaxWidth(30);
    projectsTable.getColumn("  ").setMinWidth(30);
    assaysTable.getColumn("Accession").setMaxWidth(fixedColumnWidth);
    assaysTable.getColumn("Accession").setMinWidth(fixedColumnWidth);
    assaysTable.getColumn(" ").setMaxWidth(50);
    assaysTable.getColumn(" ").setMinWidth(50);
    assaysTable.getColumn("#Proteins").setMaxWidth(fixedColumnWidth);
    assaysTable.getColumn("#Proteins").setMinWidth(fixedColumnWidth);
    assaysTable.getColumn("#Peptides").setMaxWidth(fixedColumnWidth);
    assaysTable.getColumn("#Peptides").setMinWidth(fixedColumnWidth);
    assaysTable.getColumn("#Spectra").setMaxWidth(fixedColumnWidth);
    assaysTable.getColumn("#Spectra").setMinWidth(fixedColumnWidth);
    assaysTable.getColumn("  ").setMaxWidth(30);
    assaysTable.getColumn("  ").setMinWidth(30);
    filesTable.getColumn("Assay").setMaxWidth(fixedColumnWidth);
    filesTable.getColumn("Assay").setMinWidth(fixedColumnWidth);
    filesTable.getColumn(" ").setMaxWidth(50);
    filesTable.getColumn(" ").setMinWidth(50);
    filesTable.getColumn("  ").setMaxWidth(30);
    filesTable.getColumn("  ").setMinWidth(30);
    filesTable.getColumn("Download").setMaxWidth(fixedColumnWidth);
    filesTable.getColumn("Download").setMinWidth(fixedColumnWidth);
    filesTable.getColumn("Type").setMaxWidth(fixedColumnWidth);
    filesTable.getColumn("Type").setMinWidth(fixedColumnWidth);
    filesTable.getColumn("Size (MB)").setMaxWidth(fixedColumnWidth);
    filesTable.getColumn("Size (MB)").setMinWidth(fixedColumnWidth);
    // make sure that the scroll panes are see-through
    projectsScrollPane.getViewport().setOpaque(false);
    assayTableScrollPane.getViewport().setOpaque(false);
    filesTableScrollPane.getViewport().setOpaque(false);
    projectsTable.setAutoCreateRowSorter(true);
    assaysTable.setAutoCreateRowSorter(true);
    filesTable.setAutoCreateRowSorter(true);
    projectsTable.getTableHeader().setReorderingAllowed(false);
    assaysTable.getTableHeader().setReorderingAllowed(false);
    filesTable.getTableHeader().setReorderingAllowed(false);
    // correct the color for the upper right corner
    JPanel projectsCorner = new JPanel();
    projectsCorner.setBackground(projectsTable.getTableHeader().getBackground());
    projectsScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, projectsCorner);
    JPanel assayCorner = new JPanel();
    assayCorner.setBackground(assaysTable.getTableHeader().getBackground());
    assayTableScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, assayCorner);
    JPanel filesCorner = new JPanel();
    filesCorner.setBackground(filesTable.getTableHeader().getBackground());
    filesTableScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, filesCorner);
    projectsTable.getColumn("Accession").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    assaysTable.getColumn("Accession").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    filesTable.getColumn("Assay").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    filesTable.getColumn("Download").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    filesTable.getColumn("  ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/accept-new.png")), null, "Reshakeable", null));
    // set up the peptide inference color map
    HashMap<Integer, Color> clusterScoringColorMap = new HashMap<>();
    clusterScoringColorMap.put(0, peptideShakerGUI.getSparklineColorNotFound());
    clusterScoringColorMap.put(1, peptideShakerGUI.getSparklineColor());
    clusterScoringColorMap.put(2, peptideShakerGUI.getUtilitiesUserParameters().getSparklineColorPossible());
    clusterScoringColorMap.put(3, peptideShakerGUI.getUtilitiesUserParameters().getSparklineColorDoubtful());
    clusterScoringColorMap.put(4, peptideShakerGUI.getSparklineColorNonValidated());
    // set up the peptide inference tooltip map
    HashMap<Integer, String> clusterScoringTooltipMap = new HashMap<>();
    clusterScoringTooltipMap.put(0, "Not yet classified");
    clusterScoringTooltipMap.put(1, "High confidence");
    clusterScoringTooltipMap.put(2, "Good confidence");
    clusterScoringTooltipMap.put(3, "Moderate confidence");
    clusterScoringTooltipMap.put(4, "Low confidence");
    projectsTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(peptideShakerGUI.getSparklineColorNotFound(), clusterScoringColorMap, clusterScoringTooltipMap));
    assaysTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(peptideShakerGUI.getSparklineColorNotFound(), clusterScoringColorMap, clusterScoringTooltipMap));
    projectsTableToolTips = new ArrayList<>();
    projectsTableToolTips.add(null);
    projectsTableToolTips.add("Project Accession Number");
    projectsTableToolTips.add("Project Title");
    projectsTableToolTips.add("Project Tags");
    projectsTableToolTips.add("Species");
    projectsTableToolTips.add("Tissue Types");
    projectsTableToolTips.add("Post Translational Modifications");
    projectsTableToolTips.add("Instruments");
    projectsTableToolTips.add("Number of Assays");
    projectsTableToolTips.add("Publication Date (yyyy-mm-dd)");
    projectsTableToolTips.add("Project Type");
    projectsTableToolTips.add("Confidence Category");
    assaysTableToolTips = new ArrayList<>();
    assaysTableToolTips.add(null);
    assaysTableToolTips.add("Assay Accession Number");
    assaysTableToolTips.add("Assay Title");
    assaysTableToolTips.add("Diseases");
    assaysTableToolTips.add("Species");
    assaysTableToolTips.add("Tissues");
    assaysTableToolTips.add("Post Translational Modifications");
    assaysTableToolTips.add("Instruments");
    assaysTableToolTips.add("Number of Proteins");
    assaysTableToolTips.add("Number of Peptides");
    assaysTableToolTips.add("Number of Spectra");
    assaysTableToolTips.add("Confidence Category");
    filesTableToolTips = new ArrayList<>();
    filesTableToolTips.add(null);
    filesTableToolTips.add("Assay Accession Numbers");
    filesTableToolTips.add("File Type");
    filesTableToolTips.add("File");
    filesTableToolTips.add("Download File");
    filesTableToolTips.add("File Size (MB)");
    filesTableToolTips.add("Reshakeable");
    ((TitledBorder) projectsPanel.getBorder()).setTitle(PeptideShakerGUI.TITLED_BORDER_HORIZONTAL_PADDING + "PRIDE Projects");
    ((TitledBorder) assaysPanel.getBorder()).setTitle(PeptideShakerGUI.TITLED_BORDER_HORIZONTAL_PADDING + "Assays");
    ((TitledBorder) filesPanel.getBorder()).setTitle(PeptideShakerGUI.TITLED_BORDER_HORIZONTAL_PADDING + "Files");
    // get the cluster categories
    getClusterAnnotations();
    reshakableCheckBoxActionPerformed(null);
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) HashMap(java.util.HashMap) Color(java.awt.Color) TitledBorder(javax.swing.border.TitledBorder) TrueFalseIconRenderer(no.uib.jsparklines.extra.TrueFalseIconRenderer) JSparklinesIntegerColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer) HtmlLinksRenderer(no.uib.jsparklines.extra.HtmlLinksRenderer)

Example 4 with TrueFalseIconRenderer

use of no.uib.jsparklines.extra.TrueFalseIconRenderer 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)

Example 5 with TrueFalseIconRenderer

use of no.uib.jsparklines.extra.TrueFalseIconRenderer in project peptide-shaker by compomics.

the class MatchValidationDialog method populateGUI.

/**
 * Populates the GUI with information on a protein match.
 *
 * @param identificationFeaturesGenerator
 * @param proteinMap
 */
private void populateGUI(TargetDecoyMap targetDecoyMap) {
    ValidationQcParameters validationQCPreferences = identificationParameters.getIdValidationParameters().getValidationQCParameters();
    // Validation level
    validationLevelJComboBox.setSelectedItem(psParameter.getMatchValidationLevel().getName());
    // Database info
    FastaParameters fastaParameters = identificationParameters.getFastaParameters();
    boolean targetDecoy = fastaParameters.isTargetDecoy();
    if (!targetDecoy) {
        targetDecoyLbl.setText("Target only");
        targetDecoyLbl.setForeground(Color.red);
    } else {
        targetDecoyLbl.setForeground(GREEN);
    }
    try {
        FastaSummary fastaSummary = FastaSummary.getSummary(fastaFile, fastaParameters, null);
        int nTarget = fastaSummary.nTarget;
        nTargetLbl.setText(nTarget + " target sequences");
        if (nTarget < 10000) {
            nTargetLbl.setForeground(Color.red);
        } else if (nTarget > 1000000) {
            nTargetLbl.setForeground(ORANGE);
        } else {
            nTargetLbl.setForeground(GREEN);
        }
    } catch (IOException iOException) {
        nTargetLbl.setText("Database size not available");
        nTargetLbl.setForeground(Color.red);
    }
    // Target/Decoy group
    ((TitledBorder) targetDecoyGroupPanel.getBorder()).setTitle("Target/Decoy Distributions");
    targetDecoyGroupPanel.repaint();
    if (targetDecoy) {
        int nTargetOnly = targetDecoyMap.getnTargetOnly();
        matchesBeforeFirstDecoyLbl.setText(nTargetOnly + " matches before the first decoy hit");
        TargetDecoyResults targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
        double desiredThreshold = targetDecoyResults.getUserInput();
        double nTargetLimit = 100.0 / desiredThreshold;
        if (nTargetOnly < nTargetLimit) {
            matchesBeforeFirstDecoyLbl.setForeground(Color.red);
        } else {
            matchesBeforeFirstDecoyLbl.setForeground(GREEN);
        }
        recommendedNumberOfTargetHitsLbl.setText("Recommended: " + Util.roundDouble(nTargetLimit, 0) + " matches before the first decoy hit");
        double resolution = targetDecoyMap.getResolution();
        confidenceResolutionLbl.setText("PEP/Confidence resolution of " + Util.roundDouble(resolution, 2) + "%");
        double minResolution = desiredThreshold;
        if (resolution > 10 * minResolution) {
            confidenceResolutionLbl.setForeground(Color.red);
        } else if (resolution > minResolution) {
            confidenceResolutionLbl.setForeground(ORANGE);
        } else {
            confidenceResolutionLbl.setForeground(GREEN);
        }
        recommendedResolutionLbl.setText("Recommended: resolution < " + Util.roundDouble(minResolution, 2) + "%");
    } else {
        matchesBeforeFirstDecoyLbl.setText("No decoy");
        matchesBeforeFirstDecoyLbl.setForeground(Color.gray);
        confidenceResolutionLbl.setText("Impossible to estimate confidence resolution");
        confidenceResolutionLbl.setForeground(Color.gray);
    }
    // Target/decoy results
    if (targetDecoy) {
        double confidence = psParameter.getConfidence();
        MatchValidationLevel matchValidationLevel = psParameter.getMatchValidationLevel();
        validationStatusLbl.setText("Validation Status: " + matchValidationLevel.getName());
        switch(matchValidationLevel) {
            case confident:
                validationStatusLbl.setForeground(GREEN);
                break;
            case doubtful:
                validationStatusLbl.setForeground(ORANGE);
                break;
            case not_validated:
                validationStatusLbl.setForeground(Color.red);
                break;
            case none:
                validationStatusLbl.setForeground(Color.gray);
        }
        TargetDecoyResults targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
        String validationThresholdTxt = "";
        double threshold = targetDecoyResults.getUserInput();
        int thresholdType = targetDecoyResults.getInputType();
        if (thresholdType == 0) {
            validationThresholdTxt += "Validation Threshold: " + Util.roundDouble(threshold, 2) + "%";
        } else if (targetDecoyResults.getInputType() == 1) {
            validationThresholdTxt += "FDR Threshold: " + Util.roundDouble(threshold, 2) + "%";
        } else if (targetDecoyResults.getInputType() == 2) {
            validationThresholdTxt += "FNR Threshold: " + Util.roundDouble(threshold, 2) + "%";
        }
        validationThresholdLbl.setText(validationThresholdTxt);
        confidenceLbl.setText("Confidence: " + Util.roundDouble(confidence, 2) + "%");
        double validationThreshold = targetDecoyResults.getConfidenceLimit();
        confidenceThresholdLbl.setText("Expected Confidence: " + Util.roundDouble(validationThreshold, 2) + "%");
        double margin = validationQCPreferences.getConfidenceMargin() * targetDecoyMap.getResolution();
        double confidenceThreshold = validationThreshold + margin;
        if (confidenceThreshold > 100) {
            confidenceThreshold = 100;
        }
        confidenceThresholdLbl.setText("Confident confidence: " + Util.roundDouble(confidenceThreshold, 2) + "%");
        if (confidence < validationThreshold) {
            confidenceLbl.setForeground(Color.red);
        } else if (confidence < confidenceThreshold) {
            confidenceLbl.setForeground(ORANGE);
        } else {
            confidenceLbl.setForeground(GREEN);
        }
    } else {
        validationStatusLbl.setText("Validation Status: " + psParameter.getMatchValidationLevel().getName());
        validationThresholdLbl.setText("Impossible to estimate validation threshold");
        confidenceLbl.setText("Impossible to estimate confidence");
        confidenceThresholdLbl.setText("Impossible to estimate confidence threshold");
        validationStatusLbl.setForeground(Color.gray);
        confidenceLbl.setForeground(Color.gray);
    }
    // Quality filters
    final DefaultTableModel tableModel = new FiltersTableModel();
    qualityFiltersTable.setModel(tableModel);
    qualityFiltersTable.getColumn("").setMaxWidth(50);
    qualityFiltersTable.getColumn(" ").setMaxWidth(50);
    qualityFiltersTable.getColumn(" ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/accept-new.png")), new ImageIcon(this.getClass().getResource("/icons/error-new.png")), "Yes", "No"));
    int valid = 0;
    for (String qcCheck : psParameter.getQcCriteria()) {
        if (psParameter.isQcPassed(qcCheck)) {
            valid++;
        }
    }
    ((TitledBorder) qualityFiltersPanel.getBorder()).setTitle("Quality Filters (" + valid + "/" + psParameter.getQcCriteria().size() + ")");
}
Also used : ImageIcon(javax.swing.ImageIcon) DefaultTableModel(javax.swing.table.DefaultTableModel) IOException(java.io.IOException) TitledBorder(javax.swing.border.TitledBorder) FastaSummary(com.compomics.util.experiment.io.biology.protein.FastaSummary) TrueFalseIconRenderer(no.uib.jsparklines.extra.TrueFalseIconRenderer) ValidationQcParameters(com.compomics.util.parameters.identification.advanced.ValidationQcParameters) FastaParameters(com.compomics.util.experiment.io.biology.protein.FastaParameters) TargetDecoyResults(eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyResults) MatchValidationLevel(com.compomics.util.experiment.identification.validation.MatchValidationLevel)

Aggregations

TrueFalseIconRenderer (no.uib.jsparklines.extra.TrueFalseIconRenderer)9 HashMap (java.util.HashMap)4 ImageIcon (javax.swing.ImageIcon)4 HtmlLinksRenderer (no.uib.jsparklines.extra.HtmlLinksRenderer)4 JSparklinesBarChartTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer)4 JSparklinesIntegerColorTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer)4 JSparklinesIntegerIconTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer)4 Color (java.awt.Color)3 DecimalFormat (java.text.DecimalFormat)2 TitledBorder (javax.swing.border.TitledBorder)2 TableModelEvent (javax.swing.event.TableModelEvent)2 TableModelListener (javax.swing.event.TableModelListener)2 ChromosomeTableCellRenderer (no.uib.jsparklines.extra.ChromosomeTableCellRenderer)2 MatchValidationLevel (com.compomics.util.experiment.identification.validation.MatchValidationLevel)1 FastaParameters (com.compomics.util.experiment.io.biology.protein.FastaParameters)1 FastaSummary (com.compomics.util.experiment.io.biology.protein.FastaSummary)1 ValidationQcParameters (com.compomics.util.parameters.identification.advanced.ValidationQcParameters)1 TargetDecoyResults (eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyResults)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1