Examples of RawDataFileImpl


Examples of net.sf.mzmine.project.impl.RawDataFileImpl

    return initializedModules.values();
  }

  public static RawDataFileWriter createNewFile(String name)
      throws IOException {
    return new RawDataFileImpl(name);
  }
View Full Code Here

Examples of net.sf.mzmine.project.impl.RawDataFileImpl

    // Set total number of scans to process
    totalScans = 2 * dataFile.getNumOfScans();

    try {
      // Create a new file
      final RawDataFileImpl rawDataFileWriter = (RawDataFileImpl) MZmineCore
          .createNewFile(dataFile.getName() + ' ' + suffix);

      // Process each spectrum
      for (int scanNumber : dataFile.getScanNumbers(1)) {
        // Canceled?
        if (isCanceled())
          return;

        Scan spectrum = dataFile.getScan(scanNumber);

        // Add scan to new data file
        int storageID = rawDataFileWriter.storeDataPoints(spectrum
            .getDataPoints());
        CorrectedSpectrum newSpectrum = new CorrectedSpectrum(spectrum,
            rawDataFileWriter, spectrum.getNumberOfDataPoints(),
            storageID);

        rawDataFileWriter.addScan(newSpectrum);

        // Store spectrum locally for processing and analysis
        spectra.add(newSpectrum);

        processedScans++;
      }

      // Finalize writing
      correctedDataFile = rawDataFileWriter.finishWriting();

      // Process spectrum depending on ionization type
      switch (ionizationType) {
        case PCI :
        case PCI_METHANE :
View Full Code Here

Examples of net.sf.mzmine.project.impl.RawDataFileImpl

    // Set total number of scans to process
    totalScans = dataFile.getNumOfScans();

    try {
      // Create a new file
      final RawDataFileImpl rawDataFileWriter = (RawDataFileImpl) MZmineCore
          .createNewFile(dataFile.getName() + ' ' + suffix);

      // Process each deconvoluted spectrum
      for (int scanNumber : dataFile.getScanNumbers(1)) {
        // 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));
        }

        // Add scan to new data file
        int storageID = rawDataFileWriter
            .storeDataPoints(filteredDataPoints
                .toArray(new DataPoint[filteredDataPoints
                    .size()]));
        CorrectedSpectrum newSpectrum = new CorrectedSpectrum(spectrum,
            rawDataFileWriter, filteredDataPoints.size(), storageID);
        rawDataFileWriter.addScan(newSpectrum);

        processedScans++;
      }

      // If this task was canceled, stop processing
      if (!isCanceled()) {
        // Finalize writing
        filteredDataFile = rawDataFileWriter.finishWriting();

        // Add the newly created file to the project
        final MZmineProject project = MZmineCore.getCurrentProject();
        project.addFile(filteredDataFile);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.