Description Usage Arguments Value Objects of the class Slots Extends Constructors and alike Accessing and subsetting Data visualizations Data manipulations Author(s) See Also Examples
Sub-sets of an MS run across several samples can be stored in a
MSslice
object. Such a slice of the MS data is defined by an
m/z and a retention time range in each sample. The actual data of the
slice in each sample is stored as MSdata
object, i.e. as
intensities for each mz/rt tuple measured in a sample.
Depending on the measurements, the actual mz/rt ranges in each
individual MSdata
can be slightly different, but all are
within the mz and rt range of the MSslice
object (that can be
returned by the mzrange
and rtrange
method).
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ## S4 method for signature 'MSslice'
assayData(object)
## S4 replacement method for signature 'MSslice'
assayData(object) <- value
## S4 method for signature 'MSslice'
binMzRtime(object, FUN=max, mzNbin=NULL,
mzBinSize=NULL, rtNbin=NULL, rtBinSize=NULL)
## S4 method for signature 'MSslice'
binRtime(object, FUN=max, bins=NULL, nbin=NULL,
binSize=NULL)
## S4 method for signature 'MSslice'
getChromatogram(object, FUN=max, bins=NULL,
nbin=NULL, binSize=NULL, ...)
## S4 method for signature 'MSslice'
getSpectrum(object, FUN=max, bins=NULL,
nbin=NULL, binSize=NULL, ...)
## S4 method for signature 'MSslice'
intrange(object)
## S4 method for signature 'MSslice'
length(x)
MSslice(x, ...)
## S4 method for signature 'MSslice'
msData(object, ...)
## S4 method for signature 'list'
msSlice(object, ...)
## S4 method for signature 'MSdata'
msSlice(object, ...)
## S4 method for signature 'xcmsSet'
msSlice(object, mzrange=NULL, rtrange=NULL,
rt="corrected", BPPARAM=MulticoreParam())
## S4 method for signature 'xcmsRaw'
msSlice(object, mzrange=NULL, rtrange=NULL, ...)
## S4 method for signature 'MSslice'
mzrange(object)
## S4 method for signature 'MSslice'
names(x)
## S4 replacement method for signature 'MSslice'
names(x) <- value
## S4 method for signature 'MSslice'
phenoData(object)
## S4 replacement method for signature 'MSslice'
phenoData(object) <- value
## S4 method for signature 'MSslice'
pData(object)
## S4 replacement method for signature 'MSslice'
pData(object) <- value
## S4 method for signature 'MSslice'
plotChromatogram(object, FUN=max, bins=NULL,
nbin=NULL, binSize=NULL,
main=paste(format(mzrange(object), 2),
collapse="-"), xlab="Retention time",
ylab="Intensity", col=1, lty=1, ...)
## S4 method for signature 'MSslice'
plotSpectrum(object, FUN=max, bins=NULL,
nbin=NULL, binSize=NULL,
main=paste(format(rtrange(object), 2),
collapse="-"), xlab="M/Z",
ylab="Intensity", col=1, lty=1, ...)
## S4 method for signature 'MSslice'
rtrange(object)
## S4 method for signature 'MSslice'
subset(x, mzrange=NULL, rtrange=NULL)
|
(in alphabetic order)
bins |
For |
binSize |
For |
FUN |
For |
BPPARAM |
Parallel processing parameters; see
|
col |
For |
lty |
For |
main |
For |
mzNbin |
For |
mzBinSize |
For |
mzrange |
A numeric vector defining the m/z-value range of the slice. |
nbin |
For |
object |
For For all other methods a |
rt |
For |
rtNbin |
For |
rtBinSize |
For |
rtrange |
A numeric vector defining the retention time range of the slice. |
value |
For For For For |
x |
For For |
xlab |
For |
ylab |
For |
... |
For For Ignored for all other methods. |
Refer to the method and function description above for detailed information on the returned result object.
While MSslice
objects can be created by the constructor
function MSslice
the default way to create such an object is by
using the msSlice
method on an xcmsSet
(or
xcmsRaw
) object.
A list of MSdata
objects.
Object of class MIAPE
containing details of
experimental methods.
A numeric vector of length 2 specifying the range of m/z values of the slice.
An AnnoatedDataFrame
providing the sample description.
A numeric vector of length 2 specifying the retention time range of the slice.
Class "Versioned"
defined in the Biobase
package, directly.
Constructor method to create a new MSslice
instance
accepting either a list of MSdata
objects or
a single MSdata
object. All additional arguments
(e.g. phenoData
, experimentData
)
are directly passed to the "new"
call.
Extract an msSlice
object from an
xcmsRaw
or xcmsSet
object. The latter (i.e. extraction from an xcmsSet
object)
is the default constructor that will be mostly used. It
allows to extract intensity values for the m/z and rt range that
defines the slice of MS data from each individual sample. The
result is returned as an MSslice
object. If multiple mz and
rt ranges are specified (i.e. arguments mzrange
and
rtrange
are 2-column matrices, each row specifying a
different range) the result will be returned as an
MSsliceList
object.
Note that the mzrange
and rtrange
of each of the
extracted MSdata
for each sample will be slightly
different, but all are within the mzrange
and
rtrange
of the MSslice
object.
If object
is an MSdata
object it wraps that into an
MSslice
object.
Get and set the assay data (i.e. the list of internal
MSdata
objects). This method is the same than the
msData
method.
Extracts a numeric matrix with the chromatogram (i.e. intensities
along the retention time dimension) for each of the MSdata
object and hence samples of the MSslice
object. The
rownames of the matrix represent the (unique) retention times and
each column contains the spectrum of one sample/MSdata
object (i.e. the intensities aggregated in m/z direction for the
respective retention time using the aggregation function specified
with argument FUN
).
In the default settings, without specifying any of the arguments
bins
, nbin
or binSize
, the method returns a
matrix with one row for each unique retention time across all of
the samples. Each row will only contain a numeric value for a
sample in which a signal was measured for that specific retention
time. In most instances it will be better to specify nbin
or binSize
, to bin values also along the retention time
dimension. Ideally, the binning should not be too coarse, but also
not too detailed (in which case the matrix will again be
relatively sparse); a binning with a binSize=1
(i.e. one
second), or slightly smaller, might be OK in most instances.
For more details on the binning see the help for the
getChromatogram
method of MSdata
objects.
Extracts a numeric matrix with the spectrum (i.e. intensities
along the M/Z dimension) for each of the MSdata
objects and
hence samples of the MSslice
object. The rownames of the
matrix represent the distinct M/Z values and columns the
individual samples. For more details (e.g. also on binning etc)
see the help of the getChromatogram
method above.
Get the range of intensity values of the slice. This represents the range of
values across all samples (i.e. all MSdata
objects within
the MSslice
). Returns a numeric of length
2, or c(NA, NA)
if the object is empty (or the internal
MSdata
object(s) don't contain any data).
Get the length of the object, i.e. the number of MSdata
object stored within the object.
Get the list
of MSdata
objects.
Get the m/z value range of the slice. This represents the range of
values across all samples (i.e. all MSdata
objects within
the MSslice
). Returns a numeric of length
2, or c(NA, NA)
if the object is empty (or the internal
MSdata
object(s) don't contain any data).
Get and set the names of the MSdata
objects.
Subsets the MSslice
object object and returns an
MSslice
object with only the elements selected by
i
. i
can be an integer vector or a character vector,
if names are available in object
.
Extract e single MSdata
object from the
MSslice
object.
Get and set the pheno data, i.e. the AnnotatedDataFrame
providing the sample annotation (phenotypic information and
covariates). Each row describing one sample each column
representing one covariate. The ordering is assumed to be
identical to the ordering of the MSdata
objects in the
assayData
slot.
The pData
method accesses the same slot, but returns (and
accepts) a data.frame
.
Get the retention time range of the slice. This represents the range of
values across all samples (i.e. all MSdata
objects within
the MSslice
). Returns a numeric of length
2, or c(NA, NA)
if the object is empty (or the internal
MSdata
object(s) don't contain any data).
Subset the MSslice
based on the specified M/Z and retention
time ranges. The method returns a MSslice
object.
Plots the chromatogram of the rt-m/z slice across all of the
MSdata
objects (i.e. samples). The arguments col
and
lty
can be used to use a different color for each line
(i.e. sample) or a different line type. See description of the
getChromatogram
for details on the other parameters.
Plots the spectrum; see help of plotChromatogram
above.
This method cuts the M/Z range of an MSslice
object in equal
spaced bins and aggregates all intensity values with an M/Z value
falling within the bin and the same retention time.
For details on the method arguments and the binning see the help
for the getChromatogram
method.
The method returns an MSslice
object.
This method performs a binning first in M/Z dimension followed by a retention time binning.
For details on binning see the getChromatogram
method.
The method returns a MSslice
object with the data binned
both on M/Z and retention time dimension.
Same as the binMz
method, but for binning along the
retention time dimension.
The method returns an MSslice
object.
Johannes Rainer.
xcmsSet
, xcmsRaw
,
MSdata
, MSsliceList
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | ## Load the faahKO package with the test data for the xcms package.
library(faahKO)
xset <- faahko
## Define a data sub-set and extract the corresponding values from
## the xcmsSet object. This will extract the intensity values of the
## defined slice from each individual sample.
rtr <- c(2600, 2670)
mzr <- c(300, 400)
mss <- msSlice(xset, rtrange=rtr, mzrange=mzr)
## Access the phenoData
phenoData(mss)
## Access individual columns using the $ method
mss$class
## Get the number of samples
length(mss)
## We don't have any names yet
names(mss)
## Setting the names using the ones provided by the sampnames method of the
## xcmsSet object.
names(mss) <- sampnames(xset)
names(mss)
## Subset to samples with name starting with wt
mssSub <- mss[grep(names(mss), pattern="^wt")]
names(mssSub)
## Extract a single MSdata object
mssSub[["wt18"]]
## Get the mz, rt and intensity range. This corresponds to the range of
## values of the slice across all samples.
mzrange(mss)
rtrange(mss)
intrange(mss)
## Extract the list of MSdata objects
msData(mss)
## Extract the chromatogram of a m/z-rt slice across all samples.
## Defining the mz and rt ranges for the peak in the xcms
## vignette (Figure 4).
mzr <- c(302, 302.5)
rtr <- c(2500, 2700)
mss <- msSlice(xset, rtrange=rtr, mzrange=mzr)
## We're getting a sparse matrix if we're not binning along the rt-dimension,
## since the retention times of the individual data points are slightly different
## between the samples:
head(getChromatogram(mss))
## We're next binning the values in retention time-bins of size 1 (1 second). By default
## (with FUN=max), the maximal signal is used for each bin.
chrM <- getChromatogram(mss, binSize=1)
dim(chrM)
head(chrM)
## We can also create an image from this matrix. Each column represents the chromatogram
## from one sample, each row one retention time bin with the intensity being color coded.
image(t(chrM))
## Next we plot the chromatogram of the slice across all samples.
## Without any binning:
plotChromatogram(mss, col="#00000080", type="l")
## And with binning.
plotChromatogram(mss, binSize=1, col="#00000080", type="l")
## Extracting the full MS data from the xcmsSet to create base peak chromatogram (BPC)
## and total ion chromatogram (TIC) plot of all samples.
msFull <- msSlice(xset)
## Base peak chromatogram with 1 second binning
plotChromatogram(msFull, binSize=1, col="#00000080", type="l")
## Total ion chromatogram with 1 second binning
plotChromatogram(msFull, FUN=sum, binSize=1, col="#00000080", type="l")
## Extending the M/Z range of the slice and extracting and plotting also the spectrum.
mzr <- c(300, 303)
mss <- msSlice(xset, rtrange=rtr, mzrange=mzr)
## Get the spectrum without binning:
head(getSpectrum(mss))
## We can also extract a slice from an xcmsRaw object, which will then
## contain the data only of that individual sample. Without specifying an
## mzrange and rtrange we extract the full data.
msSlice(getXcmsRaw(xset, 1))
par(mfrow=c(1, 2))
plotChromatogram(mss, binSize=1, col="#00000080", type="l")
plotSpectrum(mss, col="#00000040", type="h")
## Or from an MSdata object; extracting first a MSdata object containing
## the *full* MS data from a single file and creating then an MSslice object
## from that.
msd <- msData(getXcmsRaw(xset, 1))
msSlice(msd)
## Extracting the MSdata from the second sample and passing both to the
## MSslice constructor to generate a two-sample MSslice object.
msd2 <- msData(getXcmsRaw(xset, 2))
MSslice(list(msd, msd2))
####-------------
## Data manipulations
## We bin the MSslice object in 5 second retention time bins along the
## retention time dimension. Each MSdata object within the MSslice is
## binned in the same bins.
mssB <- binRtime(mss, binSize=5)
mss
mssB
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.