qcMetric-class: Class which can compute plots and generate mzQC output...

qcMetric-classR Documentation

Class which can compute plots and generate mzQC output (usually for a single metric).

Description

Reference class which is instanciated with a metric description and a worker function (at initialization time, i.e. in the package) and can produce plots and mzQC values (at runtime, when data is provided) using setData().

Fields

helpText

Description (lengthy) of the metric and plot elements

workerFcn

Function which generates a result (usually plots). Data is provided using setData().

plots

List of plots (after setData() was called)

qcScores

Data.frame of scores from a qcMetric (computed within workerFcn())

mzQC

An named list of mzQC MzQCqualityMetric's (named by their fc.raw.file for runQuality or concatenated fc.raw.files for setQualities (e.g. "file 1;file4")) (valid after setData() was called)

qcCat

QC category (LC, MS, or prep)

qcName

Name of the qcScore in the heatmap

orderNr

Column index during heatmap generation and for the general order of plots

Examples


require(ggplot2)
dd = data.frame(x=1:10, y=11:20)
a = qcMetric$new(helpText="small help text", 
                 ## arbitrary arguments, matched during setData()
                 workerFcn=function(.self, data, gtit)
                 {
                   ## usually some code here to produce ggplots
                   pl = lapply(1:2, function(xx) {
                       ggplot(data) +
                         geom_point(aes(x=x*xx,y=y)) +
                         ggtitle(gtit)
                     })
                   return(list(plots = pl))
                 }, 
                 qcCat="LC", 
                 qcName="MS/MS Peak shape", 
                 orderNr = 30)
## test some output
a$setData(dd, "my title")
a$plots  ## the raw plots
a$getPlots(TRUE) ## same as above
a$getPlots(FALSE) ## plots without title
a$getTitles()  ## get the titles of the all plots
a$helpText
a$qcName




PTXQC documentation built on July 26, 2023, 5:27 p.m.