Package net.sf.mzmine.data

Examples of net.sf.mzmine.data.Scan


      return;

    Integer scanNumber = (Integer) comboScanNumber.getSelectedItem();
    if (scanNumber == null)
      return;
    Scan currentScan = previewDataFile.getScan(scanNumber);

    updateParameterSetFromComponents();

    loadPreview(spectrumPlot, currentScan);
View Full Code Here


    assert (dataFile != null);

    for (RawDataFile f : MZmineCore.getCurrentProject().getDataFiles())
      System.out.println(f);

    Scan spectrum = dataFile.getScan(1);

    assert (dataFile.getName().contains("filtered"));
    assert (spectrum.getDataPointsByMass(new Range(146, 149)).length == 1);
    assert (spectrum.getDataPointsByMass(new Range(234, 246)).length == 1);
    assert (spectrum.getDataPointsByMass(new Range(249, 261)).length == 1);
  }
View Full Code Here

        // Canceled?
        if (isCanceled())
          return;

        // Duplicate current spectrum
        Scan spectrum = dataFile.getScan(scanNumber);

        // Exclude the entire spectrum if its base peak intensity is
        // less than the given threshold
        if (spectrum.getBasePeak().getIntensity() < basePeakThreshold)
          continue;

        // Exclude the entire spectrum if its unique mass intensity is
        // less than the given threshold
        if (spectrum instanceof CorrectedSpectrum) {
          CorrectedSpectrum s = ((CorrectedSpectrum) spectrum);

          if (s.getUniqueMass() != null
              && s.getUniqueMass().getIntensity() < uniqueMassThreshold)
            continue;
        }

        // Get the data points from the spectrum and sort by m/z
        List<DataPoint> dataPoints = Lists.newArrayList(spectrum
            .getDataPoints());
        Collections.sort(dataPoints, new Comparator<DataPoint>() {
          @Override
          public int compare(DataPoint a, DataPoint b) {
            return a.getMZ() < b.getMZ() ? -1 : a.getMZ() > b
                .getMZ() ? 1 : 0;
          }
        });

        // Create a list for the filtered points
        List<DataPoint> filteredDataPoints = new ArrayList<DataPoint>();

        // Filter the data points given pre-defined conditions
        for (int i = dataPoints.size() - 1; i >= 0; i--) {
          // Step #1: Remove C13 Isotope ions
          if (i > 0
              && dataPoints.get(i).getMZ()
                  - dataPoints.get(i - 1).getMZ() < 1 + EPSILON
              && dataPoints.get(i - 1).getIntensity() >= (1 + c13IsotopeCut)
                  * dataPoints.get(i).getIntensity())
            continue;

          // Step #2: Remove all ions < 100 counts
          else if (dataPoints.get(i).getIntensity() < intensityThreshold)
            continue;

          // Step #3: Remove all ions < 1% of base peak
          else if (dataPoints.get(i).getIntensity() < intensityPercentageThreshold
              * spectrum.getBasePeak().getIntensity())
            continue;

          // If the data point passes all filters, keep it.
          else
            filteredDataPoints.add(0, dataPoints.get(i));
View Full Code Here

    int originScanNumber = oldPeak.getRepresentativeScanNumber();
    RawDataFile rawFile = oldPeak.getDataFile();
    ExtendedPeak newPeak = new ExtendedPeak(rawFile);
    int totalScanNumber = rawFile.getNumOfScans();
    Range mzRange = mzTolerance.getToleranceRange(oldPeak.getMZ());
    Scan scan;
    DataPoint dataPoint;

    // Look for dataPoint related to this peak to the left
    int scanNumber = originScanNumber;
    scanNumber--;
    while (scanNumber > 0) {

      scan = rawFile.getScan(scanNumber);

      if (scan == null) {
        scanNumber--;
        continue;
      }

      if (scan.getMSLevel() != 1) {
        scanNumber--;
        continue;
      }

      dataPoint = ScanUtils.findBasePeak(scan, mzRange);

      if (dataPoint == null)
        break;
      if (dataPoint.getIntensity() < minimumHeight)
        break;

      newPeak.addMzPeak(scanNumber, dataPoint);
      if (dataPoint.getIntensity() > maxHeight)
        maxHeight = dataPoint.getIntensity();

      scanNumber--;

    }

    // Add original dataPoint
    newPeak.addMzPeak(originScanNumber,
        oldPeak.getDataPoint(originScanNumber));

    // Look to the right
    scanNumber = originScanNumber;
    scanNumber++;
    while (scanNumber <= totalScanNumber) {

      scan = rawFile.getScan(scanNumber);

      if (scan == null) {
        scanNumber++;
        continue;
      }

      if (scan.getMSLevel() != 1) {
        scanNumber++;
        continue;
      }

      dataPoint = ScanUtils.findBasePeak(scan, mzRange);
View Full Code Here

    int[] scanNumbers = dataFile.getScanNumbers();
    totalScans = scanNumbers.length;

    for (processedScans = 0; processedScans < totalScans; processedScans++) {
      Scan scan = dataFile.getScan(scanNumbers[processedScans]);

      if (RTRange.contains(scan.getRetentionTime())) {
        Scan scanCopy = new SimpleScan(scan);
        rawDataFileWriter.addScan(scanCopy);
      }
    }

    return rawDataFileWriter.finishWriting();
View Full Code Here

    try {
      int[] scanNumbers = dataFile.getScanNumbers(1);
      int totalScans = scanNumbers.length;

      for (int i = 0; i < totalScans; i++) {
        Scan scan = dataFile.getScan(scanNumbers[i]);
        if (scan != null) {
          rawDataFileWriter.addScan(new SimpleScan(scan));
        }
      }
View Full Code Here

      // - normalization by total raw signal
      if (normalizationType == NormalizationType.TotalRawSignal) {
        normalizationFactor = 0;
        for (int scanNumber : file.getScanNumbers(1)) {
          Scan scan = file.getScan(scanNumber);
          normalizationFactor += scan.getTIC();
        }
      }

      // Readjust normalization factor so that maximum height will be
      // equal to maximumOverallPeakHeightAfterNormalization after
View Full Code Here

      // Open file
      this.startReading();

      // Parse scans
      Scan buildingScan;
      while ((buildingScan = this.readNextScan()) != null) {

        // Check if cancel is requested
        if (isCanceled()) {
          return;
View Full Code Here

        if (isCanceled())
          return;

        // Get next scan
        Scan scan = dataFile.getScan(scanNumber);

        // Find most intense m/z peak
        DataPoint basePeak = ScanUtils.findBasePeak(scan, mzRange);

        if (basePeak != null) {
          if (basePeak.getIntensity() > 0)
            dataPointFound = true;
          newPeak.addDatapoint(scan.getScanNumber(), basePeak);
        } else {
          DataPoint fakeDataPoint = new SimpleDataPoint(
              mzRange.getAverage(), 0);
          newPeak.addDatapoint(scan.getScanNumber(), fakeDataPoint);
        }

        processedScans++;

      }
View Full Code Here

    fragmentScan = ScanUtils.findBestFragmentScan(dataFile, rtRange,
        mzRange);

    if (fragmentScan > 0) {
      Scan fragmentScanObject = dataFile.getScan(fragmentScan);
      int precursorCharge = fragmentScanObject.getPrecursorCharge();
      if ((precursorCharge > 0) && (this.charge == 0))
        this.charge = precursorCharge;
    }

  }
View Full Code Here

TOP

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

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.