Title: | MsQuality - Quality metric calculation from Spectra and MsExperiment objects |
---|---|
Description: | The MsQuality provides functionality to calculate quality metrics for mass spectrometry-derived, spectral data at the per-sample level. MsQuality relies on the mzQC framework of quality metrics defined by the Human Proteom Organization-Proteomics Standards Initiative (HUPO-PSI). These metrics quantify the quality of spectral raw files using a controlled vocabulary. The package is especially addressed towards users that acquire mass spectrometry data on a large scale (e.g. data sets from clinical settings consisting of several thousands of samples). The MsQuality package allows to calculate low-level quality metrics that require minimum information on mass spectrometry data: retention time, m/z values, and associated intensities. MsQuality relies on the Spectra package, or alternatively the MsExperiment package, and its infrastructure to store spectral data. |
Authors: | Thomas Naake [aut, cre] , Johannes Rainer [aut] |
Maintainer: | Thomas Naake <[email protected]> |
License: | GPL-3 |
Version: | 1.7.0 |
Built: | 2024-10-30 08:26:37 UTC |
Source: | https://github.com/bioc/MsQuality |
MsQuality enables to calculate quality metrics of mass spectrometry data. It is build upon Spectra and MsExperiment objects.
The DESCRIPTION file:
Package: | MsQuality |
Type: | Package |
Title: | MsQuality - Quality metric calculation from Spectra and MsExperiment objects |
Version: | 1.7.0 |
Date: | 2024-02-21 |
Authors@R: | c(person(given = "Thomas", family = "Naake", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7917-5580")), person(given = "Johannes", family = "Rainer", email = "[email protected]", role = "aut", comment = c(ORCID = "0000-0002-6977-7147"))) |
VignetteBuilder: | knitr |
Description: | The MsQuality provides functionality to calculate quality metrics for mass spectrometry-derived, spectral data at the per-sample level. MsQuality relies on the mzQC framework of quality metrics defined by the Human Proteom Organization-Proteomics Standards Initiative (HUPO-PSI). These metrics quantify the quality of spectral raw files using a controlled vocabulary. The package is especially addressed towards users that acquire mass spectrometry data on a large scale (e.g. data sets from clinical settings consisting of several thousands of samples). The MsQuality package allows to calculate low-level quality metrics that require minimum information on mass spectrometry data: retention time, m/z values, and associated intensities. MsQuality relies on the Spectra package, or alternatively the MsExperiment package, and its infrastructure to store spectral data. |
Depends: | R (>= 4.2.0) |
Imports: | BiocParallel (>= 1.32.0), ggplot2 (>= 3.3.5), htmlwidgets (>= 1.5.3), methods (>= 4.2.0), msdata (>= 0.32.0), MsExperiment (>= 0.99.0), plotly (>= 4.9.4.1), ProtGenerics (>= 1.24.0), rlang (>= 1.1.1), rmzqc (>= 0.5.0), shiny (>= 1.6.0), shinydashboard (>= 0.7.1), Spectra (>= 1.13.2), stats (>= 4.2.0), stringr (>= 1.4.0), tibble (>= 3.1.4), tidyr (>= 1.1.3), utils (>= 4.2.0) |
Suggests: | BiocGenerics (>= 0.24.0), BiocStyle (>= 2.6.1), dplyr (>= 1.0.5), knitr (>= 1.11), mzR (>= 2.32.0), rmarkdown (>= 2.7), S4Vectors (>= 0.29.17), testthat (>= 2.2.1) |
biocViews: | Metabolomics, Proteomics, MassSpectrometry, QualityControl |
URL: | https://www.github.com/tnaake/MsQuality/ |
BugReport: | https://www.github.com/tnaake/MsQuality/issues/ |
License: | GPL-3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Repository: | https://bioc.r-universe.dev |
RemoteUrl: | https://github.com/bioc/MsQuality |
RemoteRef: | HEAD |
RemoteSha: | c5505d13decce9046326f5a8e982f13941cda267 |
Author: | Thomas Naake [aut, cre] (<https://orcid.org/0000-0001-7917-5580>), Johannes Rainer [aut] (<https://orcid.org/0000-0002-6977-7147>) |
Maintainer: | Thomas Naake <[email protected]> |
Index of help topics:
.rtOrderSpectra Order Spectra according to increasing retention time Lee_2019 Example data for 'MsQuality': data set of Lee et al. (2019) Lee_2019_meta_vals Example data for 'MsQuality': data set of Lee et al. (2019) MsQuality-package MsQuality - Quality metric calculation from Spectra and MsExperiment objects areaUnderTic area under TIC (MS:4000155) areaUnderTicRtQuantiles area under TIC RT quantiles (MS:4000156) calculateMetrics Calculate QC metrics from a Spectra or MsExperiment object calculateMetricsFromMsExperiment Calculate QC metrics from a MsExperiment object calculateMetricsFromOneSampleSpectra Calculate QC metrics from a Spectra object containing only spectral data from one sample calculateMetricsFromSpectra Calculate QC metrics from a Spectra object chromatographyDuration chromatography duration (MS:4000053) extentIdentifiedPrecursorIntensity extent of identified MS2 precursor intensity (MS:4000157) meanCharge mean MS2 precursor charge in all spectra (MS:4000173) or mean MS2 precursor charge in identified spectra (MS:4000174) medianCharge median MS2 precursor charge in all spectra (MS:4000175) or median MS2 precursor charge in identified spectra (MS:4000176) medianPrecursorMz MS2 precursor median m/z of identified quantification data points (MS:4000152) medianTicOfRtRange median of TIC values in the shortest RT range in which half of the quantification data points are identified (MS:4000159) medianTicRtIqr median of TIC values in the RT range in which the middle half of quantification data points are identified (MS:4000158) msSignal10xChange MS1 signal jump (10x) count (MS:4000097) or MS1 signal fall (10x) count (MS:4000098) mzAcquisitionRange m/z acquisition range (MS:4000069) numberEmptyScans number of empty MS1 scans (MS:4000099), number of empty MS2 scans (MS:4000100), or number of empty MS3 scans (MS:4000101) numberSpectra number of MS1 spectra (MS:4000059) or number of MS2 spectra (MS:4000060) plotMetric Visualize a quality metric plotMetricTibble Helper function for plotMetric precursorIntensityMean MS2 precursor intensity distribution mean (MS:4000117), identified MS2 precursor intensity distribution mean (MS:4000163), or unidentified MS2 precursor intensity distribution mean (MS:4000164) precursorIntensityQuartiles MS2 precursor intensity distribution (MS:4000116), identified MS2 precursor intensity distribution (MS:4000161), or unidentified MS2 precursor intensity distribution (MS:4000162) precursorIntensityRange MS2 precursor intensity range (MS:4000160) precursorIntensitySd MS2 precursor intensity distribution sigma (MS:4000118), identified MS2 precursor intensity distribution sigma (MS:4000165), or unidentified MS2 precursor intensity distribution sigma (MS:4000166) qualityMetrics Get a vector of quality metrics than can be applied to 'object' ratioCharge1over2 ratio of 1+ over 2+ of all MS2 known precursor charges (MS:4000167) or ratio of 1+ over 2+ of identified MS2 known precursor charges (MS:4000168) ratioCharge3over2 ratio of 3+ over 2+ of all MS2 known precursor charges (MS:4000169) or ratio of 3+ over 2+ of identified MS2 known precursor charges (MS:4000170) ratioCharge4over2 ratio of 4+ over 2+ of all MS2 known precursor charges (MS:4000171) or ratio of 4+ over 2+ of identified MS2 known precursor charges (MS:4000172) rtAcquisitionRange retention time acquisition range (MS:4000070) rtIqr interquartile RT period for identified quantification data points (MS:4000153) rtIqrRate rate of the interquartile RT period for identified quantification data points (MS:4000154) rtOverMsQuarters MS1 quarter RT fraction (MS:4000055) or MS2 quarter RT fraction (MS:4000056) shinyMsQuality Shiny application to visualize quality metrics ticQuartersRtFraction TIC quarters RT fraction (MS:4000054) ticQuartileToQuartileLogRatio MS1 TIC-change quartile ratios (MS:4000057) or MS1 TIC quartile ratios (MS:4000058) transformIntoMzQC Transform the metrics into a list of 'MzQCmzQC' objects
Thomas Naake [aut, cre] (<https://orcid.org/0000-0001-7917-5580>), Johannes Rainer [aut] (<https://orcid.org/0000-0002-6977-7147>) Maintainer: Thomas Naake <[email protected]>
## Not run: calculateMetrics(object = spectra) ## Not run: calculateMetrics(object = mse)
## Not run: calculateMetrics(object = spectra) ## Not run: calculateMetrics(object = mse)
The function .rtOrderSpectra
orders the features in a Spectra
object
according to the (increasing) retention time values.
.rtOrderSpectra(spectra)
.rtOrderSpectra(spectra)
spectra |
|
Internal function in quality metric functions.
Spectra
object with the features ordered according to the
(increasing) retention time
Johannes Rainer
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0001847", "HMDB0000001", "HMDB0000001"), name = c("Caffeine", "1-Methylhistidine", "1-Methylhistidine")) ## Assign m/z and intensity values spd$mz <- list( c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876), c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16)) spd$intensity <- list( c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994), c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643)) spd$rtime <- c(15.84, 9.44, 9.44) sps <- Spectra(spd) MsQuality:::.rtOrderSpectra(sps)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0001847", "HMDB0000001", "HMDB0000001"), name = c("Caffeine", "1-Methylhistidine", "1-Methylhistidine")) ## Assign m/z and intensity values spd$mz <- list( c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876), c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16)) spd$intensity <- list( c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994), c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643)) spd$rtime <- c(15.84, 9.44, 9.44) sps <- Spectra(spd) MsQuality:::.rtOrderSpectra(sps)
MS:4000155
"The area under the total ion chromatogram." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the sum of the ion counts are obtained and returned.
areaUnderTic(spectra, msLevel = 1L, ...)
areaUnderTic(spectra, msLevel = 1L, ...)
spectra |
|
msLevel |
|
... |
not used here |
MS:4000155
is_a: MS:4000003 ! single value
is_a: MS:4000009 ! ID free
is_a: MS:4000017 ! chromatogram metric
The sum of the TIC is returned as an equivalent to the area.
numeric(1)
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) areaUnderTic(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) areaUnderTic(spectra = sps, msLevel = 2L)
MS:4000156
"The area under the total ion chromatogram of the retention time quantiles.
Number of quantiles are given by the n-tuple." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the Spectra
object is ordered according to the retention time,
(3) the 0%, 25%, 50%, 75%, and 100% quantiles of the retention time
values are obtained,
(4) the ion count of the intervals between the 0%/25%, 25%/50%,
50%/75%, and 75%/100% are obtained,
(5) the ion counts of the intervals are summed (TIC) and the values returned.
areaUnderTicRtQuantiles(spectra, msLevel = 1L, ...)
areaUnderTicRtQuantiles(spectra, msLevel = 1L, ...)
spectra |
|
msLevel |
|
... |
not used here |
MS:4000156
is_a: MS:4000004 ! n-tuple
is_a: MS:4000009 ! ID free
is_a: MS:4000017 ! chromatogram metric
The sum of the TIC is returned as an equivalent to the area.
.numeric(4)
This function interprets the *quantiles* from the [PSI:MS] definition as *quartiles*, i.e. the 0, 25, 50, 75 and 100% quantiles are used.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) areaUnderTicRtQuantiles(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) areaUnderTicRtQuantiles(spectra = sps, msLevel = 2L)
Calculate QC metrics from a Spectra
or MsExperiment
object.
calculateMetrics
is a wrapper for the functions
calculateMetricsFromSpectra
and
calculateMetricsFromMsExperiment
.
calculateMetrics( object, metrics = qualityMetrics(object), filterEmptySpectra = FALSE, ... )
calculateMetrics( object, metrics = qualityMetrics(object), filterEmptySpectra = FALSE, ... )
object |
|
metrics |
|
filterEmptySpectra |
|
... |
arguments passed to the quality metrics functions defined in
|
The metrics are defined by the argument metrics
. Further arguments
passed to the quality metric functions can be specified by the params
argument. params
can contain named entries which are matched against
the formal arguments of the quality metric functions.
Setting the argument filterEmptySpectra
to TRUE
will remove
zero-length entries, zero-intensity entries, and entries with
intensities that are Inf
from the Spectra
object.
data.frame
containing in the columns the metrics for the
different spectra and in rows the samples
Thomas Naake
library(msdata) library(Spectra) fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) spectra <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (MsLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) passed to ... calculateMetrics(object = spectra, metrics = metrics, msLevel = 1, change = "jump", relativeTo = "Q1") calculateMetrics(object = spectra, metrics = metrics, msLevel = 1, change = "fall", relativeTo = "previous")
library(msdata) library(Spectra) fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) spectra <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (MsLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) passed to ... calculateMetrics(object = spectra, metrics = metrics, msLevel = 1, change = "jump", relativeTo = "Q1") calculateMetrics(object = spectra, metrics = metrics, msLevel = 1, change = "fall", relativeTo = "previous")
The function calculateMetricsFromMsExperiment
calculates quality
metrics from a MsExperiment
object. Each spectra in the
msexp
object should refer to one mzML file/to one sample.
calculateMetricsFromMsExperiment( msexp, metrics = qualityMetrics(msexp), filterEmptySpectra = FALSE, ..., BPPARAM = bpparam() )
calculateMetricsFromMsExperiment( msexp, metrics = qualityMetrics(msexp), filterEmptySpectra = FALSE, ..., BPPARAM = bpparam() )
msexp |
|
metrics |
|
filterEmptySpectra |
|
... |
arguments passed to the quality metrics functions defined in
|
BPPARAM |
Parallel processing setup. Defaults to |
The metrics are defined by the argument metrics
. Further arguments
passed to the quality metric functions can be specified by the params
argument. params
can contain named entries which are matched against
the formal arguments of the quality metric functions.
Setting the argument filterEmptySpectra
to TRUE
will remove
zero-length entries, zero-intensity entries, and entries with
intensities that are Inf
from the Spectra
object.
data.frame
containing in the columns the metrics for the
different spectra (in rows)
Thomas Naake
library(msdata) library(MsExperiment) library(S4Vectors) msexp <- MsExperiment() sd <- DataFrame(sample_id = c("QC1", "QC2"), sample_name = c("QC Pool", "QC Pool"), injection_idx = c(1, 3)) sampleData(msexp) <- sd ## define file names containing spectra data for the samples and ## add them, along with other arbitrary files to the experiment fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) experimentFiles(msexp) <- MsExperimentFiles( mzML_files = fls, annotations = "internal_standards.txt") ## link samples to data files: first sample to first file in "mzML_files", ## second sample to second file in "mzML_files" msexp <- linkSampleData(msexp, with = "experimentFiles.mzML_files", sampleIndex = c(1, 2), withIndex = c(1, 2)) msexp <- linkSampleData(msexp, with = "experimentFiles.annotations", sampleIndex = c(1, 2), withIndex = c(1, 1)) library(Spectra) ## import the data and add it to the mse object spectra(msexp) <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## additional parameters passed to the quality metrics functions ## (msLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) passed to ... calculateMetricsFromMsExperiment(msexp = msexp, metrics = metrics, msLevel = 1, change = "jump", relativeTo = "Q1") calculateMetricsFromMsExperiment(msexp = msexp, metrics = metrics, msLevel = 1, change = "fall", relativeTo = "previous")
library(msdata) library(MsExperiment) library(S4Vectors) msexp <- MsExperiment() sd <- DataFrame(sample_id = c("QC1", "QC2"), sample_name = c("QC Pool", "QC Pool"), injection_idx = c(1, 3)) sampleData(msexp) <- sd ## define file names containing spectra data for the samples and ## add them, along with other arbitrary files to the experiment fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) experimentFiles(msexp) <- MsExperimentFiles( mzML_files = fls, annotations = "internal_standards.txt") ## link samples to data files: first sample to first file in "mzML_files", ## second sample to second file in "mzML_files" msexp <- linkSampleData(msexp, with = "experimentFiles.mzML_files", sampleIndex = c(1, 2), withIndex = c(1, 2)) msexp <- linkSampleData(msexp, with = "experimentFiles.annotations", sampleIndex = c(1, 2), withIndex = c(1, 1)) library(Spectra) ## import the data and add it to the mse object spectra(msexp) <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## additional parameters passed to the quality metrics functions ## (msLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) passed to ... calculateMetricsFromMsExperiment(msexp = msexp, metrics = metrics, msLevel = 1, change = "jump", relativeTo = "Q1") calculateMetricsFromMsExperiment(msexp = msexp, metrics = metrics, msLevel = 1, change = "fall", relativeTo = "previous")
The function calculateMetricsFromOneSampleSpectra
calculates quality
metrics from a Spectra
containing spectral data from one sample.
calculateMetricsFromOneSampleSpectra( spectra, metrics = qualityMetrics(spectra), filterEmptySpectra = FALSE, f = spectra$dataOrigin, ... )
calculateMetricsFromOneSampleSpectra( spectra, metrics = qualityMetrics(spectra), filterEmptySpectra = FALSE, f = spectra$dataOrigin, ... )
spectra |
|
metrics |
|
filterEmptySpectra |
|
f |
|
... |
arguments passed to the quality metrics functions defined in
|
The metrics are defined by the argument metrics
. Further arguments
passed to the quality metric functions can be specified by the params
argument. params
can contain named entries which are matched against
the formal arguments of the quality metric functions.
The Spectra
object will only contain spectral data from one
data origin (e.g. spectra$dataOrigin
is of length 1). The grouping
is specified by the argument f
.
Setting the argument filterEmptySpectra
to TRUE
will remove
zero-length entries, zero-intensity entries, and entries with
intensities that are Inf
from the Spectra
object.
named numeric
vector
Thomas Naake
library(msdata) library(Spectra) fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE)[1] spectra <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (MsLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) passed to ... MsQuality:::calculateMetricsFromOneSampleSpectra(spectra = spectra, metrics = metrics, msLevel = 1, change = "jump", relativeTo = "Q1") MsQuality:::calculateMetricsFromOneSampleSpectra(spectra = spectra, metrics = metrics, msLevel = 1, change = "fall", relativeTo = "previous")
library(msdata) library(Spectra) fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE)[1] spectra <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (MsLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) passed to ... MsQuality:::calculateMetricsFromOneSampleSpectra(spectra = spectra, metrics = metrics, msLevel = 1, change = "jump", relativeTo = "Q1") MsQuality:::calculateMetricsFromOneSampleSpectra(spectra = spectra, metrics = metrics, msLevel = 1, change = "fall", relativeTo = "previous")
The function calculateMetricsFromSpectra
calculates quality metrics
from a Spectra
object. The function will calculate the
metrics per sample according to the grouping parameter f
,
e.g. dataOrigin
information.
Two format options are available:
- format = "data.frame"
returns the metrics as a data.frame
,
- format = "mzQC"
returns the metrics as a list of MzQCmzQC
objects.
calculateMetricsFromSpectra( spectra, metrics, filterEmptySpectra = FALSE, f = dataOrigin(spectra), format = c("data.frame", "mzQC"), ..., BPPARAM = bpparam() )
calculateMetricsFromSpectra( spectra, metrics, filterEmptySpectra = FALSE, f = dataOrigin(spectra), format = c("data.frame", "mzQC"), ..., BPPARAM = bpparam() )
spectra |
|
metrics |
|
filterEmptySpectra |
|
f |
|
format |
|
... |
arguments passed to the quality metrics functions defined in
|
BPPARAM |
Parallel processing setup. Defaults to |
The metrics are defined by the argument metrics
. Further arguments
passed to the quality metric functions can be specified by ...
.
The additional arguments ...
are matched against
the formal arguments of the quality metric functions.
Samples will be processed in parallel
using the default parallel processing setup ([bpparam()]) or with the
parallel processing setup defined with parameter BPPARAM
.
Setting the argument filterEmptySpectra
to TRUE
will remove
zero-length entries, zero-intensity entries, and entries with
intensities that are Inf
from the Spectra
object.
In case of format = "data.frame"
, a data.frame
containing in
the columns the metrics for the different spectra of identical
dataOrigin{spectra}
(in rows).
In case of format = "mzQC"
, a list
of MzQCmzQC
objects
containing the metrics for the different spectra of identical
dataOrigin{spectra}
Thomas Naake, Johannes Rainer
library(msdata) library(Spectra) ## define file names containing spectra data for the samples fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) ## import the data and add it to the spectra object spectra <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (msLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) passed to ... ## format = "data.frame" calculateMetricsFromSpectra(spectra = spectra, metrics = metrics, format = "data.frame", msLevel = 1, change = "jump", relativeTo = "Q1") calculateMetricsFromSpectra(spectra = spectra, metrics = metrics, format = "data.frame", msLevel = 1, change = "fall", relativeTo = "previous") ## format = "mzQC" ##calculateMetricsFromSpectra(spectra = spectra, metrics = metrics, ## format = "mzQC", msLevel = 1, change = "jump", relativeTo = "Q1") ##calculateMetricsFromSpectra(spectra = spectra, metrics = metrics, ## format = "mzQC", msLevel = 1, change = "fall", relativeTo = "previous")
library(msdata) library(Spectra) ## define file names containing spectra data for the samples fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) ## import the data and add it to the spectra object spectra <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (msLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) passed to ... ## format = "data.frame" calculateMetricsFromSpectra(spectra = spectra, metrics = metrics, format = "data.frame", msLevel = 1, change = "jump", relativeTo = "Q1") calculateMetricsFromSpectra(spectra = spectra, metrics = metrics, format = "data.frame", msLevel = 1, change = "fall", relativeTo = "previous") ## format = "mzQC" ##calculateMetricsFromSpectra(spectra = spectra, metrics = metrics, ## format = "mzQC", msLevel = 1, change = "jump", relativeTo = "Q1") ##calculateMetricsFromSpectra(spectra = spectra, metrics = metrics, ## format = "mzQC", msLevel = 1, change = "fall", relativeTo = "previous")
MS:4000053
"The retention time duration of the chromatography in seconds." [PSI:MS]
The metric is calculated as follows:
(1) the retention time associated to the Spectra
object is obtained,
(2) the maximum and the minimum of the retention time is obtained,
(3) the difference between the maximum and the minimum is calculated and
returned.
chromatographyDuration(spectra, ...)
chromatographyDuration(spectra, ...)
spectra |
|
... |
not used here |
MS:4000053
synonym: "RT-Duration" RELATED [PMID:24494671]
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000016 ! retention time metric
relationship: has_value_type xsd:float ! The allowed value-type for this CV term
relationship: has_value_concept NCIT:C25330 ! Duration
relationship: has_units UO:0000010 ! second
Retention time values that are NA
are removed.
numeric(1)
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) chromatographyDuration(spectra = sps)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) chromatographyDuration(spectra = sps)
MS:4000157
"Ratio of 95th over 5th percentile of MS2 precursor intensity for all
quantification data points after user-defined acceptance criteria are
applied. Can be used to approximate the dynamic range of signal. The used
type of identification should be noted in the metadata or analysis methods
section of the recording file for the respective run. In case of multiple
acceptance criteria (FDR) available in proteomics, PSM-level FDR should
be used for better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the intensities of the precursor ions are obtained,
(3) the 5% and 95% quantile of these intensities are obtained
(NA
values are removed),
(4) the ratio between the 95% and the 5% intensity quantile is calculated
and returned.
extentIdentifiedPrecursorIntensity( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
extentIdentifiedPrecursorIntensity( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000157
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "MS1-3A" RELATED [PMID:19837981]
Precursor intensity values that are NA
are removed.
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is "identified"
.
numeric(1)
The Spectra
object might contain features that were not identified. If
the calculation needs to be done according to *MS:4000157*, the
Spectra
object should be prepared accordingly, i.e. being subsetted to
spectra with identification data.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorIntensity <- c(100, 100, 100) sps <- Spectra(spd) extentIdentifiedPrecursorIntensity(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorIntensity <- c(100, 100, 100) sps <- Spectra(spd) extentIdentifiedPrecursorIntensity(spectra = sps, msLevel = 2L)
MsQuality
: data set of Lee et al. (2019)The data set of Lee et al. (2019) contains metabolite information measured by reverse phase liquid chromatography (RPLC) coupled to mass spectrometry and hydrophilic interaction liquid chromatography (HILIC) coupled to mass spectrometry (file 'STables - rev1.xlsx' in the Supplementary Information).
It will be used as an example data set in the vignette to
show the functionality of the packages. The file contains Spectra
and
MsExperiment
objects that store the mass spectrometry data.
Spectra
and MsExperiment
Spectra
and MsExperiment
objects
Thomas Naake, [email protected]
See the file Lee2019-data-source.R
in scripts
for the
source code how sps_hilic
and sps_rplc
were created.
Lee et al. (2019). A large-scale analysis of targeted metabolomics data from heterogeneous biological samples provides insights into metabolite dynamics. Metabolomics, 103, doi: 10.1007/s11306-019-1564-8.
MsQuality
: data set of Lee et al. (2019)The data set of Lee et al. (2019) contains metabolite information measured by reverse phase liquid chromatography (RPLC) coupled to mass spectrometry and hydrophilic interaction liquid chromatography (HILIC) coupled to mass spectrometry (file 'STables - rev1.xlsx' in the Supplementary Information). The xlsx sheets 'Methods' and 'Raw data' were stored as txt files.
Lee_2019_meta_vals
contains two data frame objects:
one containing information on metabolite meta-data and one containing
intensity values on metabolites.
The object will be used as an example data set in the vignette to
show the functionality of the packages.
data.frame
data.frame
Thomas Naake, [email protected]
path_to_meta <- "Lee_et_al_2019_Stables_rev1_Methods.txt" meta <- read.delim(path_to_meta, dec = ".", header = TRUE)
## print number of metabolites per measurement (meta data) table(meta$Method)
path_to_vals <- "Lee_et_al_2019_Stables_rev1_Raw_data.txt" vals <- read.delim(path_to_vals, dec = ".", header = TRUE)
## print number of metabolites per measurement (intensity data) table(grepl(vals$Metabolite, pattern = "_rp$")) table(grepl(vals$Metabolite, pattern = "_hn$"))
## save the two objects as an RData object save(meta, vals, file = "Lee_2019_meta_vals.RData", compress = "xz")
Lee et al. (2019). A large-scale analysis of targeted metabolomics data from heterogeneous biological samples provides insights into metabolite dynamics. Metabolomics, 103, doi: 10.1007/s11306-019-1564-8.
MS:4000173
"Mean MS2 precursor charge in all spectra" [PSI:MS]
MS:4000174
"Mean MS2 precursor charge in identified spectra. The used type of
identification should be noted in the metadata or analysis methods section
of the recording file for the respective run. In case of multiple acceptance
criteria (FDR) available in proteomics, PSM-level FDR should be used for
better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the precursor charge is obtained,
(3) the mean of the precursor charge values is calculated and returned.
meanCharge( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
meanCharge( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000173
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "MS2 known precursor charges fractions" RELATED []
synonym: "MS2-PrecZ-1" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-2" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-3" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-4" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-5" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-more" RELATED [PMID:24494671]
MS:4000174
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "MS2 known precursor charges fractions" RELATED []
synonym: "MS2-PrecZ-1" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-2" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-3" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-4" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-5" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-more" RELATED [PMID:24494671]
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is either "all"
or "identified"
.
numeric(1)
The Spectra
object might contain features that were not identified. If
the calculation needs to be done according to *MS:4000174*, the
Spectra
object should be prepared accordingly.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorCharge <- c(1L, 1L, 1L) sps <- Spectra(spd) meanCharge(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorCharge <- c(1L, 1L, 1L) sps <- Spectra(spd) meanCharge(spectra = sps, msLevel = 2L)
MS:4000175
"Median MS2 precursor charge in all spectra" [PSI:MS]
MS:4000176
"Median MS2 precursor charge in identified spectra. The used type of
identification should be noted in the metadata or analysis methods section
of the recording file for the respective run. In case of multiple acceptance
criteria (FDR) available in proteomics, PSM-level FDR should be used for
better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the precursor charge is obtained,
(3) the median of the precursor charge values is calculated and returned.
medianCharge( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
medianCharge( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000175
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "MS2 known precursor charges fractions" RELATED []
synonym: "MS2-PrecZ-1" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-2" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-3" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-4" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-5" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-more" RELATED [PMID:24494671]
MS:4000176
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "MS2 known precursor charges fractions" RELATED []
synonym: "MS2-PrecZ-1" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-2" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-3" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-4" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-5" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-more" RELATED [PMID:24494671]
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is either "all"
or "identified"
.
numeric(1)
The Spectra
object might contain features that were not identified. If
the calculation needs to be done according to *MS:4000176*, the
Spectra
object should be prepared accordingly.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) spd$precursorCharge <- c(1L, 1L, 1L) medianCharge(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) spd$precursorCharge <- c(1L, 1L, 1L) medianCharge(spectra = sps, msLevel = 2L)
MS:4000152
"Median m/z value for MS2 precursors of all quantification data points after
user-defined acceptance criteria are applied. These data points may be for
example XIC profiles, isotopic pattern areas, or reporter ions
(see MS:1001805). The used type should be noted in the metadata or
analysis methods section of the recording file for the respective run. In
case of multiple acceptance criteria (FDR) available in proteomics, PSM-level
FDR should be used for better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the precursor m/z values are obtained,
(3) the median value is returned (NA
s are removed).
medianPrecursorMz( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
medianPrecursorMz( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000152
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
is_a: MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_units MS:1000040 ! m/z
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is "identified"
and msLevel
is 1.
numeric(1)
medianPrecursorMz
will calculate the *precursor* median m/z of all
Spectra within spectra
. If the calculation needs be done according to
*MS:4000152*, the Spectra
object should be prepared accordingly, i.e.
filtered with e.g. [filterPrecursorMz()] or subsetted to spectra with
identification data.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorMz <- c(170.16, 170.16, 195.0876) sps <- Spectra(spd) medianPrecursorMz(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorMz <- c(170.16, 170.16, 195.0876) sps <- Spectra(spd) medianPrecursorMz(spectra = sps, msLevel = 2L)
MS:4000159
"Median of TIC values in the shortest RT range in which half of the
quantification data points are identified. These data points may be for
example XIC profiles, isotopic pattern areas, or reporter ions
(see MS:1001805). The used type should be noted in the metadata or analysis
methods section of the recording file for the respective run. In case of
multiple acceptance criteria (FDR) available in proteomics, PSM-level FDR
should be used for better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the Spectra
object is ordered according to the retention time,
(3) the number of features in the Spectra
object is obtained and
the number for half of the features is calculated,
(4) iterate through the features (always by taking the neighbouring
half of features) and calculate the retention time range of the
set of features,
(5) retrieve the set of features with the minimum retention time
range,
(6) calculate from the set of (5) the median TIC (NA
values are removed)
and return it.
medianTicOfRtRange( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
medianTicOfRtRange( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000159
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
synonym: "MS1-2B" RELATED [PMID:19837981]
The function medianTicOfRtRange
uses the function ionCount
as an
equivalent to the TIC.
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is "identified"
.
numeric(1)
The Spectra
object might contain features that were not identified. If
the calculation needs to be done according to *MS:4000159*, the
Spectra
object should be prepared accordingly, i.e. being subsetted to
spectra with identification data.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) medianTicOfRtRange(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) medianTicOfRtRange(spectra = sps, msLevel = 2L)
MS:4000158
"Median of TIC values in the RT range in which half of quantification data
points are identified (RT values of Q1 to Q3 of identifications). These
data points may be for example XIC profiles, isotopic pattern areas, or
reporter ions (see MS:1001805). The used type should be noted in the metadata
or analysis methods section of the recording file for the respective run.
In case of multiple acceptance criteria (FDR) available in proteomics,
PSM-level FDR should be used for better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the Spectra
object is ordered according to the retention time,
(3) the features between the 1st and 3rd quartile are obtained
(half of the features that are present in the Spectra
object),
(4) the ion count of the features within the 1st and 3rd quartile is
obtained,
(5) the median value of the ion count is calculated (NA
values are
removed) and the median value is returned.
medianTicRtIqr( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
medianTicRtIqr( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000158
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
The function medianTicRtIqr
uses the function [ionCount()] as an
equivalent to the TIC.
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is "identified"
.
numeric(1)
The Spectra
object might contain features that were not identified. If
the calculation needs to be done according to *MS:4000158*, the
Spectra
object should be prepared accordingly, i.e. being subsetted to
spectra with identification data.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) medianTicRtIqr(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) medianTicRtIqr(spectra = sps, msLevel = 2L)
MS:4000097
"The number of times where MS1 TIC increased more than 10-fold between
adjacent MS1 scans. An unusual high count of signal jumps or falls can
indicate ESI stability issues." [PSI:MS]
MS:4000098
"The number of times where MS1 TIC decreased more than 10-fold between
adjacent MS1 scans. An unusual high count of signal jumps or falls can
indicate ESI stability issues." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the intensity of the precursor ions within the Spectra
object are
obtained,
(3) the intensity values of the features are obtained via the ion count,
(4) the signal jumps/declines of the intensity values with the two
subsequent intensity values is calculated,
(5) in the case of *MS:4000097*, the signal jumps by a factor of ten or more
are counted and returned;
in the case of *MS:4000098*, the signal declines by a factor of ten or more
are counted and returned.
msSignal10xChange(spectra, change = "jump", msLevel = 1L, ...)
msSignal10xChange(spectra, change = "jump", msLevel = 1L, ...)
spectra |
|
change |
|
msLevel |
|
... |
not used here |
MS:4000097
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000021 ! MS1 metric
relationship: has_units UO:0000189 ! count unit
relationship: has_value_type xsd:integer ! The allowed value-type for this CV
term
synonym: "IS-1A" RELATED []
MS:4000098
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000021 ! MS1 metric
relationship: has_units UO:0000189 ! count unit
relationship: has_value_type xsd:integer ! The allowed value-type for this CV
term
synonym: "IS-1B" RELATED []
The function msSignal10xChange
uses the function ionCount
as an
equivalent to the TIC.
An attribute containing the PSI:MS term will only be returned if
msLevel
is 1.
numeric(1)
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) msSignal10xChange(spectra = sps, change = "jump", msLevel = 2L) msSignal10xChange(spectra = sps, change = "fall", msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) msSignal10xChange(spectra = sps, change = "jump", msLevel = 2L) msSignal10xChange(spectra = sps, change = "fall", msLevel = 2L)
MS:4000069
"Upper and lower limit of m/z precursor values at which MSn spectra are
recorded." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the precursor m/z values of the peaks within the Spectra
object are obtained,
(3) the minimum and maximum precursor m/z values are obtained and returned.
mzAcquisitionRange(spectra, msLevel = 2L, ...)
mzAcquisitionRange(spectra, msLevel = 2L, ...)
spectra |
|
msLevel |
|
... |
not used here |
MS:4000069
is_a: MS:4000004 ! n-tuple
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000019 ! MS metric
relationship: has_units MS:1000040 ! m/z
relationship: has_value_concept STATO:0000035 ! range
numeric(2)
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine"), precursorMz = c(170.16, 170.16, 195.08)) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) mzAcquisitionRange(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine"), precursorMz = c(170.16, 170.16, 195.08)) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) mzAcquisitionRange(spectra = sps, msLevel = 2L)
MS:4000099
"Number of MS1 scans where the scans' peaks intensity sums to 0
(i.e. no peaks or only 0-intensity peaks)." [PSI:MS]
MS:4000100
"Number of MS2 scans where the scans' peaks intensity sums to 0
(i.e. no peaks or only 0-intensity peaks)." [PSI:MS]
MS:4000101
"Number of MS3 scans where the scans' peaks intensity sums to 0
(i.e. no peaks or only 0-intensity peaks)." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the intensities per entry are obtained,
(3) the number of intensity entries that are NULL
, NA
, or
that have a sum of 0
are obtained and returned.
numberEmptyScans(spectra, msLevel = 1L, ...)
numberEmptyScans(spectra, msLevel = 1L, ...)
spectra |
|
msLevel |
|
... |
not used here |
MS:4000099
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000021 ! MS1 metric
relationship: has_units UO:0000189 ! count unit
relationship: has_value_type xsd:integer ! The allowed value-type for this
CV term
MS:4000100
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_units UO:0000189 ! count unit
relationship: has_value_type xsd:integer ! The allowed value-type for this
CV term
MS:4000101
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_units UO:0000189 ! count unit
relationship: has_value_type xsd:integer ! The allowed value-type for this CV
term
#' For *MS:4000099*, msLevel
is set to 1. For *MS:4000100*,
msLevel
is set to 2. For *MS:4000101*, msLevel
is set to 3.
An attribute containing the PSI:MS term will only be returned if
msLevel
is either 1, 2, or 3.
numeric(1)
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) numberEmptyScans(spectra = sps, msLevel = 1L) numberEmptyScans(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) numberEmptyScans(spectra = sps, msLevel = 1L) numberEmptyScans(spectra = sps, msLevel = 2L)
MS:4000059
"The number of MS1 events in the run." [PSI:MS]
MS:4000060
"The number of MS2 events in the run." [PSI:MS]
For *MS:4000059*, msLevel
is set to 1. For *MS:4000060*,
msLevel
is set to 2.
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the number of the spectra are obtained (length
of Spectra
)
and returned.
numberSpectra(spectra, msLevel = 1L, ...)
numberSpectra(spectra, msLevel = 1L, ...)
spectra |
|
msLevel |
|
... |
not used here |
MS:4000059
synonym: "MS1-Count" EXACT [PMID:24494671]
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000021 ! MS1 metric
relationship: has_value_type xsd:int ! The allowed value-type for this CV term
relationship: has_units UO:0000189 ! count unit
MS:4000060
synonym: "MS2-Count" EXACT [PMID:24494671]
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_type xsd:int ! The allowed value-type for this CV term
relationship: has_units UO:0000189 ! count unit
An attribute containing the PSI:MS term will only be returned if
msLevel
is either 1 or 2.
numeric(1)
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) numberSpectra(spectra = sps, msLevel = 1L) numberSpectra(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) numberSpectra(spectra = sps, msLevel = 1L) numberSpectra(spectra = sps, msLevel = 2L)
The function plotMetric
visualizes the metric values per sample. The
function accepts the output of calculateMetrics
or,
calculateMetricsFromSpectra
, or
calculateMetricsFromMsExperiment
and a vector specifying the metric
to display.
plotMetric(qc, metric = "areaUnderTic", plotly = TRUE)
plotMetric(qc, metric = "areaUnderTic", plotly = TRUE)
qc |
|
metric |
|
plotly |
|
plotMetric
will select all columns that start with
metric
. The different levels in the name
column in the
returned tibble correspond to the columns that were selected and do not
contain the metric
prefix. In case there is no additional specification
(e.g. for the metric chromatographyDuration
only the column chromatographyDuration
will
be selected), the name
column will include the metric
(chromatographyDuration
).
gg
plotly
Thomas Naake, [email protected]
library(msdata) library(MsExperiment) library(S4Vectors) msexp <- MsExperiment() sd <- DataFrame(sample_id = c("QC1", "QC2"), sample_name = c("QC Pool", "QC Pool"), injection_idx = c(1, 3)) sampleData(msexp) <- sd ## define file names containing spectra data for the samples and ## add them, along with other arbitrary files to the experiment fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) library(Spectra) ## import the data and add it to the msexp object spectra(msexp) <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (msLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) qc <- calculateMetricsFromMsExperiment(msexp = msexp, metrics = metrics, msLevel = 1, relativeTo = "Q1", change = "jump") rownames(qc) <- c("Sample 1", "Sample 2") ## do the actual plotting plotMetric(qc, metric = "areaUnderTic", plotly = TRUE)
library(msdata) library(MsExperiment) library(S4Vectors) msexp <- MsExperiment() sd <- DataFrame(sample_id = c("QC1", "QC2"), sample_name = c("QC Pool", "QC Pool"), injection_idx = c(1, 3)) sampleData(msexp) <- sd ## define file names containing spectra data for the samples and ## add them, along with other arbitrary files to the experiment fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) library(Spectra) ## import the data and add it to the msexp object spectra(msexp) <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (msLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) qc <- calculateMetricsFromMsExperiment(msexp = msexp, metrics = metrics, msLevel = 1, relativeTo = "Q1", change = "jump") rownames(qc) <- c("Sample 1", "Sample 2") ## do the actual plotting plotMetric(qc, metric = "areaUnderTic", plotly = TRUE)
The function plotMetricTibble
is a helper function for the function
plotMetric
. It returns a tibble in long format that is interpretable
by ggplot2
.
plotMetricTibble(qc, metric)
plotMetricTibble(qc, metric)
qc |
|
metric |
|
plotMetricRibble
will select all columns that start with
metric
. The different levels in the name
column in the returned
tibble correspond to the columns that were selected and do not contain the
metric
prefix. In case there is no additional specification
(e.g. for the metric chromatographyDuration
only the column
chromatographyDuration
will
be selected), the name
column will include the metric
(chromatographyDuration
).
tibble
Thomas Naake, [email protected]
library(msdata) library(MsExperiment) library(S4Vectors) msexp <- MsExperiment() sd <- DataFrame(sample_id = c("QC1", "QC2"), sample_name = c("QC Pool", "QC Pool"), injection_idx = c(1, 3)) sampleData(msexp) <- sd ## define file names containing spectra data for the samples and ## add them, along with other arbitrary files to the experiment fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) experimentFiles(msexp) <- MsExperimentFiles( mzML_files = fls, annotations = "internal_standards.txt") ## link samples to data files: first sample to first file in "mzML_files", ## second sample to second file in "mzML_files" msexp <- linkSampleData(msexp, with = "experimentFiles.mzML_files", sampleIndex = c(1, 2), withIndex = c(1, 2)) msexp <- linkSampleData(msexp, with = "experimentFiles.annotations", sampleIndex = c(1, 2), withIndex = c(1, 1)) library(Spectra) ## import the data and add it to the mse object spectra(msexp) <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (msLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) qc <- calculateMetricsFromMsExperiment(msexp = msexp, metrics = metrics, msLevel = 1, relativeTo = "Q1", change = "jump") rownames(qc) <- c("Sample 1", "Sample 2") plotMetricTibble(qc, metric = "areaUnderTic")
library(msdata) library(MsExperiment) library(S4Vectors) msexp <- MsExperiment() sd <- DataFrame(sample_id = c("QC1", "QC2"), sample_name = c("QC Pool", "QC Pool"), injection_idx = c(1, 3)) sampleData(msexp) <- sd ## define file names containing spectra data for the samples and ## add them, along with other arbitrary files to the experiment fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) experimentFiles(msexp) <- MsExperimentFiles( mzML_files = fls, annotations = "internal_standards.txt") ## link samples to data files: first sample to first file in "mzML_files", ## second sample to second file in "mzML_files" msexp <- linkSampleData(msexp, with = "experimentFiles.mzML_files", sampleIndex = c(1, 2), withIndex = c(1, 2)) msexp <- linkSampleData(msexp, with = "experimentFiles.annotations", sampleIndex = c(1, 2), withIndex = c(1, 1)) library(Spectra) ## import the data and add it to the mse object spectra(msexp) <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (msLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) qc <- calculateMetricsFromMsExperiment(msexp = msexp, metrics = metrics, msLevel = 1, relativeTo = "Q1", change = "jump") rownames(qc) <- c("Sample 1", "Sample 2") plotMetricTibble(qc, metric = "areaUnderTic")
MS:4000117
"From the distribution of MS2 precursor intensities, the mean. The intensity
distribution of the precursors informs about the dynamic range of the
acquisition." [PSI:MS]
MS:4000163
"From the distribution of identified MS2 precursor intensities, the mean. The
intensity distribution of the identified precursors informs about the dynamic
range of the acquisition in relation to identifiability." [PSI:MS]
MS:4000164
"From the distribution of unidentified MS2 precursor intensities, the mean. The
intensity distribution of the unidentified precursors informs about the
dynamic range of the acquisition in relation to identifiability."
[PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the intensity of the precursor ions within the Spectra
object are obtained,
(3) the mean of the precursor intensity values is obtained
(NA
values are removed) and returned.
precursorIntensityMean( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
precursorIntensityMean( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000117
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_concept STATO:0000401 ! sample mean
relationship: has_value_type xsd:float ! The allowed value-type for this CV term
relationship: has_units MS:1000043 ! intensity unit
MS:4000163
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_concept STATO:0000401 ! sample mean
relationship: has_value_type xsd:float ! The allowed value-type for this CV term
relationship: has_units MS:1000043 ! intensity unit
MS:4000164
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_concept STATO:0000401 ! sample mean
relationship: has_value_type xsd:float ! The allowed value-type for this CV term
relationship: has_units MS:1000043 ! intensity unit
numeric(1)
The Spectra
object might contain features that were (not) identified. If
the calculation needs to be done according to *MS:4000163*/*MS:4000164*, the
Spectra
object should be prepared accordingly.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorIntensity <- c(100.0, 100.0, 100.0) sps <- Spectra(spd) precursorIntensityMean(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorIntensity <- c(100.0, 100.0, 100.0) sps <- Spectra(spd) precursorIntensityMean(spectra = sps, msLevel = 2L)
MS:4000116
"From the distribution of MS2 precursor intensities, the quantiles. E.g. a
value triplet represents the quartiles Q1, Q2, Q3. The intensity
distribution of the precursors informs about the dynamic range of the
acquisition." [PSI:MS]
MS:40000161
From the distribution of identified MS2 precursor intensities, the quantiles.
E.g. a value triplet represents the quartiles Q1, Q2, Q3. The intensity
distribution of the precursors informs about
the dynamic range of the acquisition in relation to identifiability.
The used type of identification should be noted in the metadata or analysis
methods section of the recording file for the respective run. In case of
multiple acceptance criteria (FDR) available in proteomics, PSM-level FDR
should be used for better comparability." [PSI:MS]"
id: MS:4000162
"From the distribution of unidentified MS2 precursor intensities, the
quantiles. E.g. a value triplet represents the quartiles Q1, Q2, Q3.
The intensity distribution of the precursors informs about the
dynamic range of the acquisition in relation to identifiability. The used
type of identification should be noted in the metadata or analysis methods
section of the recording file for the respective run. In case of multiple
acceptance criteria (FDR) available in proteomics, PSM-level FDR should be
used for better comparability." [PSI:MS]"
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the intensity of the precursor ions within the Spectra
object
are obtained,
(3) the 25%, 50%, and 75% quantile of the precursor intensity values are
obtained (NA
values are removed) and returned.
precursorIntensityQuartiles( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
precursorIntensityQuartiles( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
id: MS:4000116
is_a: MS:4000004 ! n-tuple
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_concept STATO:0000291 ! quantile
relationship: has_value_type xsd:float ! The allowed value-type for this CV
term
relationship: has_units MS:1000043 ! intensity unit
MS:4000161
is_a: MS:4000004 ! n-tuple
is_a: MS:4000008 ! ID based
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_concept STATO:0000291 ! quantile
relationship: has_value_type xsd:float ! The allowed value-type for this CV
term
relationship: has_units MS:1000043 ! intensity unit
id: MS:4000162
is_a: MS:4000004 ! n-tuple
is_a: MS:4000008 ! ID based
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_concept STATO:0000291 ! quantile
relationship: has_value_type xsd:float ! The allowed value-type for this CV
term
relationship: has_units MS:1000043 ! intensity unit
numeric(3)
The Spectra
object might contain features that were (not) identified. If
the calculation needs to be done according to *MS:4000161*/*MS:4000162*, the
Spectra
object should be prepared accordingly.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorIntensity <- c(100.0, 100.0, 100.0) sps <- Spectra(spd) precursorIntensityQuartiles(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorIntensity <- c(100.0, 100.0, 100.0) sps <- Spectra(spd) precursorIntensityQuartiles(spectra = sps, msLevel = 2L)
MS:4000160
"Minimum and maximum MS2 precursor intensity recorded. The intensity range
of the precursors informs about the dynamic range of the acquisition."
[PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the intensity of the precursor ions within the Spectra
object are obtained,
(3) the minimum and maximum precursor intensity values are obtained and
returned.
precursorIntensityRange(spectra, msLevel = 1, ...)
precursorIntensityRange(spectra, msLevel = 1, ...)
spectra |
|
msLevel |
|
... |
not used here |
MS:4000160
is_a: MS:4000001 ! QC metric
is_a: MS:4000004 ! n-tuple
is_a: MS:4000009 ! ID free
relationship: has_metric_category MS:4000022 ! MS2 metric
numeric(2)
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorIntensity <- c(100.0, 100.0, 100.0) sps <- Spectra(spd) precursorIntensityRange(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorIntensity <- c(100.0, 100.0, 100.0) sps <- Spectra(spd) precursorIntensityRange(spectra = sps, msLevel = 2L)
MS:4000118
"From the distribution of MS2 precursor intensities, the sigma value. The
intensity distribution of the precursors informs about the dynamic range
of the acquisition." [PSI:MS]
MS:4000165
"From the distribution of identified MS2 precursor intensities, the sigma value.
The intensity distribution of the precursors informs about the dynamic
range of the acquisition in relation to identifiability. The used type of
identification should be noted in the metadata or analysis methods section
of the recording file for the respective run. In case of multiple acceptance
criteria (FDR) available in proteomics, PSM-level FDR should be used for
better comparability." [PSI:MS]
MS:4000166
"From the distribution of unidentified MS2 precursor intensities, the sigma
value. The intensity distribution of the precursors informs about the
dynamic range of the acquisition in relation to identifiability. The used
type of identification should be noted in the metadata or analysis methods
section of the recording file for the respective run. In case of multiple
acceptance criteria (FDR) available in proteomics, PSM-level FDR should be
used for better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the intensity of the precursor ions within the Spectra
object are obtained,
(3) the standard deviation of precursor intensity values is obtained
(NA
values are removed) and returned.
precursorIntensitySd( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
precursorIntensitySd( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000118
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_concept STATO:0000237 ! standard deviation
relationship: has_value_type xsd:float ! The allowed value-type for this CV
term
relationship: has_units MS:1000043 ! intensity unit
MS:4000165
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000008 ! ID based
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_concept STATO:0000237 ! standard deviation
relationship: has_value_type xsd:float ! The allowed value-type for this CV
term
relationship: has_units MS:1000043 ! intensity unit
MS:4000166
is_a: MS:4000003 ! single value
relationship: has_metric_category MS:4000008 ! ID based
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_concept STATO:0000237 ! standard deviation
relationship: has_value_type xsd:float ! The allowed value-type for this CV
term
relationship: has_units MS:1000043 ! intensity unit
numeric(1)
The Spectra
object might contain features that were (not) identified. If
the calculation needs to be done according to *MS:4000165*/*MS:4000166*, the
Spectra
object should be prepared accordingly.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorIntensity <- c(100.0, 100.0, 100.0) sps <- Spectra(spd) precursorIntensitySd(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorIntensity <- c(100.0, 100.0, 100.0) sps <- Spectra(spd) precursorIntensitySd(spectra = sps, msLevel = 2L)
object
The function qualityMetrics
returns a character vector with available
quality metrics depending on object
.
qualityMetrics(object)
qualityMetrics(object)
object |
object of type |
object
is a Spectra
or MsExperiment
.
character
Thomas Naake
library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$dataOrigin <- rep("sample_1", 3) sps <- Spectra(spd) qualityMetrics(object = sps)
library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$dataOrigin <- rep("sample_1", 3) sps <- Spectra(spd) qualityMetrics(object = sps)
MS:4000167
"The ratio of 1+ over 2+ MS2 precursor charge count of all spectra. High
ratios of 1+/2+ MS2 precursor charge count may indicate inefficient
ionization." [PSI:MS]
MS:4000168
"The ratio of 1+ over 2+ MS2 precursor charge count of identified spectra.
High ratios of 1+/2+ MS2 precursor charge count may indicate inefficient
ionization. The used type of identification should be noted in the metadata
or analysis methods section of the recording file for the respective run.
In case of multiple acceptance criteria (FDR) available in proteomics,
PSM-level FDR should be used for better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the precursor charge is obtained,
(3) the number of precursors with charge 1+ is divided by the number of
precursors with charge 2+ and the ratio is returned.
ratioCharge1over2( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
ratioCharge1over2( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000167
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "IS-3A" RELATED [PMID:19837981]
synonym: "MS2 known precursor charges fractions" RELATED []
synonym: "MS2-PrecZ-1" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-2" RELATED [PMID:24494671]
MS:4000168
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "IS-3A" RELATED [PMID:19837981]
synonym: "MS2 known precursor charges fractions" RELATED []
synonym: "MS2-PrecZ-1" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-2" RELATED [PMID:24494671]
NA
is returned if there are no features with precursor charge of 1+ or
2+.
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is either "all"
or "identified"
.
numeric(1)
The Spectra
object might contain features that were not identified. If
the calculation needs to be done according to *MS:4000168*, the
Spectra
object should be prepared accordingly.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorCharge <- c(1L, 1L, 1L) sps <- Spectra(spd) ratioCharge1over2(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorCharge <- c(1L, 1L, 1L) sps <- Spectra(spd) ratioCharge1over2(spectra = sps, msLevel = 2L)
MS:4000169
"The ratio of 3+ over 2+ MS2 precursor charge count of all spectra. Higher
ratios of 3+/2+ MS2 precursor charge count may preferentially favor
longer e.g. peptides." [PSI:MS]
MS:4000170
"The ratio of 3+ over 2+ MS2 precursor charge count of identified spectra.
Higher ratios of 3+/2+ MS2 precursor charge count may preferentially favor
longer e.g. peptides. The used type of identification should be noted in the
metadata or analysis methods section of the recording file for the respective
run. In case of multiple acceptance criteria (FDR) available in proteomics,
PSM-level FDR should be used for better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the precursor charge is obtained,
(3) the number of precursors with charge 3+ is divided by the number of
precursors with charge 2+ and the ratio is returned.
ratioCharge3over2( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
ratioCharge3over2( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000169
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "IS-3B" RELATED [PMID:19837981]
synonym: "MS2 known precursor charges fractions" RELATED []
synonym: "MS2-PrecZ-2" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-3" RELATED [PMID:24494671]
MS:4000170
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "IS-3B" RELATED [PMID:19837981]
synonym: "MS2 known precursor charges fractions" RELATED []
synonym: "MS2-PrecZ-2" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-3" RELATED [PMID:24494671]
NA
is returned if there are no features with precursor charge of 2+ or
3+.
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is either "all"
or "identified"
.
numeric(1)
The Spectra
object might contain features that were not identified. If
the calculation needs to be done according to *MS:4000170*, the
Spectra
object should be prepared accordingly.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorCharge <- c(1L, 1L, 1L) sps <- Spectra(spd) ratioCharge3over2(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorCharge <- c(1L, 1L, 1L) sps <- Spectra(spd) ratioCharge3over2(spectra = sps, msLevel = 2L)
MS:4000171
"The ratio of 4+ over 2+ MS2 precursor charge count of all spectra. Higher
ratios of 4+/2+ MS2 precursor charge count may preferentially favor longer
e.g. peptides." [PSI:MS]
MS:4000172
"The ratio of 4+ over 2+ MS2 precursor charge count of identified spectra.
Higher ratios of 4+/2+ MS2 precursor charge count may preferentially favor
longer e.g. peptides. The used type of identification should be noted in the
metadata or analysis methods section of the recording file for the respective
run. In case of multiple acceptance criteria (FDR) available in proteomics,
PSM-level FDR should be used for better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the precursor charge is obtained,
(3) the number of precursors with charge 4+ is divided by the number of
precursors with charge 2+ and the ratio is returned.
ratioCharge4over2( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
ratioCharge4over2( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000171
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "IS-3C" RELATED [PMID:19837981]
synonym: "MS2 known precursor charges fractions" RELATED []
synonym: "MS2-PrecZ-2" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-4" RELATED [PMID:24494671]
MS:4000172
is_a: MS:4000001 ! QC metric
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000020 ! ion source metric
relationship: has_metric_category MS:4000022 ! MS2 metric
synonym: "IS-3C" RELATED [PMID:19837981]
synonym: "MS2 known precursor charges fractions" RELATED []
synonym: "MS2-PrecZ-2" RELATED [PMID:24494671]
synonym: "MS2-PrecZ-4" RELATED [PMID:24494671]
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is either "all"
or "identified"
.
numeric(1)
The Spectra
object might contain features that were not identified. If
the calculation needs to be done according to *MS:4000172*, the
Spectra
object should be prepared accordingly.
NA
is returned if there are no features with precursor charge of 2+ or
3+.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorCharge <- c(1L, 1L, 1L) sps <- Spectra(spd) ratioCharge4over2(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$precursorCharge <- c(1L, 1L, 1L) sps <- Spectra(spd) ratioCharge4over2(spectra = sps, msLevel = 2L)
MS:4000070
"Upper and lower limit of retention time at which spectra are recorded."
[PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the retention time values of the features within the Spectra
object are obtained,
(3) the minimum and maximum retention time values are obtained and
returned.
rtAcquisitionRange(spectra, msLevel = 1L, ...)
rtAcquisitionRange(spectra, msLevel = 1L, ...)
spectra |
|
msLevel |
|
... |
not used here |
MS:4000070
is_a: MS:4000004 ! n-tuple
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000016 ! retention time metric
relationship: has_units UO:0000010 ! second
relationship: has_value_concept STATO:0000035 ! range
numeric(2)
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) rtAcquisitionRange(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) rtAcquisitionRange(spectra = sps, msLevel = 2L)
MS:4000153
"The interquartile retention time period, in seconds, for all quantification
data points after user-defined acceptance criteria are applied over the
complete run. Longer times indicate better chromatographic separation.
These data points may be for example XIC profiles, isotopic pattern areas,
or reporter ions (see MS:1001805). The used type should be noted in the
metadata or analysis methods section of the recording file for the respective
run. In case of multiple acceptance criteria (FDR) available in proteomics,
PSM-level FDR should be used for better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the retention time values are obtained,
(3) the interquartile range is obtained from the values and returned
(NA
values are removed).
rtIqr( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
rtIqr( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000153
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
is_a: MS:4000017 ! chromatogram metric
relationship: has_units UO:0000010 ! second
synonym: "C-2A" RELATED [PMID:19837981]
Retention time values that are NA
are removed.
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is "identified"
.
numeric(1)
The Spectra
object might contain features that were not identified. If
the calculation needs to be done according to *MS:4000153*, the
Spectra
object should be prepared accordingly, i.e. subsetted to
spectra
with identification data.
The stored retention time information in spectra
might have a
different unit than seconds. rtIqr
will return the IQR based on the
values stored in spectra
and will not convert these values to seconds.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) rtIqr(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) rtIqr(spectra = sps, msLevel = 2L)
MS:4000154
"The rate of identified quantification data points for the interquartile
retention time period, in identified quantification data points per second.
Higher rates indicate efficient sampling and identification. These data
points may be for example XIC profiles, isotopic pattern areas, or reporter
ions (see MS:1001805). The used type should be noted in the metadata or
analysis methods section of the recording file for the respective run. In
case of multiple acceptance criteria (FDR) available in proteomics, PSM-level
FDR should be used for better comparability." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is filtered according to the MS level,
(2) the retention time values are obtained,
(3) the 25% and 75% quantiles are obtained from the retention time values
(NA
values are removed),
(4) the number of eluted features between this 25% and 75% quantile is
calculated,
(5) the number of features is divided by the interquartile range of the
retention time and returned.
rtIqrRate( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
rtIqrRate( spectra, msLevel = 1L, identificationLevel = c("all", "identified", "unidentified"), ... )
spectra |
|
msLevel |
|
identificationLevel |
|
... |
not used here |
MS:4000154
is_a: MS:4000003 ! single value
is_a: MS:4000008 ! ID based
is_a: MS:4000017 ! chromatogram metric
relationship: has_units UO:0000106 ! hertz
synonym: "C-2B" RELATED [PMID:19837981]
An attribute containing the PSI:MS term will only be returned if
identificationLevel
is "identified"
.
numeric(2)
The Spectra
object might contain features that were not identified. If
the calculation needs to be done according to *MS:4000154*, the
Spectra
object should be prepared accordingly, i.e. being subsetted to
spectra
with identification data.
The stored retention time information in spectra
might have a different
unit than seconds. .rtIqr
will return the IQR based on the values stored
in spectra
and will not convert these values to seconds.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) rtIqrRate(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) rtIqrRate(spectra = sps, msLevel = 2L)
MS:4000055
"The interval used for acquisition of the first, second, third, and fourth
quarter of all MS1 events divided by retention time duration." [PSI:MS]
MS:4000056
"The interval used for acquisition of the first, second, third, and fourth
quarter of all MS2 events divided by retention time duration." [PSI:MS]
The metric is calculated as follows:
(1) the retention time duration of the whole Spectra
object is determined
(taking into account all the MS levels),
(2) the Spectra
object is filtered according to the MS level and
subsequently ordered according to the retention time
(3) the MS events are split into four (approximately) equal parts,
(4) the relative retention time is calculated (using the retention time
duration from (1) and taking into account the minimum retention time),
(5) the relative retention time values associated to the MS event parts
are returned.
rtOverMsQuarters(spectra, msLevel = 1L, ...)
rtOverMsQuarters(spectra, msLevel = 1L, ...)
spectra |
|
msLevel |
|
... |
not used here |
MS:4000055
synonym: "RT-MS-Q1" RELATED [PMID:24494671]
synonym: "RT-MS-Q2" RELATED [PMID:24494671]
synonym: "RT-MS-Q3" RELATED [PMID:24494671]
synonym: "RT-MS-Q4" RELATED [PMID:24494671]
is_a: MS:4000004 ! n-tuple
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000016 ! retention time metric
relationship: has_metric_category MS:4000021 ! MS1 metric
relationship: has_value_type xsd:float ! The allowed value-type for this CV term
relationship: has_units UO:0000191 ! fraction
MS:4000056
synonym: "RT-MSMS-Q1" RELATED [PMID:24494671]
synonym: "RT-MSMS-Q2" RELATED [PMID:24494671]
synonym: "RT-MSMS-Q3" RELATED [PMID:24494671]
synonym: "RT-MSMS-Q4" RELATED [PMID:24494671]
is_a: MS:4000004 ! n-tuple
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000016 ! retention time metric
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_value_type xsd:float ! The allowed value-type for this CV term
relationship: has_units UO:0000191 ! fraction
The function returns c(NaN, NaN, NaN, NaN)
if the filtered
spectra
object has less than 4 scan events.
An attribute containing the PSI:MS term will only be returned if
msLevel
is 1 or 2.
numeric(4)
chromatographyDuration
considers the total runtime (including MS1
and MS2 scans).
Thomas Naake, Johannes Rainer
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L, 2L), polarity = c(1L, 1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847", "unknown"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine", "unknown")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876), c(83.0603, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994), c(3.146, 61.611)) spd$rtime <- c(9.44, 9.44, 15.84, 15.81) sps <- Spectra(spd) rtOverMsQuarters(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L, 2L), polarity = c(1L, 1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847", "unknown"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine", "unknown")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876), c(83.0603, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994), c(3.146, 61.611)) spd$rtime <- c(9.44, 9.44, 15.84, 15.81) sps <- Spectra(spd) rtOverMsQuarters(spectra = sps, msLevel = 2L)
The function shinyMsQuality
function starts a shiny application to
visualize the quality metrics interactively. It allows to display all metrics
contained in qc
.
The function accepts the output of calculateMetrics
,
calculateMetricsFromSpectra
, or calculateMetricsFromMsExperiment
shinyMsQuality(qc)
shinyMsQuality(qc)
qc |
|
The plots within the shiny application can be saved by clicking on the download button.
shiny
Thomas Naake, [email protected]
library(msdata) library(MsExperiment) library(S4Vectors) msexp <- MsExperiment() sd <- DataFrame(sample_id = c("QC1", "QC2"), sample_name = c("QC Pool", "QC Pool"), injection_idx = c(1, 3)) sampleData(msexp) <- sd ## define file names containing spectra data for the samples and ## add them, along with other arbitrary files to the experiment fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) experimentFiles(msexp) <- MsExperimentFiles( mzML_files = fls, annotations = "internal_standards.txt") ## link samples to data files: first sample to first file in "mzML_files", ## second sample to second file in "mzML_files" msexp <- linkSampleData(msexp, with = "experimentFiles.mzML_files", sampleIndex = c(1, 2), withIndex = c(1, 2)) msexp <- linkSampleData(msexp, with = "experimentFiles.annotations", sampleIndex = c(1, 2), withIndex = c(1, 1)) library(Spectra) ## import the data and add it to the mse object spectra(msexp) <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (msLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) qc <- calculateMetricsFromMsExperiment(msexp = msexp, metrics = metrics, msLevel = 1, relativeTo = "Q1", change = "jump") rownames(qc) <- c("Sample 1", "Sample 2") if (interactive()) shinyMsQuality(qc = qc)
library(msdata) library(MsExperiment) library(S4Vectors) msexp <- MsExperiment() sd <- DataFrame(sample_id = c("QC1", "QC2"), sample_name = c("QC Pool", "QC Pool"), injection_idx = c(1, 3)) sampleData(msexp) <- sd ## define file names containing spectra data for the samples and ## add them, along with other arbitrary files to the experiment fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) experimentFiles(msexp) <- MsExperimentFiles( mzML_files = fls, annotations = "internal_standards.txt") ## link samples to data files: first sample to first file in "mzML_files", ## second sample to second file in "mzML_files" msexp <- linkSampleData(msexp, with = "experimentFiles.mzML_files", sampleIndex = c(1, 2), withIndex = c(1, 2)) msexp <- linkSampleData(msexp, with = "experimentFiles.annotations", sampleIndex = c(1, 2), withIndex = c(1, 1)) library(Spectra) ## import the data and add it to the mse object spectra(msexp) <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## calculate the metrics ## additional parameters passed to the quality metrics functions ## (msLevel is an argument of areaUnderTic and msSignal10xChange, ## relativeTo is an argument of msSignal10xChange) qc <- calculateMetricsFromMsExperiment(msexp = msexp, metrics = metrics, msLevel = 1, relativeTo = "Q1", change = "jump") rownames(qc) <- c("Sample 1", "Sample 2") if (interactive()) shinyMsQuality(qc = qc)
MS:4000054
"The interval when the respective quarter of the TIC accumulates divided by
retention time duration." [PSI:MS]
The metric is calculated as follows:
(1) the Spectra
object is ordered according to the retention time,
(2) the cumulative sum of the ion count is calculated (TIC),
(3) the quantiles are calculated according to the probs
argument, e.g.
when probs
is set to c(0, 0.25, 0.5, 0.75, 1)
the 0%, 25%,
50%, 75%, and 100% quantile is calculated,
(4) the retention time/relative retention time (retention time divided by
the total run time taking into account the minimum retention time) is
calculated,
(5) the (relative) duration of the LC run after which the cumulative
TIC exceeds (for the first time) the respective quantile of the
cumulative TIC is calculated and returned.
ticQuartersRtFraction( spectra, probs = seq(0, 1, 0.25), msLevel = 1L, relative = TRUE, ... )
ticQuartersRtFraction( spectra, probs = seq(0, 1, 0.25), msLevel = 1L, relative = TRUE, ... )
spectra |
|
probs |
|
msLevel |
|
relative |
|
... |
not used here |
MS:4000054
synonym: "RT-TIC-Q1" RELATED [PMID:24494671]
synonym: "RT-TIC-Q2" RELATED [PMID:24494671]
synonym: "RT-TIC-Q3" RELATED [PMID:24494671]
synonym: "RT-TIC-Q4" RELATED [PMID:24494671]
is_a: MS:4000004 ! n-tuple
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000016 ! retention time metric
relationship: has_metric_category MS:4000017 ! chromatogram metric
relationship: has_value_type xsd:float ! The allowed value-type for this CV term
relationship: has_units UO:0000191 ! fraction
numeric
of length equal to length probs
with the relative
duration (duration divided by the total run time) after which the TIC
exceeds the respective quantile of the TIC.
Thomas Naake, Johannes Rainer
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) ticQuartersRtFraction(spectra = sps, msLevel = 2L)
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) spd$rtime <- c(9.44, 9.44, 15.84) sps <- Spectra(spd) ticQuartersRtFraction(spectra = sps, msLevel = 2L)
MS:4000057
"The log ratios of successive TIC-change quartiles. The TIC changes are
the list of MS1 total ion current (TIC) value changes from one to the next
scan, produced when each MS1 TIC is subtracted from the preceding MS1 TIC.
The metric's value triplet represents the log ratio of the TIC-change
Q2 to Q1, Q3 to Q2, TIC-change-max to Q3" [PSI:MS]
For calculation of MS:400057 set mode = "TIC_change"
.
MS:4000058
"The log ratios of successive TIC quartiles. The metric's value triplet
represents the log ratios of TIC-Q2 to TIC-Q1, TIC-Q3 to TIC-Q2,
TIC-max to TIC-Q3." [PSI:MS]
For calculation of MS:400058 set mode = "TIC"
.
The metric is calculated as follows:
(1) the TIC (ionCount
) of the Spectra
object is calculated
per scan event (with spectra ordered by retention time),
(2) for *MS:4000057*, the differences between TIC values are calculated
between subsequent scan events,
for *MS:4000058*, the TIC values between subsequent scan events are taken
as they are,
(3) for *MS:4000057* and *MS:4000058* the ratios between the 25%, 50%,
75%, and 100% quantile to the 25% quantile of the values of (2) are
calculated.
Alternatively, if relativeTo = "Q1"
, the ratios are calculated
between the 50%/25%, 75%/25%, and 100%/25% quantiles,
(4) The log
values of the ratios are returned.
ticQuartileToQuartileLogRatio( spectra, relativeTo = c("previous", "Q1"), mode = c("TIC_change", "TIC"), msLevel = 1L, ... )
ticQuartileToQuartileLogRatio( spectra, relativeTo = c("previous", "Q1"), mode = c("TIC_change", "TIC"), msLevel = 1L, ... )
spectra |
|
relativeTo |
|
mode |
|
msLevel |
|
... |
not used here |
MS:4000057
synonym: "MS1-TIC-Change-Q2" RELATED [PMID:24494671]
synonym: "MS1-TIC-Change-Q3" RELATED [PMID:24494671]
synonym: "MS1-TIC-Change-Q4" RELATED [PMID:24494671]
is_a: MS:4000004 ! n-tuple
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000017 ! chromatogram metric
relationship: has_metric_category MS:4000021 ! MS1 metric
relationship: has_value_type xsd:float ! The allowed value-type for this CV term
relationship: has_value_concept STATO:0000105 ! log signal intensity ratio
MS:4000058
synonym: "MS1-TIC-Q2" RELATED [PMID:24494671]
synonym: "MS1-TIC-Q3" RELATED [PMID:24494671]
synonym: "MS1-TIC-Q4" RELATED [PMID:24494671]
is_a: MS:4000004 ! n-tuple
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000017 ! chromatogram metric
relationship: has_metric_category MS:4000021 ! MS1 metric
relationship: has_value_type xsd:float ! The allowed value-type for this CV term
relationship: has_value_concept STATO:0000105 ! log signal intensity ratio
An attribute containing the PSI:MS term will only be returned if
relativeTo
is "previous"
and msLevel
is 1.
numeric(1)
This function interprets the *quantiles* from the [PSI:MS] definition as *quartiles*, i.e. the 0, 25, 50, 75 and 100% quantiles are used.
Thomas Naake
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) ## MS:4000057 ticQuartileToQuartileLogRatio(spectra = sps, relativeTo = "previous", msLevel = 2L, mode = "TIC_change") ticQuartileToQuartileLogRatio(spectra = sps, relativeTo = "Q1", msLevel = 2L, mode = "TIC_change") ## MS:4000058 ticQuartileToQuartileLogRatio(spectra = sps, relativeTo = "previous", msLevel = 2L, mode = "TIC") ticQuartileToQuartileLogRatio(spectra = sps, relativeTo = "Q1", msLevel = 2L, mode = "TIC")
library(S4Vectors) library(Spectra) spd <- DataFrame( msLevel = c(2L, 2L, 2L), polarity = c(1L, 1L, 1L), id = c("HMDB0000001", "HMDB0000001", "HMDB0001847"), name = c("1-Methylhistidine", "1-Methylhistidine", "Caffeine")) ## Assign m/z and intensity values spd$mz <- list( c(109.2, 124.2, 124.5, 170.16, 170.52), c(83.1, 96.12, 97.14, 109.14, 124.08, 125.1, 170.16), c(56.0494, 69.0447, 83.0603, 109.0395, 110.0712, 111.0551, 123.0429, 138.0662, 195.0876)) spd$intensity <- list( c(3.407, 47.494, 3.094, 100.0, 13.240), c(6.685, 4.381, 3.022, 16.708, 100.0, 4.565, 40.643), c(0.459, 2.585, 2.446, 0.508, 8.968, 0.524, 0.974, 100.0, 40.994)) sps <- Spectra(spd) ## MS:4000057 ticQuartileToQuartileLogRatio(spectra = sps, relativeTo = "previous", msLevel = 2L, mode = "TIC_change") ticQuartileToQuartileLogRatio(spectra = sps, relativeTo = "Q1", msLevel = 2L, mode = "TIC_change") ## MS:4000058 ticQuartileToQuartileLogRatio(spectra = sps, relativeTo = "previous", msLevel = 2L, mode = "TIC") ticQuartileToQuartileLogRatio(spectra = sps, relativeTo = "Q1", msLevel = 2L, mode = "TIC")
MzQCmzQC
objectsThe function transformIntoMzQC
transfers the metrics stored in
spectra_metrics
into a list of MzQCmzQC
objects. Each list
entry will refer to the corresponding entry in spectra_metrics
.
As such, each entry contains information from a single dataOrigin
of a Spectra
object.
The function transformIntoMzQC
is a helper function within
calculateMetricsFromSpectra
.
transformIntoMzQC(spectra_metrics)
transformIntoMzQC(spectra_metrics)
spectra_metrics |
list of named vector |
The MzQCmzQC
object will only contain those quality metrics
that have a corresponding attribute with a [PSI:MS] identifier. The
matching is done via the names of each vector in spectra_metrics
.
The Field "version"
is set to the current version of the rmzqc
package.
The entry of "MzQCanalysisSoftware"
is filled with the [PSI:MS] id
of MsQuality
("MS:") and the version is taken from
packageDescription("MsQuality")[["Version"]]
.
list
containing as entries MzQCmzQC
objects for each
Spectra
with same dataOrigin
Thomas Naake, Johannes Rainer
library(msdata) library(Spectra) ## define file names containing spectra data for the samples fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) ## import the data and add it to the spectra object spectra <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## obtain the spectra_metrics object f <- dataOrigin(spectra) f_unique <- unique(f) ## spectra_metrics <- bplapply(f_unique, function(f_unique_i) { ##calculateMetricsFromOneSampleSpectra( ## spectra = spectra[f == f_unique_i], metrics = metrics) ## }, BPPARAM = bpparam()) ## transform into mzQC objects ##transformIntoMzQC(spectra_metrics)
library(msdata) library(Spectra) ## define file names containing spectra data for the samples fls <- dir(system.file("sciex", package = "msdata"), full.names = TRUE) ## import the data and add it to the spectra object spectra <- Spectra(fls, backend = MsBackendMzR()) ## define the quality metrics to be calculated metrics <- c("areaUnderTic", "chromatographyDuration", "msSignal10xChange") ## obtain the spectra_metrics object f <- dataOrigin(spectra) f_unique <- unique(f) ## spectra_metrics <- bplapply(f_unique, function(f_unique_i) { ##calculateMetricsFromOneSampleSpectra( ## spectra = spectra[f == f_unique_i], metrics = metrics) ## }, BPPARAM = bpparam()) ## transform into mzQC objects ##transformIntoMzQC(spectra_metrics)