コード例 #1
0
 /**
  * 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
   }
 }
コード例 #2
0
  /**
   * 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);
      }
    }
  }