BiocStyle::markdown()
library(BiocStyle)
This document describes how to use xcms
for processing of Tandem-MS and MS$^{n}$
data from e.g. triple-quad, QTOF, ion trap or orbitrap mass spectrometers. This
uses still the old user interface.
library(xcms) library(msdata) ## Disable parallel processing register(SerialParam())
The xcms
package reads full-scan LC/MS data and associated Tandem-MS and MS$^{n}$
spectra from mzData and mzXML files (CDF does not support MS$^{n}$).
For the purposes of demonstration, we will use a some sample files included in
the msdata
package. The (truncated) raw data files are contained in the data
directory. To access the mzData files, we first locate the data directory in
the msdata
package.
mzdatapath <- system.file("iontrap", package = "msdata") list.files(mzdatapath, recursive = TRUE)
The MS$^{n}$ spectra are read into xcms just like plain LC-MS files. Inclusion of the additional scans has to be explicitely enabled. The xcmsRaw summary shows the additional content:
library(xcms) mzdatafiles <- list.files(mzdatapath, pattern = "extracted.mzData", recursive = TRUE, full.names = TRUE) xraw <- xcmsRaw(mzdatafiles[1], includeMSn=TRUE) xraw
There is also a new peak picker, which actually returns all parent ions as
annotated in the mzData / mzXML files. A warning will be issued if this is not
present, either because of a poor converter or if xraw
is read from a CDF
file:
peaks <- findPeaks(xraw, method="MS1")
By giving larger windows, subsets of spectra can be returned, and these can be combined to obtain so called compound spectra containing e.g. MS$^{2}$ to MS$^{5}$.
A xcmsFragments-Object contains a Table with informations about all Peaks from
MS1 to MS$^{n}$ of one Experiment, including mz-value, retentiontime, MSlevel, and
parentpeak. The data can be used for visualization or (later) computing
alignments between different Experiments. The object is created as empty and can
be filled with collect()
. This method requires a peaktable or a xcmsSet for
the MS1peaks and the original xcmsRaw for the msn-Data.
xs <- xcmsSet(mzdatafiles, method = "MS1") xfrag <- xcmsFragments(xs) xfrag
plotTree prints out a simplyfied tree of the peaks in a xcmsFragments
. The
user can define borders for the retentionTime and for the MassRange, he can also
print the tree for a single MS1-Peak. PlotTree uses the package RgraphViz
and
plots the tree text-based if requested or if the package cannot be found.
Below we simply print the textual representation of the fragment tree.
plotTree(xfrag, xcmsFragmentPeakID = 6, textOnly = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.