Package net.sf.mzmine.data.impl

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


    Arrays.sort(chromatograms, new PeakSorter(SortingProperty.MZ,
        SortingDirection.Ascending));

    // Add the chromatograms to the new peak list
    for (ChromatographicPeak finishedPeak : chromatograms) {
      SimplePeakListRow newRow = new SimplePeakListRow(newPeakID);
      newPeakID++;
      newRow.addPeak(dataFile, finishedPeak);
      newPeakList.addRow(newRow);
    }

    // Add new peaklist to the project
    MZmineProject currentProject = MZmineCore.getCurrentProject();
View Full Code Here


          bestScan.getScanNumber(), scan.getScanNumber(), new Range(
              bestScan.getRetentionTime()), new Range(
              scan.getPrecursorMZ()), new Range(
              maxPoint.getIntensity()));

      PeakListRow entry = new SimplePeakListRow(scan.getScanNumber());
      entry.addPeak(dataFile, c);

      newPeakList.addRow(entry);
      processedScans++;
    }
View Full Code Here

      errorMessage = "Could not read file or the file is empty ";
      return;
    }
    // Fill new peak list with empty rows
    for (int row = 0; row < peaks.size(); row++) {
      PeakListRow newRow = new SimplePeakListRow(ID++);
      processedPeakList.addRow(newRow);
    }

    // Process all raw data files

    // Canceled?
    if (isCanceled()) {
      return;
    }

    List<Gap> gaps = new ArrayList<Gap>();

    // Fill each row of this raw data file column, create new empty
    // gaps
    // if necessary
    for (int row = 0; row < peaks.size(); row++) {
      PeakListRow newRow = processedPeakList.getRow(row);
      // Create a new gap

      Range mzRange = mzTolerance.getToleranceRange(peaks.get(row)
          .getMZ());
      Range rtRange = rtTolerance.getToleranceRange(peaks.get(row)
          .getRT());
      newRow.addPeakIdentity(new SimplePeakIdentity(peaks.get(row)
          .getName()), true);

      Gap newGap = new Gap(newRow, dataFile, mzRange, rtRange,
          intTolerance);
View Full Code Here

      for (final PeakListRow row : origPeakList.getRows()) {

        if (!isCanceled()) {

          // Create a new peak-list row.
          final PeakListRow newRow = new SimplePeakListRow(peakID++);

          // Process each peak.
          for (final ChromatographicPeak peak : row.getPeaks()) {

            if (!isCanceled()) {

              // Copy original peak intensities.
              final int[] scanNumbers = peak.getScanNumbers();
              final int numScans = scanNumbers.length;
              final double[] intensities = new double[numScans];
              for (int i = 0; i < numScans; i++) {

                final DataPoint dataPoint = peak
                    .getDataPoint(scanNumbers[i]);
                intensities[i] = dataPoint == null
                    ? 0.0
                    : dataPoint.getIntensity();
              }

              // Smooth peak.
              final double[] smoothed = convolve(intensities,
                  filterWeights);

              // Measure peak (max, ranges, area etc.)
              final RawDataFile dataFile = peak.getDataFile();
              final DataPoint[] newDataPoints = new DataPoint[numScans];
              double maxIntensity = 0.0;
              int maxScanNumber = -1;
              DataPoint maxDataPoint = null;
              Range intensityRange = null;
              double area = 0.0;
              for (int i = 0; i < numScans; i++) {

                final int scanNumber = scanNumbers[i];
                final DataPoint dataPoint = peak
                    .getDataPoint(scanNumber);
                final double intensity = smoothed[i];
                if (dataPoint != null && intensity > 0.0) {

                  // Create a new data point.
                  final double mz = dataPoint.getMZ();
                  final double rt = dataFile.getScan(
                      scanNumber).getRetentionTime();
                  final DataPoint newDataPoint = new SimpleDataPoint(
                      mz, intensity);
                  newDataPoints[i] = newDataPoint;

                  // Track maximum intensity data point.
                  if (intensity > maxIntensity) {

                    maxIntensity = intensity;
                    maxScanNumber = scanNumber;
                    maxDataPoint = newDataPoint;
                  }

                  // Update ranges.
                  if (intensityRange == null) {
                    intensityRange = new Range(intensity);
                  } else {
                    intensityRange.extendRange(intensity);
                  }

                  // Accumulate peak area.
                  if (i != 0) {

                    final DataPoint lastDP = newDataPoints[i - 1];
                    final double lastIntensity = lastDP == null
                        ? 0.0
                        : lastDP.getIntensity();
                    final double lastRT = dataFile.getScan(
                        scanNumbers[i - 1])
                        .getRetentionTime();
                    area += (rt - lastRT)
                        * (intensity + lastIntensity)
                        / 2.0;
                  }
                }
              }

              assert maxDataPoint != null;

              if (!isCanceled() && maxScanNumber >= 0) {

                // Create a new peak.
                newRow.addPeak(
                    dataFile,
                    new SimpleChromatographicPeak(
                        dataFile,
                        maxDataPoint.getMZ(),
                        peak.getRT(),
View Full Code Here

        peakList.getRawDataFiles());

    // Fill new peak list with empty rows
    for (int row = 0; row < peakList.getNumberOfRows(); row++) {
      PeakListRow sourceRow = peakList.getRow(row);
      PeakListRow newRow = new SimplePeakListRow(sourceRow.getID());
      newRow.setComment(sourceRow.getComment());
      for (PeakIdentity ident : sourceRow.getPeakIdentities()) {
        newRow.addPeakIdentity(ident, false);
      }
      if (sourceRow.getPreferredPeakIdentity() != null) {
        newRow.setPreferredPeakIdentity(sourceRow
            .getPreferredPeakIdentity());
      }
      processedPeakList.addRow(newRow);
    }

    if (rtCorrection) {
      totalScans *= 2;
      // Fill the gaps of a random sample using all the other samples and
      // take it as master list
      // to fill the gaps of the other samples
      masterSample = (int) Math.floor(Math.random()
          * peakList.getNumberOfRawDataFiles());
      fillList(MASTERLIST);

      // Process all raw data files
      fillList(!MASTERLIST);

    } else {

      // Process all raw data files
      for (RawDataFile dataFile : peakList.getRawDataFiles()) {

        // Canceled?
        if (isCanceled()) {
          return;
        }

        Vector<Gap> gaps = new Vector<Gap>();

        // Fill each row of this raw data file column, create new empty
        // gaps
        // if necessary
        for (int row = 0; row < peakList.getNumberOfRows(); row++) {
          PeakListRow sourceRow = peakList.getRow(row);
          PeakListRow newRow = processedPeakList.getRow(row);

          ChromatographicPeak sourcePeak = sourceRow
              .getPeak(dataFile);

          if (sourcePeak == null) {

            // Create a new gap

            Range mzRange = mzTolerance.getToleranceRange(sourceRow
                .getAverageMZ());
            Range rtRange = rtTolerance.getToleranceRange(sourceRow
                .getAverageRT());

            Gap newGap = new Gap(newRow, dataFile, mzRange,
                rtRange, intTolerance);

            gaps.add(newGap);

          } else {
            newRow.addPeak(dataFile, sourcePeak);
          }

        }

        // Stop processing this file if there are no gaps
View Full Code Here

      // Canceled?
      if (isCanceled())
        return;

      PeakListRow sourceRow = peakList.getRow(row);
      PeakListRow newRow = new SimplePeakListRow(sourceRow.getID());

      // Copy comment
      newRow.setComment(sourceRow.getComment());

      // Copy identities
      for (PeakIdentity ident : sourceRow.getPeakIdentities())
        newRow.addPeakIdentity(ident, false);
      if (sourceRow.getPreferredPeakIdentity() != null)
        newRow.setPreferredPeakIdentity(sourceRow
            .getPreferredPeakIdentity());

      // Copy each peaks and fill gaps
      for (RawDataFile column : columns) {

        // Canceled?
        if (isCanceled())
          return;

        // Get current peak
        ChromatographicPeak currentPeak = sourceRow.getPeak(column);

        // If there is a gap, try to fill it
        if (currentPeak == null)
          currentPeak = fillGap(sourceRow, column);

        // If a peak was found or created, add it
        if (currentPeak != null)
          newRow.addPeak(column, currentPeak);

      }

      processedPeakList.addRow(newRow);
View Full Code Here

        dataFile);

    totalRows = originalPeakList.getNumberOfRows();
    int[] scanNumbers;
    double[] retentionTimes, intensities;
    SimplePeakListRow newRow;

    for (PeakListRow row : originalPeakList.getRows()) {

      if (isCanceled())
        return;

      newRow = new SimplePeakListRow(newPeakID);

      try {
        for (ChromatographicPeak peak : row.getPeaks()) {

          // Load the intensities into array
          dataFile = peak.getDataFile();
          scanNumbers = peak.getScanNumbers();
          retentionTimes = new double[scanNumbers.length];
          for (int i = 0; i < scanNumbers.length; i++)
            retentionTimes[i] = dataFile.getScan(scanNumbers[i])
                .getRetentionTime();

          intensities = new double[scanNumbers.length];
          for (int i = 0; i < scanNumbers.length; i++) {
            DataPoint dp = peak.getDataPoint(scanNumbers[i]);
            if (dp != null)
              intensities[i] = dp.getIntensity();
            else
              intensities[i] = 0;
          }

          ChromatographicPeak shapePeak = (ChromatographicPeak) shapeModelConstruct
              .newInstance(peak, scanNumbers, intensities,
                  retentionTimes, resolution);

          newRow.addPeak(shapePeak.getDataFile(), shapePeak);
        }

      } catch (Exception e) {
        String message = "Error trying to make an instance of shape model class "
            + shapeModelClass;
View Full Code Here

          resolverParams);

      // Add peaks to the new peak list.
      for (final ChromatographicPeak peak : peaks) {

        final PeakListRow newRow = new SimplePeakListRow(peakId++);
        newRow.addPeak(dataFile, peak);
        resolvedPeaks.addRow(newRow);
      }

      processedRows++;
    }
View Full Code Here

      if (buildingPeakList == null) {
        initializePeakList();
      }
      int rowID = Integer.parseInt(attrs
          .getValue(PeakListElementName_2_5.ID.getElementName()));
      buildingRow = new SimplePeakListRow(rowID);
      String comment = attrs.getValue(PeakListElementName_2_5.COMMENT
          .getElementName());
      buildingRow.setComment(comment);
    }
View Full Code Here

      if (buildingPeakList == null) {
        initializePeakList();
      }
      int rowID = Integer.parseInt(attrs
          .getValue(PeakListElementName_2_0.ID.getElementName()));
      buildingRow = new SimplePeakListRow(rowID);
      String comment = attrs.getValue(PeakListElementName_2_0.COMMENT
          .getElementName());
      buildingRow.setComment(comment);
    }
View Full Code Here

TOP

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

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.