Package net.sf.mzmine.data.impl

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


   * @return New peak list row with normalized retention time
   */
  private PeakListRow normalizeRow(PeakListRow originalRow,
      PeakListRow standards[], double normalizedStdRTs[]) {

    PeakListRow normalizedRow = new SimplePeakListRow(originalRow.getID());

    // Standard rows preceding and following this row
    int prevStdIndex = -1, nextStdIndex = -1;

    for (int stdIndex = 0; stdIndex < standards.length; stdIndex++) {

      // If this standard peak is actually originalRow
      if (standards[stdIndex] == originalRow) {
        prevStdIndex = stdIndex;
        nextStdIndex = stdIndex;
        break;
      }

      // If this standard peak is before our originalRow
      if (standards[stdIndex].getAverageRT() < originalRow.getAverageRT()) {
        if ((prevStdIndex == -1)
            || (standards[stdIndex].getAverageRT() > standards[prevStdIndex]
                .getAverageRT()))
          prevStdIndex = stdIndex;
      }

      // If this standard peak is after our originalRow
      if (standards[stdIndex].getAverageRT() > originalRow.getAverageRT()) {
        if ((nextStdIndex == -1)
            || (standards[stdIndex].getAverageRT() < standards[nextStdIndex]
                .getAverageRT()))
          nextStdIndex = stdIndex;
      }

    }

    // Calculate normalized retention time of this row
    double normalizedRT = -1;

    if ((prevStdIndex == -1) || (nextStdIndex == -1)) {
      normalizedRT = originalRow.getAverageRT();
    } else

    if (prevStdIndex == nextStdIndex) {
      normalizedRT = normalizedStdRTs[prevStdIndex];
    } else {
      double weight = (originalRow.getAverageRT() - standards[prevStdIndex]
          .getAverageRT())
          / (standards[nextStdIndex].getAverageRT() - standards[prevStdIndex]
              .getAverageRT());
      normalizedRT = normalizedStdRTs[prevStdIndex]
          + (weight * (normalizedStdRTs[nextStdIndex] - normalizedStdRTs[prevStdIndex]));
    }

    // Set normalized retention time to all peaks in this row
    for (RawDataFile file : originalRow.getRawDataFiles()) {
      ChromatographicPeak originalPeak = originalRow.getPeak(file);
      if (originalPeak != null) {
        SimpleChromatographicPeak normalizedPeak = new SimpleChromatographicPeak(
            originalPeak);
        PeakUtils.copyPeakProperties(originalPeak, normalizedPeak);
        normalizedPeak.setRT(normalizedRT);
        normalizedRow.addPeak(file, normalizedPeak);
      }
    }

    return normalizedRow;

View Full Code Here


          double normalizedArea = originalPeak.getArea()
              / normalizationFactor;
          normalizedPeak.setHeight(normalizedHeight);
          normalizedPeak.setArea(normalizedArea);

          SimplePeakListRow normalizedRow = rowMap
              .get(originalpeakListRow);

          if (normalizedRow == null) {

            normalizedRow = new SimplePeakListRow(
                originalpeakListRow.getID());

            PeakUtils.copyPeakListRowProperties(
                originalpeakListRow, normalizedRow);

            rowMap.put(originalpeakListRow, normalizedRow);
          }

          normalizedRow.addPeak(file, normalizedPeak);

        }

      }

      // Progress
      processedDataFiles++;

    }

    // Finally add all normalized rows to normalized alignment result
    for (PeakListRow originalpeakListRow : originalPeakList.getRows()) {
      SimplePeakListRow normalizedRow = rowMap.get(originalpeakListRow);
      normalizedPeakList.addRow(normalizedRow);
    }

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

        PeakListRow targetRow = alignmentMapping.get(row);

        // If we have no mapping for this row, add a new one
        if (targetRow == null) {
          targetRow = new SimplePeakListRow(newRowID);
          newRowID++;
          alignedPeakList.addRow(targetRow);
        }

        // Add all peaks from the original row to the aligned row
View Full Code Here

          newID = row.getID() + 1;
        }
      }

      // create a new row
      final PeakListRow newRow = new SimplePeakListRow(newID);
      peakList.addRow(newRow);
      final PeakListTableModel tableModel = (PeakListTableModel) table
          .getModel();
      tableModel.fireTableDataChanged();
      ManualPeakPickerModule.runManualDetection(
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.