MSnSpectrum currentSpectrum = peptideShakerGUI.getSpectrum(spectrumKey);
if (currentSpectrum != null && currentSpectrum.getMzValuesAsArray().length > 0) {
Precursor precursor = currentSpectrum.getPrecursor();
SpectrumMatch spectrumMatch = peptideShakerGUI.getIdentification().getSpectrumMatch(spectrumKey);
spectrum = new SpectrumPanel(
currentSpectrum.getMzValuesAsArray(), currentSpectrum.getIntensityValuesAsArray(),
precursor.getMz(), spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().toString(),
"", 40, false, false, false, 2, false);
spectrum.setKnownMassDeltas(peptideShakerGUI.getCurrentMassDeltas());
spectrum.setDeltaMassWindow(peptideShakerGUI.getAnnotationPreferences().getFragmentIonAccuracy());
spectrum.setBorder(null);
spectrum.setDataPointAndLineColor(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumAnnotatedPeakColor(), 0);
spectrum.setPeakWaterMarkColor(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumBackgroundPeakColor());
spectrum.setPeakWidth(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumAnnotatedPeakWidth());
spectrum.setBackgroundPeakWidth(peptideShakerGUI.getUtilitiesUserPreferences().getSpectrumBackgroundPeakWidth());
// get the spectrum annotations
PeptideAssumption peptideAssumption = spectrumMatch.getBestPeptideAssumption();
Peptide peptide = peptideAssumption.getPeptide();
int identificationCharge = spectrumMatch.getBestPeptideAssumption().getIdentificationCharge().value;
annotationPreferences.setCurrentSettings(peptideAssumption, !currentSpectrumKey.equalsIgnoreCase(spectrumMatch.getKey()), peptideShakerGUI.getSequenceMatchingPreferences());
ArrayList<IonMatch> annotations = annotator.getSpectrumAnnotation(annotationPreferences.getIonTypes(),
annotationPreferences.getNeutralLosses(),
annotationPreferences.getValidatedCharges(),
identificationCharge,
currentSpectrum, peptide,
currentSpectrum.getIntensityLimit(annotationPreferences.getAnnotationIntensityLimit()),
annotationPreferences.getFragmentIonAccuracy(), false, annotationPreferences.isHighResolutionAnnotation());
currentSpectrumKey = spectrumMatch.getKey();
// add the spectrum annotations
spectrum.setAnnotations(SpectrumAnnotator.getSpectrumAnnotation(annotations));
spectrum.showAnnotatedPeaksOnly(!annotationPreferences.showAllPeaks());
spectrum.setYAxisZoomExcludesBackgroundPeaks(annotationPreferences.yAxisZoomExcludesBackgroundPeaks());