trimMz-methods {MSnbase} | R Documentation

## Trims 'MSnExp' or 'Spectrum' instances

### Description

This method selects a range of MZ values in a single spectrum (`Spectrum` instances) or all the spectra of an experiment (`MSnExp` instances). The regions to trim are defined by the range of `mz` argument, such that MZ values <= `min(mz)` and MZ values >= `max(mz)` are trimmed away.

### Methods

`signature(object = "MSnExp", mz = "numeric", msLevel. = "numeric")`

  Trims all spectra in `MSnExp` object according to `mz`. If `msLevel.` is defined, then only spectra of that level are trimmer.

`signature(object = "Spectrum", mz = "numeric", msLevel. = "numeric")`

  Trims the `Spectrum` object and retruns a new trimmed object. `msLevel.` defines the level of the spectrum, and if `msLevel(object) != msLevel.`, cleaning is ignored. Only relevant when called from `OnDiskMSnExp` and is only relevant for developers.

### Author(s)

Laurent Gatto <lg390@cam.ac.uk>

### See Also

`removePeaks` and `clean` for other spectra processing methods.

### Examples

    mz <- 1:100
    sp1 <- new("Spectrum2",
               mz = mz,
               intensity = abs(rnorm(length(mz))))

    sp2 <- trimMz(sp1, c(25, 75))
    range(mz(sp1))
    range(mz(sp2))

    data(itraqdata)
    itraqdata2 <- filterMz(itraqdata, c(113, 117))
    range(mz(itraqdata))
    range(mz(itraqdata2))
    processingData(itraqdata2)

[Package MSnbase version 2.6.4 Index]