/** * Process the M/Z data and set the peaks histogram and the intensity histogram * * @param mzData the m/z chartData */ private void processSpectrumMzData(PeakList mzData, PeakList intensity) { String spectrumID = mzData.getSpectrumID().toString(); SpectrumData spectrum = getOrCreateSpectrum(spectrumID); Map<Integer, PrideHistogram> mzHist; if (spectrum.isIdentified()) { mzHist = mzIdentifiedHist; } else { mzHist = mzUnidentifiedHist; } try { int charge = (int) Math.ceil(spectrum.getPrecursorCharge()); PrideHistogram histogram; if (mzHist.containsKey(charge)) { histogram = mzHist.get(charge); } else { histogram = new PrideHistogram(); mzHist.put(charge, histogram); } for (int pos = 0; pos < mzData.getDoubleArray().length; pos++) { // for (double value : mzData.getDoubleArray()) { double value = mzData.getDoubleArray()[pos]; int bin = (int) Math.round(value / MZHistogramChartSpectra.BIN_SIZE); double intensityValue = intensity.getDoubleArray()[pos]; if (histogram.containsKey(bin)) { histogram.put(bin, histogram.get(bin) + intensityValue); } else { histogram.put(bin, intensityValue); } } } catch (SpectrumDataException e) { // Do NOT take into account this spectrum because it has not precursor charge } }