Package net.sf.mzmine.data

Examples of net.sf.mzmine.data.PeakListRow


      MassListDataSet dataset = new MassListDataSet(clickedMassList);
      window.addDataSet(dataset, Color.green);
    }

    if (clickedObject instanceof PeakListRow) {
      PeakListRow clickedPeak = (PeakListRow) clickedObject;
      PeakSummaryVisualizerModule.showNewPeakSummaryWindow(clickedPeak);
    }

  }
View Full Code Here


  /**
   * @see net.sf.mzmine.data.PeakList#getPeakRowNum(net.sf.mzmine.data.ChromatographicPeak)
   */
  public int getPeakRowNum(ChromatographicPeak peak) {

    PeakListRow rows[] = getRows();

    for (int i = 0; i < rows.length; i++) {
      if (rows[i].hasPeak(peak))
        return i;
    }
View Full Code Here

  public boolean hasRawDataFile(RawDataFile hasFile) {
    return Arrays.asList(dataFiles).contains(hasFile);
  }

  public PeakListRow getPeakRow(ChromatographicPeak peak) {
    PeakListRow rows[] = getRows();

    for (int i = 0; i < rows.length; i++) {
      if (rows[i].hasPeak(peak))
        return rows[i];
    }
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

    setStatus(TaskStatus.PROCESSING);

    logger.info("Starting complex search in " + peakList);

    PeakListRow rows[] = peakList.getRows();
    totalRows = rows.length;

    // Sort the array by m/z so we start with biggest peak (possible
    // complex)
    Arrays.sort(rows, new PeakListRowSorter(SortingProperty.MZ,
        SortingDirection.Descending));

    // Compare each three rows against each other
    for (int i = 0; i < totalRows; i++) {

      Range testRTRange = rtTolerance.getToleranceRange(rows[i]
          .getAverageRT());
      PeakListRow testRows[] = peakList
          .getRowsInsideScanRange(testRTRange);

      for (int j = 0; j < testRows.length; j++) {

        for (int k = j; k < testRows.length; k++) {
View Full Code Here

        ProjectionPlotParameters.peakMeasurementType).getValue() == PeakMeasurementType.AREA)
      useArea = true;

    double[][] rawData = new double[selectedRawDataFiles.length][selectedRows.length];
    for (int rowIndex = 0; rowIndex < selectedRows.length; rowIndex++) {
      PeakListRow peakListRow = selectedRows[rowIndex];
      for (int fileIndex = 0; fileIndex < selectedRawDataFiles.length; fileIndex++) {
        RawDataFile rawDataFile = selectedRawDataFiles[fileIndex];
        ChromatographicPeak p = peakListRow.getPeak(rawDataFile);
        if (p != null) {
          if (useArea)
            rawData[fileIndex][rowIndex] = p.getArea();
          else
            rawData[fileIndex][rowIndex] = p.getHeight();
View Full Code Here

      PrintWriter mgfWriter = new PrintWriter(tmpFile);
      for (int i = 0; i < pp.getRows().length; i++) {
        // Check if we are not canceled
        if (isCanceled())
          return;
        PeakListRow row = pp.getRows()[i];
        // TODO search for the peak with the best fragmentation not the
        // most intense peak
        Scan msmsScan = row
            .getBestPeak()
            .getDataFile()
            .getScan(
                row.getBestPeak()
                    .getMostIntenseFragmentScanNumber());
        if (msmsScan == null)
          continue;
        writeMgf(mgfWriter, row.getBestPeak().getDataFile(), msmsScan,
            i);
        mgfWriter.flush();
      }
      mgfWriter.close();
      mgfWriter = null;
View Full Code Here

      dataFileChoices = selectedPeakList[0].getRawDataFiles();
    } else {
      dataFileChoices = new RawDataFile[0];
    }

    PeakListRow rowChoices[];
    if ((selectedPeakList != null) && (selectedPeakList.length == 1)) {
      rowChoices = selectedPeakList[0].getRows();
    } else {
      rowChoices = new PeakListRow[0];
    }
View Full Code Here

    processedPeakList = new SimplePeakList(peakList + " " + suffix,
        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

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

          if (sourcePeak == null) {

            // Create a new gap

            double mz = sourceRow.getAverageMZ();
            double rt2 = -1;
            if (!masterList) {
              if (processedPeakList.getRow(row)
                  .getPeak(datafile2) != null) {
                rt2 = processedPeakList.getRow(row)
                    .getPeak(datafile2).getRT();
              }
            } else {
              if (peakList.getRow(row).getPeak(datafile2) != null) {
                rt2 = peakList.getRow(row).getPeak(datafile2)
                    .getRT();
              }
            }

            if (rt2 > -1) {

              double rt = info.predict(rt2);

              if (rt != -1) {

                Range mzRange = mzTolerance
                    .getToleranceRange(mz);
                Range rtRange = rtTolerance
                    .getToleranceRange(rt);

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

                gaps.add(newGap);
              }
            }

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

        }

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

TOP

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

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.