Package net.sf.mzmine.data

Examples of net.sf.mzmine.data.ChromatographicPeak


          mzRange.extendRange(p.getRawDataPointsMZRange());
        }
      }

      // Label best peak with preferred identity.
      final ChromatographicPeak bestPeak = selectedRow.getBestPeak();
      final PeakIdentity peakIdentity = selectedRow
          .getPreferredPeakIdentity();
      final Map<ChromatographicPeak, String> labelMap = new HashMap<ChromatographicPeak, String>(
          1);
      if (bestPeak != null && peakIdentity != null) {
View Full Code Here


    PeakListRow previewRow = (PeakListRow) comboPeak.getSelectedItem();
    if (previewRow == null)
      return;
    logger.finest("Loading new preview peak " + previewRow);
    ChromatographicPeak previewPeak = previewRow.getPeaks()[0];

    ticPlot.removeAllTICDataSets();

    // Load the intensities into array
    RawDataFile dataFile = previewPeak.getDataFile();
    int scanNumbers[] = previewPeak.getScanNumbers();
    double retentionTimes[] = new double[scanNumbers.length];
    for (int i = 0; i < scanNumbers.length; i++)
      retentionTimes[i] = dataFile.getScan(scanNumbers[i])
          .getRetentionTime();
    double intensities[] = new double[scanNumbers.length];
    for (int i = 0; i < scanNumbers.length; i++) {
      DataPoint dp = previewPeak.getDataPoint(scanNumbers[i]);
      if (dp != null)
        intensities[i] = dp.getIntensity();
      else
        intensities[i] = 0;
    }

    // Create shape model
    updateParameterSetFromComponents();
    JComboBox component = (JComboBox) getComponentForParameter(ShapeModelerParameters.shapeModelerType);
    ShapeModel model = (ShapeModel) component.getSelectedItem();

    JFormattedTextField resolutionField = (JFormattedTextField) getComponentForParameter(ShapeModelerParameters.massResolution);
    double resolution = ((Number) resolutionField.getValue()).doubleValue();

    try {
      Class<?> shapeModelClass = model.getModelClass();
      Constructor<?> shapeModelConstruct = shapeModelClass
          .getConstructors()[0];

      // shapePeakModel(ChromatographicPeak originalDetectedShape, int[]
      // scanNumbers,
      // double[] intensities, double[] retentionTimes, double resolution)
      ChromatographicPeak shapePeak = (ChromatographicPeak) shapeModelConstruct
          .newInstance(previewPeak, scanNumbers, intensities,
              retentionTimes, resolution);

      PeakDataSet peakDataSet = new PeakDataSet(shapePeak);
      ticPlot.addPeakDataset(peakDataSet);
View Full Code Here

  public PeakListDataSet(RawDataFile dataFile, int scanNumber,
      PeakList peakList) {

    this.peakList = peakList;

    ChromatographicPeak peaks[] = peakList.getPeaks(dataFile);

    Vector<ChromatographicPeak> candidates = new Vector<ChromatographicPeak>();
    for (ChromatographicPeak peak : peaks) {
      DataPoint peakDataPoint = peak.getDataPoint(scanNumber);
      if (peakDataPoint != null)
View Full Code Here

              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

  private synchronized void calculateAverageValues() {
    double rtSum = 0, mzSum = 0, heightSum = 0, areaSum = 0;
    Enumeration<ChromatographicPeak> peakEnum = peaks.elements();
    while (peakEnum.hasMoreElements()) {
      ChromatographicPeak p = peakEnum.nextElement();
      rtSum += p.getRT();
      mzSum += p.getMZ();
      heightSum += p.getHeight();
      areaSum += p.getArea();
    }
    averageRT = rtSum / peaks.size();
    averageMZ = mzSum / peaks.size();
    averageHeight = heightSum / peaks.size();
    averageArea = areaSum / peaks.size();
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();
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

      int index, boolean isSelected, boolean cellHasFocus) {

    PeakListRow row = (PeakListRow) value;
    if (row == null)
      return new JPanel();
    ChromatographicPeak peak = row.getPeaks()[0];

    String labelText = "#"
        + row.getID()
        + " "
        + MZmineCore.getConfiguration().getMZFormat()
View Full Code Here

          .getCompoundAt(index).getIsotopePattern();

      if (predictedPattern == null)
        return;

      ChromatographicPeak peak = peakListRow.getBestPeak();

      RawDataFile dataFile = peak.getDataFile();
      int scanNumber = peak.getRepresentativeScanNumber();
      SpectraVisualizerModule.showNewSpectrumWindow(dataFile, scanNumber,
          null, peak.getIsotopePattern(), predictedPattern);

    }

    if (command.equals("BROWSER")) {
      int index = IDList.getSelectedRow();
View Full Code Here

    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]);
      newPeak.setIsotopePattern(newPattern);
      newPeak.setCharge(bestFitCharge);

      // Keep old ID
      int oldID = oldRow.getID();
      SimplePeakListRow newRow = new SimplePeakListRow(oldID);
      PeakUtils.copyPeakListRowProperties(oldRow, newRow);
View Full Code Here

TOP

Related Classes of net.sf.mzmine.data.ChromatographicPeak

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.