xcmsRaw-utils: Various utility functions for xcmsRaw objects

Description Usage Arguments Value Accessing data in xcmsRaw objects Author(s) See Also Examples

Description

These functions enable user-friendly access of the data stored in an xcmsRaw object.

Usage

1
2
3
4
5
6
7
8
9
## S4 method for signature 'xcmsRaw'
scantimes(x)

## S4 method for signature 'xcmsRaw'
getData(x, mzrange=NULL, rtrange=NULL, intrange=NULL)

## S4 method for signature 'xcmsRaw'
msMap(object, mzrange=NULL, rtrange=NULL,
                          intrange=NULL, resMz=0.005, zeroIsNA=FALSE, ...)

Arguments

(in alphabetic order)

intrange

For getData: an optional numeric vector (of length 2) to subset by intensity range. Alternatively a numeric matrix with two columns, each row specifying an intensity range to subset the data. If NULL the full intensity range will be used.

mzrange

For getData: an optional numeric vector (of length 2) to subset the data by m/z range. Alternatively a numeric matrix with two columns, each row specifying a m/z range to subset the data. If NULL the full m/z range will be used.

object

An xcmsRaw object.

resMz

A numeric of length 1 specifying the resolution along the M/Z range. Intensities along the M/Z dimension will be aggregated into bins of this size.

rtrange

For getData: an optional numeric vector (of length 2) to subset by retention time range. Alternatively a numeric matrix with two columns, each row specifying a retention time range to subset the data. If NULL the full retention time range will be used.

x

An xcmsRaw object.

zeroIsNA

Set 0 intensities to NA.

...

Presently not used.

Value

Refer to the method and function description above for detailed information on the returned result object.

Accessing data in xcmsRaw objects

getData

Extract retention time, mz and intensity values from the xcmsRaw object. If none of the 3 parameters mzrange, rtrange and intrange are specified the method returns the full data. The method supports also definitions of multiple m/z, rt or intensity ranges, i.e. if mzrange, rtrange and/or intrange is a numeric two-column matrix, each row specifying a range.

The method returns a numeric matrix with columns "time", "mz" and "intensity" and rows depending on the input arguments (or a matrix with nrow equals 0 if the specified ranges do not match any data points). If mzrange, rtrange or intrange is a matrix, the method returns a list of matrices, each representing the subset defined by one of the rows of the input matrix (matrices).

msMap

Extracts intensities from the two-dimensional area (slice) defined by mzrange and rtrange and returns it as a MSmap object (i.e. a matrix-like two-dimensional representation of the slice). The intensities along the M/Z range will be aggregated in bins of size resMz.

scantimes

Returns the sample (retention) time for each individual mz value stored the xcmsRaw object. The length of the returned numeric vector is thus equal to the number of available data points. This is in contrast to the @scantime slot, which stores only the discrete scan times.

Author(s)

Johannes Rainer.

See Also

MSdata, MSslice, MSsliceList

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## Load the test data.
library(faahKO)
xset <- faahko
## Get the raw data for the first file
xraw <- getXcmsRaw(xset, 1)

## Get the scan time of the individual measured compounts.
head(scantimes(xraw))

## To get the unique scan times
head(xraw@scantime)

## Get the data matrix with retention time, mz and intensity
## for the defined retention time range.
datmat <- getData(xraw, rtrange=c(2509, 2530))
head(datmat)

## Subset also by mzrange.
datmat <- getData(xraw, rtrange=c(2509, 2530), mzrange=c(301, 302.003))
datmat

## Define 3 different ranges and extract the data subsets.
rtm <- rbind(c(2509, 2530),
             c(2534, 2540),
             c(2630, 2645))
mzm <- rbind(c(301, 302.003),
             c(304, 305),
             c(308, 308.3))
## Extracting the data we get a list of length 3, each list element
## representing the data subset defined by the corresponding rows in
## rtm and mzm.
getData(xraw, rtrange=rtm, mzrange=mzm)

jotsetung/xcmsExtensions documentation built on May 19, 2019, 9:42 p.m.