/** * 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 } }
protected void processSpectrum(SpectrumData spectrum, IDiscoveryDataHolder hd) { double score; if (USE_EXPECTED) score = spectrum.getExpectedValue(); else //noinspection ConstantConditions score = spectrum.getHyperScoreValue(); if (spectrum.isTrueHit()) { hd.addTrueDiscovery(score); // if (spectrum.isModified()) // m_ModifiedHandler.addTrueDiscovery(score); // else // m_UnModifiedHandler.addTrueDiscovery(score); } else { hd.addFalseDiscovery(score); if (spectrum.isModified()) throw new UnsupportedOperationException("Fix This"); // ToDo // m_ModifiedHandler.addFalseDiscovery(score); // else // m_UnModifiedHandler.addFalseDiscovery(score); } }
/** * Process the intensity data and set the peaks histogram and the intensity histogram * * @param intensity the intensity peaks data */ private void processSpectrumIntensityData(PeakList intensity) { double[] intensityArray = intensity.getDoubleArray(); int bin = intensityArray.length; if (peaksHist.containsKey(bin)) peaksHist.put(bin, peaksHist.get(bin) + 1); else peaksHist.put(bin, 1); SpectrumData spectrum = getOrCreateSpectrum(intensity.getSpectrumID().toString()); Map<Integer, Integer> intensityHist; if (spectrum.isIdentified()) { intensityHist = intensityIdentifiedHist; } else { intensityHist = intensityUnidentifiedHist; } for (double value : intensityArray) { bin = (int) Math.round(value / 5.0); if (intensityHist.containsKey(bin)) { intensityHist.put(bin, intensityHist.get(bin) + 1); } else { intensityHist.put(bin, 1); } } }
/** * Set the precursor mass of the spectrum ID associated to the given precursor charge chartData * * @param precursorCharge the precursor charge chartData */ private void setSpectrumPrecursorCharge(PrecursorData precursorCharge) { String spectrumID = precursorCharge.getSpectrumID(); SpectrumData spectrum = getOrCreateSpectrum(spectrumID); spectrum.setPrecursorCharge(precursorCharge.getValue()); }
/** * Set the spectrum references * * @param spectrumID the spectrum identifier * @param identified True if the spectrum is identified */ private void setSpectrumReferences(String spectrumID, boolean identified) { SpectrumData spectrum = getOrCreateSpectrum(spectrumID); spectrum.setIdentified(identified); }