Package net.sf.mzmine.data

Examples of net.sf.mzmine.data.PeakListRow


        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


    Vector<Double> colorCoordsV = new Vector<Double>();
    Vector<PeakListRow> peakListRowsV = new Vector<PeakListRow>();

    for (int rowIndex = 0; rowIndex < numOfRows; rowIndex++) {

      PeakListRow row = alignedPeakList.getRow(rowIndex);

      // Collect available peak intensities for selected files
      Vector<Double> groupOnePeakIntensities = new Vector<Double>();
      for (int fileIndex = 0; fileIndex < groupOneFiles.length; fileIndex++) {
        ChromatographicPeak p = row.getPeak(groupOneFiles[fileIndex]);
        if (p != null) {
          if (measurementType == PeakMeasurementType.AREA)
            groupOnePeakIntensities.add(p.getArea());
          else
            groupOnePeakIntensities.add(p.getHeight());
        }
      }
      Vector<Double> groupTwoPeakIntensities = new Vector<Double>();
      for (int fileIndex = 0; fileIndex < groupTwoFiles.length; fileIndex++) {
        ChromatographicPeak p = row.getPeak(groupTwoFiles[fileIndex]);
        if (p != null) {
          if (measurementType == PeakMeasurementType.AREA)
            groupTwoPeakIntensities.add(p.getArea());
          else
            groupTwoPeakIntensities.add(p.getHeight());
        }
      }

      // If there are at least one measurement from each group for this
      // peak then calc logratio and include this peak in the plot
      if ((groupOnePeakIntensities.size() > 0)
          && (groupTwoPeakIntensities.size() > 0)) {

        double[] groupOneInts = CollectionUtils
            .toDoubleArray(groupOnePeakIntensities);
        double groupOneAvg = MathUtils.calcAvg(groupOneInts);
        double[] groupTwoInts = CollectionUtils
            .toDoubleArray(groupTwoPeakIntensities);
        double groupTwoAvg = MathUtils.calcAvg(groupTwoInts);
        double logratio = Double.NaN;
        if (groupTwoAvg != 0.0)
          logratio = (double) (Math.log(groupOneAvg / groupTwoAvg) / Math
              .log(2.0));

        Double rt = row.getAverageRT();
        Double mz = row.getAverageMZ();

        xCoordsV.add(rt);
        yCoordsV.add(mz);
        colorCoordsV.add(logratio);
        peakListRowsV.add(row);
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

    String indexSplit[] = index.split(":");

    int series = Integer.parseInt(indexSplit[0]);
    int item = Integer.parseInt(indexSplit[1]);

    PeakListRow row = mainDataSet.getRow(series, item);

    PeakSummaryComponent newSummary = new PeakSummaryComponent(row,
        peakList.getRawDataFiles(), true, true, true, true, false,
        ComponentToolTipManager.bg);
View Full Code Here

    // Whenever chart is repainted (e.g. after crosshair position changed),
    // we update the selected item name
    if (event.getType() == ChartProgressEvent.DRAWING_FINISHED) {
      double valueX = plot.getDomainCrosshairValue();
      double valueY = plot.getRangeCrosshairValue();
      PeakListRow selectedRow = mainDataSet.getRow(valueX, valueY);
      topPanel.updateItemNameText(selectedRow);
    }
  }
View Full Code Here

    if (command.equals("TIC")) {

      double valueX = plot.getDomainCrosshairValue();
      double valueY = plot.getRangeCrosshairValue();
      PeakListRow selectedRow = mainDataSet.getRow(valueX, valueY);

      if (selectedRow == null) {
        MZmineCore.getDesktop().displayErrorMessage(
            "No peak is selected");
        return;
      }

      ChromatographicPeak[] peaks = selectedRow.getPeaks();
      Range rtRange = peakList.getRowsRTRange();
      Range mzRange = null;

      for (ChromatographicPeak p : peaks) {
        if (mzRange == null) {
          mzRange = p.getRawDataPointsMZRange();
        } else {
          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

    Object src = event.getSource();

    if (src == comboPeakList) {
      PeakList selectedPeakList = (PeakList) comboPeakList
          .getSelectedItem();
      PeakListRow rows[] = selectedPeakList.getRows();
      comboPeak.removeActionListener(this);
      comboPeak.removeAllItems();
      for (PeakListRow row : rows) {
        comboPeak.addItem(row);
      }
View Full Code Here

    }
  }

  private void loadPreviewPeak() {

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

      ticDataset = new ChromatogramTICDataSet(previewRow.getPeaks()[0]);
      ticPlot.addTICDataset(ticDataset);

      // Set auto range to axes
      ticPlot.getXYPlot().getDomainAxis().setAutoRange(true);
      ticPlot.getXYPlot().getDomainAxis().setAutoTickUnitSelection(true);
View Full Code Here

        label.setIcon(peakListIcon);
      }
    }

    if (embeddedObject instanceof PeakListRow) {
      PeakListRow r = (PeakListRow) embeddedObject;
      label.setIcon(peakIcon);
      label.setFont(smallFont);

      // Change the color only if the row is not selected
      if (!sel) {
        if (r.getPreferredPeakIdentity() != null) {
          label.setForeground(Color.red);
        }
      }

    }
View Full Code Here

          "Please select a single peak list");
      return ExitCode.CANCEL;
    }

    RawDataFile plDataFiles[] = selectedPeakLists[0].getRawDataFiles();
    PeakListRow plRows[] = selectedPeakLists[0].getRows();
    Arrays.sort(plRows, new PeakListRowSorter(SortingProperty.MZ,
        SortingDirection.Ascending));

    getParameter(dataFiles).setChoices(plDataFiles);
    getParameter(dataFiles).setValue(plDataFiles);
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.