calculateMetrics: Calculate QC metrics from a Spectra or MsExperiment object

View source: R/function_calculateMetrics_from_Spectra.R

calculateMetricsR Documentation

Calculate QC metrics from a Spectra or MsExperiment object

Description

Calculate QC metrics from a Spectra or MsExperiment object. calculateMetrics is a wrapper for the functions calculateMetricsFromSpectra and calculateMetricsFromMsExperiment.

Usage

calculateMetrics(
  object,
  metrics = qualityMetrics(object),
  filterEmptySpectra = FALSE,
  ...
)

Arguments

object

Spectra or MsExperiment object

metrics

character specifying the quality metrics to be calculated on object

filterEmptySpectra

logical(1) specifying if empty entries and entries with intensity zero of the Spectra object will be removed

...

arguments passed to the quality metrics functions defined in metrics

Details

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.

Value

data.frame containing in the columns the metrics for the different spectra and in rows the samples

Author(s)

Thomas Naake

Examples

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")

tnaake/MsQuality documentation built on Oct. 31, 2024, 2:41 a.m.