コード例 #1
0
  /**
   * Create a table for peptide quantitative data
   *
   * @param se search engine
   * @return JTable peptide table
   */
  public static JTable createQuantPeptideTable(DataAccessController controller, SearchEngine se) {
    QuantPeptideTableModel tableModel = new QuantPeptideTableModel(se);
    DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
    DefaultPrideTable quantPeptideTable = new DefaultPrideTable(tableModel, columnModel);
    quantPeptideTable.setAutoCreateColumnsFromModel(false);
    // add table model change listener
    tableModel.addTableModelListener(new BarChartColumnListener(quantPeptideTable));

    // hide protein accession
    TableColumnExt proteinAccColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PROTEIN_ACCESSION_COLUMN.getHeader());
    proteinAccColumn.setVisible(false);

    // hide mapped protein accession
    String mappedProtAccHeader =
        QuantPeptideTableModel.TableHeader.MAPPED_PROTEIN_ACCESSION_COLUMN.getHeader();
    TableColumnExt mappedProtAccColumn =
        (TableColumnExt) quantPeptideTable.getColumn(mappedProtAccHeader);
    mappedProtAccColumn.setCellRenderer(new HyperLinkCellRenderer());
    mappedProtAccColumn.setVisible(false);
    // add hyper link click listener
    quantPeptideTable.addMouseMotionListener(
        new TableCellMouseMotionListener(quantPeptideTable, mappedProtAccHeader));
    quantPeptideTable.addMouseListener(
        new HyperLinkCellMouseClickListener(
            quantPeptideTable, mappedProtAccHeader, new ProteinAccHyperLinkGenerator()));

    // peptide sequence column renderer
    TableColumnExt peptideColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PEPTIDE_PTM_COLUMN.getHeader());
    peptideColumn.setCellRenderer(new PeptideSequenceCellRenderer());
    // set peptide column width
    peptideColumn.setPreferredWidth(150);

    // hide protein name
    TableColumnExt proteinNameColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PROTEIN_NAME.getHeader());
    proteinNameColumn.setVisible(false);

    // hide protein status
    TableColumnExt proteinStatusColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PROTEIN_STATUS.getHeader());
    proteinStatusColumn.setVisible(false);

    // hide protein sequence coverage
    TableColumnExt proteinSeqCoverageColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PROTEIN_SEQUENCE_COVERAGE.getHeader());
    proteinSeqCoverageColumn.setVisible(false);

    // peptide sequence present in protein sequence
    TableColumnExt peptideFitColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(QuantPeptideTableModel.TableHeader.PEPTIDE_FIT.getHeader());
    peptideFitColumn.setCellRenderer(new PeptideFitCellRenderer());
    peptideFitColumn.setVisible(false);

    // precursor charge column
    TableColumnExt precursorChargeColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PRECURSOR_CHARGE_COLUMN.getHeader());
    precursorChargeColumn.setVisible(false);

    // delta mass column
    TableColumnExt deltaMassColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.DELTA_MASS_COLUMN.getHeader());
    deltaMassColumn.setVisible(false);
    double minLimit =
        Double.parseDouble(
            Desktop.getInstance().getDesktopContext().getProperty("delta.mz.min.limit"));
    double maxLimit =
        Double.parseDouble(
            Desktop.getInstance().getDesktopContext().getProperty("delta.mz.max.limit"));
    DeltaMZRenderer renderer = new DeltaMZRenderer(minLimit, maxLimit);
    deltaMassColumn.setCellRenderer(renderer);

    // precursor m/z column
    TableColumnExt precursorMzColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PRECURSOR_MZ_COLUMN.getHeader());
    precursorMzColumn.setVisible(false);

    // number of ptms column
    TableColumnExt ptmsColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PEPTIDE_PTM_NUMBER_COLUMN.getHeader());
    ptmsColumn.setVisible(false);
    ImageIcon icon =
        GUIUtilities.loadImageIcon(
            Desktop.getInstance().getDesktopContext().getProperty("open.ptm.small.icon"));
    ptmsColumn.setCellRenderer(new OpenPTMRenderer(icon));

    // hide modified peptide sequence
    TableColumnExt peptideSeqColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PEPTIDE_PTM_MASS_COLUMN.getHeader());
    peptideSeqColumn.setVisible(false);

    // hide ptm summary
    TableColumnExt ptmSummaryColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PEPTIDE_PTM_SUMMARY.getHeader());
    ptmSummaryColumn.setVisible(false);

    // hide number of fragment ions
    TableColumnExt fragIonsColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.NUMBER_OF_FRAGMENT_IONS_COLUMN.getHeader());
    fragIonsColumn.setVisible(false);

    // hide peptide sequence length
    TableColumnExt seqLengthColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.PEPTIDE_SEQUENCE_LENGTH_COLUMN.getHeader());
    seqLengthColumn.setVisible(false);

    // hide sequence start
    TableColumnExt sequenceStartColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.SEQUENCE_START_COLUMN.getHeader());
    sequenceStartColumn.setVisible(false);

    // hide sequence end
    TableColumnExt sequenceEndColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.SEQUENCE_END_COLUMN.getHeader());
    sequenceEndColumn.setVisible(false);

    // hide pi point column
    TableColumnExt piColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.THEORITICAL_ISOELECTRIC_POINT_COLUMN
                    .getHeader());
    piColumn.setVisible(false);

    // hide spectrum id
    TableColumnExt spectrumIdColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(QuantPeptideTableModel.TableHeader.SPECTRUM_ID.getHeader());
    spectrumIdColumn.setVisible(false);

    // hide protein id column
    TableColumnExt proteinIdColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(
                QuantPeptideTableModel.TableHeader.IDENTIFICATION_ID.getHeader());
    proteinIdColumn.setVisible(false);

    // hide peptide id column
    TableColumnExt peptideIdColumn =
        (TableColumnExt)
            quantPeptideTable.getColumn(QuantPeptideTableModel.TableHeader.PEPTIDE_ID.getHeader());
    peptideIdColumn.setVisible(false);

    // add hyper link click listener
    String protAccColumnHeader =
        QuantPeptideTableModel.TableHeader.MAPPED_PROTEIN_ACCESSION_COLUMN.getHeader();
    quantPeptideTable.addMouseMotionListener(
        new TableCellMouseMotionListener(quantPeptideTable, protAccColumnHeader));
    quantPeptideTable.addMouseListener(
        new HyperLinkCellMouseClickListener(
            quantPeptideTable, protAccColumnHeader, new ProteinAccHyperLinkGenerator()));

    // additional column
    String additionalColHeader = ProteinTableModel.TableHeader.ADDITIONAL.getHeader();
    TableColumnExt additionalCol =
        (TableColumnExt) quantPeptideTable.getColumn(additionalColHeader);
    Icon detailIcon =
        GUIUtilities.loadIcon(
            Desktop.getInstance().getDesktopContext().getProperty("view.detail.small.icon"));
    additionalCol.setCellRenderer(new IconRenderer(detailIcon));
    additionalCol.setMaxWidth(50);
    additionalCol.setVisible(false);

    // add mouse motion listener
    quantPeptideTable.addMouseMotionListener(
        new TableCellMouseMotionListener(quantPeptideTable, additionalColHeader));
    quantPeptideTable.addMouseListener(
        new ShowParamsMouseListener(controller, quantPeptideTable, additionalColHeader));

    return quantPeptideTable;
  }
コード例 #2
0
  /**
   * Create a table for quantitative protein data with a given table model
   *
   * @param tableModel quant protein table model
   * @return JTable quant protein table
   */
  public static JTable createQuantProteinTable(
      DataAccessController controller, TableModel tableModel) {
    DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
    DefaultPrideTable quantProteinTable = new DefaultPrideTable(tableModel, columnModel);
    quantProteinTable.setAutoCreateColumnsFromModel(false);
    // add table model change listener
    tableModel.addTableModelListener(new BarChartColumnListener(quantProteinTable));

    // in case the compare doesn't exist
    List<TableColumn> columns = columnModel.getColumns(true);
    for (TableColumn column : columns) {
      if (column.getHeaderValue().equals(QuantProteinTableModel.TableHeader.COMPARE.getHeader())) {
        column.setMaxWidth(25);
      }
    }
    // hide mapped protein accession
    String mappedProtAccHeader =
        QuantProteinTableModel.TableHeader.MAPPED_PROTEIN_ACCESSION_COLUMN.getHeader();
    TableColumnExt mappedProtAccColumn =
        (TableColumnExt) quantProteinTable.getColumn(mappedProtAccHeader);
    mappedProtAccColumn.setCellRenderer(new HyperLinkCellRenderer());
    // add hyper link click listener
    quantProteinTable.addMouseMotionListener(
        new TableCellMouseMotionListener(quantProteinTable, mappedProtAccHeader));
    quantProteinTable.addMouseListener(
        new HyperLinkCellMouseClickListener(
            quantProteinTable, mappedProtAccHeader, new ProteinAccHyperLinkGenerator()));

    TableColumnExt proteinIdColumn =
        (TableColumnExt)
            quantProteinTable.getColumn(
                QuantProteinTableModel.TableHeader.IDENTIFICATION_ID.getHeader());
    proteinIdColumn.setVisible(false);

    // hide the protein name column
    TableColumnExt proteinNameColumn =
        (TableColumnExt)
            quantProteinTable.getColumn(
                QuantProteinTableModel.TableHeader.PROTEIN_NAME.getHeader());
    proteinNameColumn.setVisible(false);

    // protein status column
    TableColumnExt proteinStatusColumn =
        (TableColumnExt)
            quantProteinTable.getColumn(
                QuantProteinTableModel.TableHeader.PROTEIN_STATUS.getHeader());
    proteinStatusColumn.setVisible(false);

    // sequence coverage column
    TableColumnExt seqCoverageColumn =
        (TableColumnExt)
            quantProteinTable.getColumn(
                QuantProteinTableModel.TableHeader.PROTEIN_SEQUENCE_COVERAGE.getHeader());
    seqCoverageColumn.setCellRenderer(new SequenceCoverageRenderer());
    seqCoverageColumn.setVisible(false);

    // isoelectric point column
    TableColumnExt isoelectricColumn =
        (TableColumnExt)
            quantProteinTable.getColumn(
                QuantProteinTableModel.TableHeader.THEORITICAL_ISOELECTRIC_POINT_COLUMN
                    .getHeader());
    isoelectricColumn.setVisible(false);

    // score
    TableColumnExt proteinScoreColumn =
        (TableColumnExt)
            quantProteinTable.getColumn(
                QuantProteinTableModel.TableHeader.IDENTIFICATION_SCORE_COLUMN.getHeader());
    proteinScoreColumn.setVisible(false);

    // threshold
    TableColumnExt proteinThresholdColumn =
        (TableColumnExt)
            quantProteinTable.getColumn(
                QuantProteinTableModel.TableHeader.IDENTIFICATION_THRESHOLD_COLUMN.getHeader());
    proteinThresholdColumn.setVisible(false);

    // number of peptides
    TableColumnExt numOfPeptideColumn =
        (TableColumnExt)
            quantProteinTable.getColumn(
                QuantProteinTableModel.TableHeader.NUMBER_OF_PEPTIDES.getHeader());
    numOfPeptideColumn.setVisible(false);

    // number of unique peptides
    TableColumnExt numOfUniquePeptideColumn =
        (TableColumnExt)
            quantProteinTable.getColumn(
                QuantProteinTableModel.TableHeader.NUMBER_OF_UNIQUE_PEPTIDES.getHeader());
    numOfUniquePeptideColumn.setVisible(false);

    // number of ptms
    TableColumnExt numOfPtmColumn =
        (TableColumnExt)
            quantProteinTable.getColumn(
                QuantProteinTableModel.TableHeader.NUMBER_OF_PTMS.getHeader());
    numOfPtmColumn.setVisible(false);

    // additional column
    String additionalColHeader = ProteinTableModel.TableHeader.ADDITIONAL.getHeader();
    TableColumnExt additionalCol =
        (TableColumnExt) quantProteinTable.getColumn(additionalColHeader);
    Icon icon =
        GUIUtilities.loadIcon(
            Desktop.getInstance().getDesktopContext().getProperty("view.detail.small.icon"));
    additionalCol.setCellRenderer(new IconRenderer(icon));
    additionalCol.setMaxWidth(50);
    additionalCol.setVisible(false);

    // add mouse motion listener
    quantProteinTable.addMouseMotionListener(
        new TableCellMouseMotionListener(quantProteinTable, additionalColHeader));
    quantProteinTable.addMouseListener(
        new ShowParamsMouseListener(controller, quantProteinTable, additionalColHeader));

    return quantProteinTable;
  }