transformIntoMzQC: Transform the metrics into a list of 'MzQCmzQC' objects

View source: R/function_calculateMetrics_from_Spectra.R

transformIntoMzQCR Documentation

Transform the metrics into a list of MzQCmzQC objects

Description

The 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.

Usage

transformIntoMzQC(spectra_metrics)

Arguments

spectra_metrics

list of named vector

Details

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"]].

Value

list containing as entries MzQCmzQC objects for each Spectra with same dataOrigin

Author(s)

Thomas Naake, Johannes Rainer

Examples

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)


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