Package net.sf.mzmine.util

Examples of net.sf.mzmine.util.PeakSorter


    }

    chromatograms = massConnector.finishChromatograms();

    // Sort the final chromatograms by m/z
    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);
View Full Code Here


  /**
   * Returns the highest isotope pattern of a peak in this row
   */
  public IsotopePattern getBestIsotopePattern() {
    ChromatographicPeak peaks[] = getPeaks();
    Arrays.sort(peaks, new PeakSorter(SortingProperty.Height,
        SortingDirection.Descending));

    for (ChromatographicPeak peak : peaks) {
      IsotopePattern ip = peak.getIsotopePattern();
      if (ip != null)
View Full Code Here

  /**
   * Returns the highest peak in this row
   */
  public ChromatographicPeak getBestPeak() {
    ChromatographicPeak peaks[] = getPeaks();
    Arrays.sort(peaks, new PeakSorter(SortingProperty.Height,
        SortingDirection.Descending));
    return peaks[0];
  }
View Full Code Here

    for (int i = 0; i < maximumCharge; i++)
      charges[i] = i + 1;

    // Sort peaks by descending height
    ChromatographicPeak[] sortedPeaks = peakList.getPeaks(dataFile);
    Arrays.sort(sortedPeaks, new PeakSorter(SortingProperty.Height,
        SortingDirection.Descending));

    // Loop through all peaks
    totalPeaks = sortedPeaks.length;

    for (int ind = 0; ind < totalPeaks; ind++) {

      if (isCanceled())
        return;

      ChromatographicPeak aPeak = sortedPeaks[ind];

      // Check if peak was already deleted
      if (aPeak == null) {
        processedPeaks++;
        continue;
      }

      // Check which charge state fits best around this peak
      int bestFitCharge = 0;
      int bestFitScore = -1;
      Vector<ChromatographicPeak> bestFitPeaks = null;
      for (int charge : charges) {

        Vector<ChromatographicPeak> fittedPeaks = new Vector<ChromatographicPeak>();
        fittedPeaks.add(aPeak);
        fitPattern(fittedPeaks, aPeak, charge, sortedPeaks);

        int score = fittedPeaks.size();
        if ((score > bestFitScore)
            || ((score == bestFitScore) && (bestFitCharge > charge))) {
          bestFitScore = score;
          bestFitCharge = charge;
          bestFitPeaks = fittedPeaks;
        }

      }

      PeakListRow oldRow = peakList.getPeakRow(aPeak);

      assert bestFitPeaks != null;

      // Verify the number of detected isotopes. If there is only one
      // isotope, we skip this left the original peak in the peak list.
      if (bestFitPeaks.size() == 1) {
        deisotopedPeakList.addRow(oldRow);
        processedPeaks++;
        continue;
      }

      // Convert the peak pattern to array
      ChromatographicPeak originalPeaks[] = bestFitPeaks
          .toArray(new ChromatographicPeak[0]);

      // 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());

      // Depending on user's choice, we leave either the most intenst, or
      // the lowest m/z peak
      if (chooseMostIntense) {
        Arrays.sort(originalPeaks, new PeakSorter(
            SortingProperty.Height, SortingDirection.Descending));
      } else {
        Arrays.sort(originalPeaks, new PeakSorter(SortingProperty.MZ,
            SortingDirection.Ascending));
      }

      ChromatographicPeak newPeak = new SimpleChromatographicPeak(
          originalPeaks[0]);
View Full Code Here

    extendedPeakList = new SimplePeakList(peakList + " " + suffix,
        peakList.getRawDataFiles());

    // Sort peaks by descending height
    ChromatographicPeak[] sortedPeaks = peakList.getPeaks(dataFile);
    Arrays.sort(sortedPeaks, new PeakSorter(SortingProperty.Height,
        SortingDirection.Descending));

    // Loop through all peaks
    totalPeaks = sortedPeaks.length;
    ChromatographicPeak oldPeak;
View Full Code Here

TOP

Related Classes of net.sf.mzmine.util.PeakSorter

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.