BiocStyle::markdown()
library("knitr") opts_chunk$set(stop_on_error = 1L)
Data quality assessment is an integral part of preparatory data analysis to ensure sound biological information retrieval.
We present here the MsQualityUtils
package, which provides functionality to
create MsExperiment
objects from mzML and MetIDQ-derived files.
The MsExperiment
files can subsequently be used to calculate quality metrics
at the per-sample level using the
MsQuality
package.
MsQuality
relies on the mzQC
framework of quality metrics defined by the Human Proteome
Organization-Proteomics Standards Intitiative (HUPO-PSI).
The MsQuality
package is built upon the Spectra
and the MsExperiment
package.
Metrics will be calculated based on the information stored in a
Spectra
object, thus, the spectral data of each sample should be stored
in one Spectra
object. The MsExperiment
serves as a container to
store the mass spectral data of multiple samples. MsQuality
enables the user
to calculate quality metrics both on Spectra
and MsExperiment
objects.
The MsQualityUtils
package provides functionality to create MsExperiment
objects that store the (spectral) information of mzML or MetIDQ files.
In this vignette, we will
(i) create an MsExperiment
object from MetIDQ-derived mass spectrometry data
and (ii) create an MsExperiment
object from mzML mass spectrometry data.
To install MsQualityUtils
, you have first to install the
devtools package:
install.packages("devtools") library("devtools")
Install the MsQualityUtils
package then via
install_github("tnaake/MsQualityUtils")
This will install this package and all eventually missing dependencies.
MsQualityUtils
is currently under active development. If you discover any
bugs, typos or develop ideas of improving MsQuality
feel free to raise an
issue via GitHub
or send a mail to the developer.
Load the MsQualityUtils
package.
library("MsQualityUtils")
MsExperiment
from MetIDQ filesMetIDQ$^{\mathrm{TM}}$ xlsx files are created by the Biocrates
MetIDQ$^{\mathrm{TM}}$. They store information on metabolite concentration
in their cells. The MsQualityUtils
package provides functionality to
retrieve the information stored in the MetIDQ$^{\mathrm{TM}}$ xlsx files
and create Spectra
objects from this. Typically, some of the measured
metabolites are separated by liquid chromatography. We can pass a
SummarizedExperiment
object rt
to the function ` that stores
retention time values in the
assayslot. If there is no object
rtpassed
to the function, an internal
rt` object will be used and retention times
are taken therefrom.
First, we will create a list of Spectra
objects. The list has two entries:
The function will create Spectra
objects from all MetIDQ files that are
found in path
(createListOfSpectra
will combine all MetIDQ files found in
path
).
The example file loaded is ac9b02908_si_002
from the publication by
@Thompson2019. The xlsx file was only slightly modified to be able to
be loaded by the biocrates
function from the MatrixQCvis
package.
path <- system.file("metidq", package = "MsQualityUtils") sps_l <- createListOfSpectra(type = "MetIDQ", path = path, sheet = 1)
In a next step, we create a list of MsExperiment
objects from the list of
Spectra
objects. The first entry of the list contains the MsExperiment
object of features irrespective of their retention time. The second entry
contains the MsExperiment
object of features that are separated by a
chromatographic method, these features have information on retention
time values.
msexp_metidq_l <- createListOfMsExperimentFromListOfSpectra(sps_l = sps_l)
MsExperiment
from mzML filesHere, we load the example
files from the sciex
data set of the msdata
package and create a list
of one Spectra
object from the two provided mzML
files. The function
will create a Spectra
object containing all mzML
files that are
found in the specified path
.
path <- system.file("sciex", package = "msdata") sps_l <- createListOfSpectra(type = "mzML", path = path)
In a next step, we calculate a list of one MsExperiment
object from the
list of Spectra
objects:
msexp_mzml_l <- createListOfMsExperimentFromListOfSpectra(sps_l = sps_l)
MsExperiment
objects using MsQuality
The objects from the MsQualityUtils
functions can directly be used
by the MsQuality
package.
The function calculateMetrics
will iterate over the samples (referring
to rows in sampleData(msexp))
) and calculate the quality metrics on the
corresponding Spectra
objects.
library("MsQuality") msexp_mzml <- msexp_mzml_l[[1]] metrics_msexp <- calculateMetrics(object = msexp_mzml, metrics = qualityMetrics(msexp_mzml), relativeTo = "Q1", msLevel = 1L) metrics_msexp
When passing an MsExperiment
object to calculateMetrics
a data.frame
object is returned with the samples (derived from the rownames of
sampleData(msexp)
) in the rows and the metrics in columns.
We will show here the objects metrics_rplc_msexp
and metrics_hilic_msexp
print("metrics_msexp") rmarkdown::paged_table(as.data.frame(metrics_msexp))
All software and respective versions to build this vignette are listed here:
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.