PeakML integration for XCMS

With the introduction of the PeakML file format, it has become possible to share data between software produced by different vendors and laboratories. To illustrate the point we provide a working example of integration of the commonly use XCMS and mzMatch. For this reason an R-library is provided, which extends the XCMS library with PeakML read and write functionality.

In this tutorial a working example is given on how to use the library.


Download and install R. R is an integrated suite of software facilities for data manipulation, calculation and graphical display. R can be obtain from CRAN servers. If you are unfamiliar with R syntax and commands, it is recommended to read an introduction to R document. The mzmatch.R depends on the following libraries, which need to be installed on your R-system:

This library defines the commonly used R-package for the analysis of LC/MS data and can be downloaded from the bioconductor website.

This is R-package contains an example dataset, which is used in this tutorial and can be downloaded from the bioconductor website.

This library establishes a link between the R-environment and Java libraries, which is used to call the functionality in the PeakML library. This package can be downloaded from the rJava homepage.

This library provides facilities for the R to parse and to generate XML content and documents. This package can be downloaded from the CRAN repository.

This library allows R jobs to be run in parallel. SNOW supports MPI, PVM and Sockets for parallel communication. This package can be downloaded from the CRAN repository.

This library contains several basic utility functions including: moving (rolling, running) window statistic functions, read/write for GIF and ENVI binary files, fast calculation of AUC, LogitBoost classifier, base64 encoder/decoder, round-off error free sum and cumsum, etc. This package can be downloaded from the CRAN repository.

This library contains several basic tunctions for Bitwise operations on integer vectors. This package can be downloaded from the CRAN repository.

This library contains Parametric Time Warping aligns patterns functions what are used for background correctio. This package can be downloaded from the CRAN repository.

These packages can be installed from the R commandline:

biocLite(c("faahKO", "xcms", "multtest"))

As a last step the mzmatch.R library needs to be installed.

source ("")
Before the package can be used, it needs to be loaded into the R-environment. This can be achieved with the following command (the second command for faahKO is only required for this tutorial):
require (mzmatch.R)
require (faahKO)
mzmatch.init ()

PeakML Viewer
A user interface application called PeakML Viewer enables quick visualisation, inspection and manipulation of the contents of a PeakML file (e.g. manual selection and/or export of peaks of interest). In this tutorial screen shots for the output of each data processing step are provided. The peakml viewer can be found in the files menu hidden in one of the folders and description of the tool can be found here. To install and run PeakMl Viewer you can use a following command within R:

require (mzmatch.R)
PeakML.Viewer ()

Extracting data from faahKO

The following code has been taken from the XCMS manual and extracts the peaks from the faahKO dataset, groups them and stores the result in the xset object:

cdfpath <- system.file("cdf", package = "faahKO")
cdffiles <- list.files(cdfpath, recursive = TRUE, full.names = TRUE)[c(3,4,7,8)]
xset <- xcmsSet(cdffiles)
xset <- group(xset)
xset <- retcor(xset, family = "symmetric", plottype = "mdevden")
xset <- group(xset, bw = 10)
xset <- fillPeaks(xset)
Reading and writing

The data stored in the xset object can now be written with the following function call:

PeakML.xcms.write(xset, "XCMS_out.peakml",ionisation="positive")
This file can now be read into the xset_new object with the following function call. The xset_new can now be used in the further XCMS toolchain.
xset_new <- ("XCMS_out.peakml",ionisation="positive")
Original data set structure is restored and object can be used to apply commands from the XCMS package. For example report generation:
xset_f <- fillPeaks (xset_new)
diffreport(xset_f, "WT", "KO", "example", 10, metlin = 0.15, h = 480, w = 640)
Plot extracted ion chromatograms:
gt <- groups(xset_f)
groupidx1 <- which(gt[, "rtmed"] > 2600 & gt[, "rtmed"] < 2700)[1]
eicraw <- getEIC(xset_f, groupidx = c(groupidx1), rt = "raw")
plot(eicraw, xset_f, groupidx = 1)

Viewing the results

The results stored in the PeakML file can now be read in the application PeakML Viewer, of which an example is shown below:

Design based on the SWT pages. Get mzmatch at Fast, secure and Free Open Source software downloads