View source: R/function_calculateMetrics_from_Spectra.R
calculateMetricsFromSpectra | R Documentation |
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()
)
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.