Package net.sf.mzmine.data.impl

Examples of net.sf.mzmine.data.impl.SimpleDataPoint


        // Create a set to hold data points (sorted by m/z).
        final Set<DataPoint> dataPoints = new TreeSet<DataPoint>(
            ASCENDING_MASS_SORTER);

        // Add a dummy data point.
        dataPoints.add(new SimpleDataPoint(0.0, 0.0));
        dataPointCount++;

        // Map the set.
        peakDataPointsByScan.put(rawFile.getScan(scanNumber),
            dataPoints);
      }

      // Add peaks.
      double progressInc = 1.0 / (double) peaks.length;
      for (final ChromatographicPeak peak : peaks) {

        // Get peak data.
        Range rtRange = null;
        Range intRange = null;
        final double mz = peak.getMZ();

        // Get the peak's data points per scan.
        for (final int scanNumber : peak.getScanNumbers()) {

          final Scan scan = rawFile.getScan(scanNumber);
          if (scan.getMSLevel() != MS_LEVEL) {

            throw new IllegalStateException(
                "CAMERA can only process peak lists from MS-level "
                    + MS_LEVEL);
          }

          // Copy the data point.
          final DataPoint dataPoint = peak.getDataPoint(scanNumber);
          if (dataPoint != null) {

            final double intensity = dataPoint.getIntensity();
            peakDataPointsByScan.get(scan).add(
                new SimpleDataPoint(mz, intensity));
            dataPointCount++;

            // Update RT range.
            final double rt = scan.getRetentionTime();
            if (rtRange == null) {
View Full Code Here


        } else {
          peakRTRange.extendRange(retentionTime);
          peakIntensityRange.extendRange(intensity);
        }
        if (mz > 0.0) {
          mzPeaks[i] = new SimpleDataPoint(mz, intensity);
          if (peakMZRange == null)
            peakMZRange = new Range(mz);
          else
            peakMZRange.extendRange(mz);
        }
      }

      PeakStatus status = PeakStatus.valueOf(peakStatus);

      SimpleChromatographicPeak peak = new SimpleChromatographicPeak(
          dataFile, mass, rt, height, area, scanNumbers, mzPeaks,
          status, representativeScan, fragmentScan, peakRTRange,
          peakMZRange, peakIntensityRange);

      peak.setCharge(currentPeakCharge);

      if (currentIsotopes.size() > 0) {
        SimpleIsotopePattern newPattern = new SimpleIsotopePattern(
            currentIsotopes.toArray(new DataPoint[0]),
            currentIsotopePatternStatus,
            currentIsotopePatternDescription);
        peak.setIsotopePattern(newPattern);
        currentIsotopes.clear();
      }

      buildingRow.addPeak(dataFile, peak);

    }

    // <IDENTITY_PROPERTY>
    if (qName.equals(PeakListElementName_2_5.IDPROPERTY.getElementName())) {
      identityProperties.put(identityPropertyName, getTextOfElement());
    }

    // <PEAK_IDENTITY>
    if (qName
        .equals(PeakListElementName_2_5.PEAK_IDENTITY.getElementName())) {
      SimplePeakIdentity identity = new SimplePeakIdentity(
          identityProperties);
      buildingRow.addPeakIdentity(identity, preferred);
    }

    // <ROW>
    if (qName.equals(PeakListElementName_2_5.ROW.getElementName())) {
      buildingPeakList.addRow(buildingRow);
      buildingRow = null;
      parsedRows++;
    }

    // <ISOTOPE>
    if (qName.equals(PeakListElementName_2_5.ISOTOPE.getElementName())) {
      String text = getTextOfElement();
      String items[] = text.split(":");
      double mz = Double.valueOf(items[0]);
      double intensity = Double.valueOf(items[1]);
      DataPoint isotope = new SimpleDataPoint(mz, intensity);
      currentIsotopes.add(isotope);
    }

    if (qName.equals(PeakListElementName_2_5.METHOD_NAME.getElementName())) {
      String appliedMethod = getTextOfElement();
View Full Code Here

        } else {
          peakRTRange.extendRange(retentionTime);
          peakIntensityRange.extendRange(intensity);
        }
        if (mz > 0.0) {
          mzPeaks[i] = new SimpleDataPoint(mz, intensity);
          if (peakMZRange == null)
            peakMZRange = new Range(mz);
          else
            peakMZRange.extendRange(mz);
        }
      }

      PeakStatus status = PeakStatus.valueOf(peakStatus);

      SimpleChromatographicPeak peak = new SimpleChromatographicPeak(
          dataFile, mass, rt, height, area, scanNumbers, mzPeaks,
          status, representativeScan, fragmentScan, peakRTRange,
          peakMZRange, peakIntensityRange);

      peak.setCharge(currentPeakCharge);

      if (currentIsotopes.size() > 0) {
        SimpleIsotopePattern newPattern = new SimpleIsotopePattern(
            currentIsotopes.toArray(new DataPoint[0]),
            currentIsotopePatternStatus,
            currentIsotopePatternDescription);
        peak.setIsotopePattern(newPattern);
        currentIsotopes.clear();
      }

      buildingRow.addPeak(dataFile, peak);

    }

    // <IDENTITY_PROPERTY>
    if (qName.equals(PeakListElementName_2_0.IDPROPERTY.getElementName())) {
      identityProperties.put(identityPropertyName, getTextOfElement());
    }

    // <PEAK_IDENTITY>
    if (qName
        .equals(PeakListElementName_2_0.PEAK_IDENTITY.getElementName())) {
      String content = getTextOfElement();
      if (identityProperties.get(PeakIdentity.PROPERTY_NAME) == null)
        identityProperties.put(PeakIdentity.PROPERTY_NAME, content);
      SimplePeakIdentity identity = new SimplePeakIdentity(
          identityProperties);
      buildingRow.addPeakIdentity(identity, preferred);
    }

    // <ROW>
    if (qName.equals(PeakListElementName_2_0.ROW.getElementName())) {
      buildingPeakList.addRow(buildingRow);
      buildingRow = null;
      parsedRows++;
    }

    // <ISOTOPE>
    if (qName.equals(PeakListElementName_2_0.ISOTOPE.getElementName())) {
      String text = getTextOfElement();
      String items[] = text.split(":");
      double mz = Double.valueOf(items[0]);
      double intensity = Double.valueOf(items[1]);
      DataPoint isotope = new SimpleDataPoint(mz, intensity);
      currentIsotopes.add(isotope);
    }

    if (qName.equals(PeakListElementName_2_0.METHOD_NAME.getElementName())) {
      String appliedMethod = getTextOfElement();
View Full Code Here

    this.originalRetentionTime = this.spectrum.getOriginalRetentionTime();
    this.ionMass = ionMass;
    this.ionizationType = ionizationType;
    this.adductMatches = adductMatches.toArray(new AdductType[adductMatches
        .size()]);
    this.dataPoint = new SimpleDataPoint(ionMass, retentionTime);

    fit = this.spectrum.getRetentionCorrection();

    // Generate string representation of adduct matches
    StringBuilder sb = new StringBuilder();
View Full Code Here

      // Create a new SimpleIsotopePattern
      DataPoint isotopes[] = new DataPoint[bestFitPeaks.size()];
      for (int i = 0; i < isotopes.length; i++) {
        ChromatographicPeak p = originalPeaks[i];
        isotopes[i] = new SimpleDataPoint(p.getMZ(), p.getHeight());

      }
      SimpleIsotopePattern newPattern = new SimpleIsotopePattern(
          isotopes, IsotopePatternStatus.DETECTED, aPeak.toString());
View Full Code Here

        } else {
          peakRTRange.extendRange(retentionTime);
          peakIntensityRange.extendRange(intensity);
        }
        if (mz > 0.0) {
          mzPeaks[i] = new SimpleDataPoint(mz, intensity);
          if (peakMZRange == null)
            peakMZRange = new Range(mz);
          else
            peakMZRange.extendRange(mz);
        }
      }

      PeakStatus status = PeakStatus.valueOf(peakStatus);

      SimpleChromatographicPeak peak = new SimpleChromatographicPeak(
          dataFile, mass, rt, height, area, scanNumbers, mzPeaks,
          status, representativeScan, fragmentScan, peakRTRange,
          peakMZRange, peakIntensityRange);

      peak.setCharge(currentPeakCharge);

      if (currentIsotopes.size() > 0) {
        SimpleIsotopePattern newPattern = new SimpleIsotopePattern(
            currentIsotopes.toArray(new DataPoint[0]),
            currentIsotopePatternStatus,
            currentIsotopePatternDescription);
        peak.setIsotopePattern(newPattern);
        currentIsotopes.clear();
      }

      buildingRow.addPeak(dataFile, peak);

    }

    // <IDENTITY_PROPERTY>
    if (qName.equals(PeakListElementName_2_3.IDPROPERTY.getElementName())) {
      identityProperties.put(identityPropertyName, getTextOfElement());
    }

    // <PEAK_IDENTITY>
    if (qName
        .equals(PeakListElementName_2_3.PEAK_IDENTITY.getElementName())) {
      SimplePeakIdentity identity = new SimplePeakIdentity(
          identityProperties);
      buildingRow.addPeakIdentity(identity, preferred);
    }

    // <ROW>
    if (qName.equals(PeakListElementName_2_3.ROW.getElementName())) {
      buildingPeakList.addRow(buildingRow);
      buildingRow = null;
      parsedRows++;
    }

    // <ISOTOPE>
    if (qName.equals(PeakListElementName_2_3.ISOTOPE.getElementName())) {
      String text = getTextOfElement();
      String items[] = text.split(":");
      double mz = Double.valueOf(items[0]);
      double intensity = Double.valueOf(items[1]);
      DataPoint isotope = new SimpleDataPoint(mz, intensity);
      currentIsotopes.add(isotope);
    }

    if (qName.equals(PeakListElementName_2_3.METHOD_NAME.getElementName())) {
      String appliedMethod = getTextOfElement();
View Full Code Here

  private static DataPoint[] parseSpectrumData(String spectrum) {
    List<DataPoint> ions = new ArrayList<DataPoint>();

    for (String ion : spectrum.split(" ")) {
      String[] s = ion.split(":");
      ions.add(new SimpleDataPoint(Double.parseDouble(s[0]), Double
          .parseDouble(s[1])));
    }

    return ions.toArray(new DataPoint[ions.size()]);
  }
View Full Code Here

          finalMZRange.extendRange(dp.getMZ());
          finalIntensityRange.extendRange(dp.getIntensity());
        }

        scanNumbers[i] = bestPeakDataPoints.get(i).getScanNumber();
        finalDataPoint[i] = new SimpleDataPoint(dp.getMZ(),
            dp.getIntensity());
        mz += bestPeakDataPoints.get(i).getMZ();

        // Check height
        if (bestPeakDataPoints.get(i).getIntensity() > height) {
View Full Code Here

      mergedDataPoints.add(dp);
    }
    for (DataPoint dp : nip2.getDataPoints()) {
      if (dp.getIntensity() * patternIntensity < noiseIntensity)
        continue;
      DataPoint negativeDP = new SimpleDataPoint(dp.getMZ(),
          dp.getIntensity() * -1);
      mergedDataPoints.add(negativeDP);
    }
    DataPoint mergedDPArray[] = mergedDataPoints.toArray(new DataPoint[0]);

    // Sort the merged data points by m/z
    Arrays.sort(mergedDPArray, new DataPointSorter(SortingProperty.MZ,
        SortingDirection.Ascending));

    // Iterate the merged data points and sum all isotopes within m/z
    // tolerance
    for (int i = 0; i < mergedDPArray.length - 1; i++) {

      Range toleranceRange = mzTolerance
          .getToleranceRange(mergedDPArray[i].getMZ());

      if (!toleranceRange.contains(mergedDPArray[i + 1].getMZ()))
        continue;

      double summedIntensity = mergedDPArray[i].getIntensity()
          + mergedDPArray[i + 1].getIntensity();

      double newMZ = mergedDPArray[i + 1].getMZ();

      // Update the next data point and remove the current one
      mergedDPArray[i + 1] = new SimpleDataPoint(newMZ, summedIntensity);
      mergedDPArray[i] = null;

    }

    // Calculate the resulting score. Ideal score is 1, in case the final
View Full Code Here

      if (charge != 0)
        mass /= charge;

      double intensity = isotope.getIntensity();

      dataPoints[i] = new SimpleDataPoint(mass, intensity);
    }

    String formulaString = MolecularFormulaManipulator
        .getString(cdkFormula);
View Full Code Here

TOP

Related Classes of net.sf.mzmine.data.impl.SimpleDataPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.