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


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.





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



## 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) {
##    spectra = spectra[f == f_unique_i], metrics = metrics)
##    }, BPPARAM = bpparam())

## transform into mzQC objects

tnaake/msQC documentation built on Feb. 25, 2024, 7:33 p.m.