profMat-xcmsSet {xcms} | R Documentation

## The profile matrix

### Description

The profile matrix is an n x m matrix, n (rows) representing equally spaced m/z values (bins) and m (columns) the retention time of the corresponding scans. Each cell contains the maximum intensity measured for the specific scan and m/z values falling within the m/z bin.

The `profMat` method creates a new profile matrix or returns the profile matrix within the object's `@env` slot, if available. Settings for the profile matrix generation, such as `step` (the bin size), `method` or additional settings are extracted from the respective slots of the `xcmsRaw` object. Alternatively it is possible to specify all of the settings as additional parameters.

### Usage

    ## S4 method for signature 'xcmsRaw'
    profMat(object, method, step, baselevel, basespace,
      mzrange.)

### Arguments

`object` | The `xcmsRaw` object.
`method` | The profile matrix generation method. Allowed are `"bin"`, `"binlin"`, `"binlinbase"` and `"intlin"`. See details section for more information.
`step` | numeric(1) representing the m/z bin size.
`baselevel` | numeric(1) representing the base value to which empty elements (i.e. m/z bins without a measured intensity) should be set. Only considered if `method = "binlinbase"`. See `baseValue` parameter of `imputeLinInterpol` for more details.
`basespace` | numeric(1) representing the m/z length after which the signal will drop to the base level. Linear interpolation will be used between consecutive data points falling within `2 * basespace` to each other. Only considered if `method = "binlinbase"`. If not specified, it defaults to `0.075`. Internally this parameter is translated into the `distance` parameter of the `imputeLinInterpol` function by `distance = floor(basespace / step)`. See `distance` parameter of `imputeLinInterpol` for more details.
`mzrange.` | Optional numeric(2) manually specifying the mz value range to be used for binnind. If not provided, the whole mz value range is used.

### Details

Profile matrix generation methods:

bin

  The default profile matrix generation method that does a simple binning, i.e. aggregating of intensity values falling within an m/z bin.

binlin

  Binning followed by linear interpolation to impute missing values. The value for m/z bins without a measured intensity are inferred by a linear interpolation between neighboring bins with a measured intensity.

binlinbase

  Binning followed by a linear interpolation to impute values for empty elements (m/z bins) within a user-definable proximity to non-empty elements while stetting the element's value to the `baselevel` otherwise. See `impute = "linbase"` parameter of `imputeLinInterpol` for more details.

intlin

  Set the elements' values to the integral of the linearly interpolated data from plus to minus half the step size.

### Value

`profMat` returns the profile matrix (rows representing scans, columns equally spaced m/z values).

### Note

From `xcms` version 1.51.1 on only the `profMat` method should be used to extract the profile matrix instead of the previously default way to access it directly via `object@env$profile`.

### Author(s)

Johannes Rainer

### See Also

`xcmsRaw`, `binYonX` and `imputeLinInterpol` for the employed binning and missing value imputation methods, respectively. `profMat,XCMSnExp-method` for the method on `XCMSnExp` objects.

### Examples

    file <- system.file('cdf/KO/ko15.CDF', package = "faahKO")
    ## Load the data without generating the profile matrix (profstep = 0)
    xraw <- xcmsRaw(file, profstep = 0)
    ## Extract the profile matrix
    profmat <- profMat(xraw, step = 0.3)
    dim(profmat)
    ## If not otherwise specified, the settings from the xraw object are used:
    profinfo(xraw)
    ## To extract a profile matrix with linear interpolation use
    profmat <- profMat(xraw, step = 0.3, method = "binlin")
    ## Alternatively, the profMethod of the xraw objects could be changed
    profMethod(xraw) <- "binlin"
    profmat_2 <- profMat(xraw, step = 0.3)
    all.equal(profmat, profmat_2)

[Package xcms version 3.9.1 Index]