if (row != -1) {
this.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
try {
Identification identification = peptideShakerGUI.getIdentification();
IdentificationFeaturesGenerator identificationFeaturesGenerator = peptideShakerGUI.getIdentificationFeaturesGenerator();
SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) peptideTable.getModel();
int peptideIndex = tableModel.getViewIndex(row);
String peptideKey = peptideKeys.get(peptideIndex);
try {
psmKeys = identificationFeaturesGenerator.getSortedPsmKeys(peptideKey);
} catch (Exception e) {
peptideShakerGUI.catchException(e);
try {
// ok let's try without order
PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);
psmKeys = peptideMatch.getSpectrumMatches();
} catch (Exception e1) {
// just hope the GUI holds...
peptideShakerGUI.catchException(e1);
psmKeys = new ArrayList<String>();
}
}
// clear the selection in case more than one row was selected for the last peptide
psmTable.clearSelection();
// update the table model
if (psmTable.getModel() instanceof PsmTableModel) {
((PsmTableModel) psmTable.getModel()).updateDataModel(peptideShakerGUI, psmKeys);
((PsmTableModel) psmTable.getModel()).setSelfUpdating(true);
((PsmTableModel) psmTable.getModel()).resetSorting(new ProgressDialogX(peptideShakerGUI,
Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")),
Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker-orange.gif")),
true));
} else {
PsmTableModel psmTableModel = new PsmTableModel(peptideShakerGUI, psmKeys);
psmTable.setModel(psmTableModel);
}
setPsmTableProperties();
showSparkLines(peptideShakerGUI.showSparklines());
int nValidatedPsms = identificationFeaturesGenerator.getNValidatedSpectraForPeptide(peptideKey);
int nConfidentPsms = identificationFeaturesGenerator.getNConfidentSpectraForPeptide(peptideKey);
int nPsms = psmTable.getRowCount();
String title = PeptideShakerGUI.TITLED_BORDER_HORIZONTAL_PADDING + "Peptide-Spectrum Matches (";
if (nConfidentPsms > 0) {
title += nValidatedPsms + "/" + nPsms + " - " + nConfidentPsms + " confident, " + (nValidatedPsms - nConfidentPsms) + " doubtful";
} else {