Package net.sf.mzmine.data.impl

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


        // Setting the level of fragment of scan and parent scan number
        msLevelTree++;
        parentTreeValue[msLevel] = scanNumber;

        buildingScan = new SimpleScan(null, scanNumber, msLevel,
            retentionTime, parentScan, 0, 0, null,
            new DataPoint[0], false);

      }
View Full Code Here


        if (msLevelTree == 0) {
          parentStack.addFirst(buildingScan);
          buildingScan = null;
          while (!parentStack.isEmpty()) {
            SimpleScan currentScan = parentStack.removeLast();
            try {
              newMZmineFile.addScan(currentScan);
            } catch (IOException e) {
              setStatus(TaskStatus.ERROR);
              errorMessage = "IO error: " + e;
View Full Code Here

         * previous scans stored in the stack, are complete and ready to
         * be written to the raw data file.
         */
        if (msLevel == 1) {
          while (!parentStack.isEmpty()) {
            SimpleScan currentScan = parentStack.removeFirst();
            newMZmineFile.addScan(currentScan);
          }
        }

        // Setting the current parentScan
        int parentScan = -1;
        if (msLevel > 1) {
          parentScan = parentTreeValue[msLevel - 1];

          if (!parentStack.isEmpty()) {
            for (SimpleScan s : parentStack) {
              if (s.getScanNumber() == parentScan) {
                s.addFragmentScan(scanNumber);
              }
            }
          }
        }

        // Setting the parent scan number for this level of fragments
        parentTreeValue[msLevel] = scanNumber;

        SimpleScan newScan = new SimpleScan(null, scanNumber, msLevel,
            retentionTime, parentScan, precursorMZ,
            precursorCharge, null, optimizedDataPoints, centroided);

        parentStack.add(newScan);
        parsedScans++;

        // Clean the variables for next scan
        scanNumber = 0;
        msLevel = 0;
        retentionTime = 0;
        precursorMZ = 0;
        precursorCharge = 0;

      }

    }

    // Add remaining scans in the parentStack
    while (!parentStack.isEmpty()) {
      SimpleScan currentScan = parentStack.removeFirst();
      newMZmineFile.addScan(currentScan);
    }

  }
View Full Code Here

    }

    // An empty scan needs some special attention..
    if (scanLength[0] == 0) {
      scanNum++;
      return new SimpleScan(null, scanNum, 1,
          retentionTime.doubleValue(), -1, 0, 0, null,
          new DataPoint[0], false);
    }

    // Read mass and intensity values
    Array massValueArray;
    Array intensityValueArray;
    try {
      massValueArray = massValueVariable.read(scanStartPosition,
          scanLength);
      intensityValueArray = intensityValueVariable.read(
          scanStartPosition, scanLength);
    } catch (Exception e) {
      logger.log(
          Level.SEVERE,
          "Could not read from variables mass_values and/or intensity_values.",
          e);
      throw (new IOException(
          "Could not read from variables mass_values and/or intensity_values."));
    }

    Index massValuesIndex = massValueArray.getIndex();
    Index intensityValuesIndex = intensityValueArray.getIndex();

    int arrayLength = massValueArray.getShape()[0];

    DataPoint completeDataPoints[] = new DataPoint[arrayLength];

    for (int j = 0; j < arrayLength; j++) {
      Index massIndex0 = massValuesIndex.set0(j);
      Index intensityIndex0 = intensityValuesIndex.set0(j);

      double mz = massValueArray.getDouble(massIndex0)
          * massValueScaleFactor;
      double intensity = intensityValueArray.getDouble(intensityIndex0)
          * intensityValueScaleFactor;
      completeDataPoints[j] = new SimpleDataPoint(mz, intensity);

    }

    scanNum++;

    // Auto-detect whether this scan is centroided
    boolean centroided = ScanUtils.isCentroided(completeDataPoints);

    // Remove zero data points
    DataPoint optimizedDataPoints[] = ScanUtils.removeZeroDataPoints(
        completeDataPoints, centroided);

    SimpleScan buildingScan = new SimpleScan(null, scanNum, 1,
        retentionTime.doubleValue(), -1, 0, 0, null,
        optimizedDataPoints, centroided);

    return buildingScan;

View Full Code Here

        // Remove zero data points
        DataPoint optimizedDataPoints[] = ScanUtils
            .removeZeroDataPoints(completeDataPoints, centroided);

        buildingScan = new SimpleScan(null, scanNumber, msLevel,
            retentionTime, parentScan, precursorMz,
            precursorCharge, null, optimizedDataPoints, centroided);

        /*
         * Update of fragmentScanNumbers of each Scan in the parentStack
         */
        for (SimpleScan s : parentStack) {
          if (s.getScanNumber() == buildingScan.getParentScanNumber()) {
            s.addFragmentScan(buildingScan.getScanNumber());
          }
        }

        /*
         * Verify the size of parentStack. The actual size of the window
         * to cover possible candidates for fragmentScanNumber update is
         * 10 elements.
         */
        if (parentStack.size() > 10) {
          SimpleScan scan = parentStack.removeLast();
          try {
            newMZmineFile.addScan(scan);
          } catch (IOException e) {
            setStatus(TaskStatus.ERROR);
            errorMessage = "IO error: " + e;
View Full Code Here

      charBuffer.append(buf, offset, len);
    }

    public void endDocument() throws SAXException {
      while (!parentStack.isEmpty()) {
        SimpleScan scan = parentStack.removeLast();
        try {
          newMZmineFile.addScan(scan);
        } catch (IOException e) {
          setStatus(TaskStatus.ERROR);
          errorMessage = "IO error: " + e;
View Full Code Here

        DataPoint[] dataPoints = new DataPoint[spectrumSize];
        for (int j = 0; j < spectrumSize; j++) {
          dataPoints[j] = new SimpleDataPoint(scanner.nextDouble(),
              scanner.nextDouble());
        }
        newMZmineFile.addScan(new SimpleScan(null, parsedScans + 1,
            msLevel, retentionTime, -1, 0.0, charge, null,
            dataPoints, ScanUtils.isCentroided(dataPoints)));

        scanner.nextLine();
      }
View Full Code Here

        // Remove zero data points
        DataPoint optimizedDataPoints[] = ScanUtils
            .removeZeroDataPoints(dataPoints, centroided);

        SimpleScan scan = new SimpleScan(null, scanNumber, msLevel,
            retentionTime, parentScan, precursorMz,
            precursorCharge, null, optimizedDataPoints, centroided);

        for (SimpleScan s : parentStack) {
          if (s.getScanNumber() == parentScan) {
            s.addFragmentScan(scanNumber);
          }
        }

        /*
         * Verify the size of parentStack. The actual size of the window
         * to cover possible candidates is defined by limitSize.
         */
        if (parentStack.size() > PARENT_STACK_SIZE) {
          SimpleScan firstScan = parentStack.removeLast();
          newMZmineFile.addScan(firstScan);
        }

        parentStack.addFirst(scan);

        parsedScans++;

      }

      while (!parentStack.isEmpty()) {
        SimpleScan scan = parentStack.removeLast();
        newMZmineFile.addScan(scan);

      }

      finalRawDataFile = newMZmineFile.finishWriting();
View Full Code Here

TOP

Related Classes of net.sf.mzmine.data.impl.SimpleScan

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.