| Title: | A Framework for Quality Control |
|---|---|
| Description: | The package provides a framework for generic quality control of data. It permits to create, manage and visualise individual or sets of quality control metrics and generate quality control reports in various formats. |
| Authors: | Laurent Gatto [aut, cre] |
| Maintainer: | Laurent Gatto <[email protected]> |
| License: | GPL-2 |
| Version: | 1.51.0 |
| Built: | 2026-05-30 09:33:47 UTC |
| Source: | https://github.com/bioc/qcmetrics |
A simple wrapper for the QC of 15N labelling. The respective QC items are the distribution of PSM incorporation rates, distribution of log2 fold-changes and number of identified features. See the vignette for details.
n15qc(object, fcol = c("Protein_Accession", "Peptide_Sequence", "Number_Of_Unique_Peptides", "Variable_Modifications", "inc"), inctr = 97.5, lfctr = c(-0.5, 0.5), type, reportname)n15qc(object, fcol = c("Protein_Accession", "Peptide_Sequence", "Number_Of_Unique_Peptides", "Variable_Modifications", "inc"), inctr = 97.5, lfctr = c(-0.5, 0.5), type, reportname)
object |
An |
fcol |
The name of the feature variables for the
protein identifiers (accession numbers for example), the
peptide sequences, the number of unique peptides for each
identified protein, the variable modifications identified
on the peptides and the N15 incorporation rate. These
must be provided in that order. Defaults are
|
inctr |
The minimum level of median incorporation
rate to set the QC item status to |
lfctr |
The range of accepted median PSM log2
fold-change for the QC item status to be set to
|
type |
The type of report to be saved. If missing
(default), no report is generated. See
|
reportname |
The name of the report, in case a
|
Invisibly returns the resulting QcMetrics
instance.
Laurent Gatto
An example data for 15N metabolic labelling, distributed as an
MSnSet to illustrate 15N QC.
data(n15psm)data(n15psm)
See MSnSet and the MSnbase-demo vignette in the
MSnbase package.
library("MSnbase") data(n15psm) psmlibrary("MSnbase") data(n15psm) psm
These functions convert the ith QcMetric instance of the
QcMetrics object into a section of the adequate format,
i.e. TeX of R markdown.
Qc2Tex(object, i) Qc2Tex2(object, i) Qc2Tex3(object, i) Qc2Rmd(object, i)Qc2Tex(object, i) Qc2Tex2(object, i) Qc2Tex3(object, i) Qc2Rmd(object, i)
object |
An instance of class |
i |
A |
A character representing the QC item section.
Laurent Gatto
qcReport and the vignette.
"QcMetadata" classThe QcMetadata class is a simple interface to metadata. The
objects can be displayed with show for a summary and
print for the content.
Objects can be created by calls of the form QcMetadata(...).
metadata:Object of class "list" that stores
the metadata variables. The list must be named. NA and
empty characters are not allowed.
signature(x = "QcMetadata"): subsets x as a
new QcMetadata instance.
signature(x = "QcMetadata"): extracts a single
element of x.
signature(x = "QcMetadata"): return the
object's metadata list. Also available as mdata.
signature(x = "QcMetadata", value =
"list"): sets the objects metadata. Also available as
mdata.
signature(x = "QcMetadata"): returns the number
of metadata variables.
signature(x = "QcMetadata"): returns the names
of the metadata variables.
Laurent Gatto
QcMetadata(metadata = list(name = "John Doe", lab = "Big Lab in Big Uni")) ## less typing qmd <- QcMetadata(list(name = "John Doe", lab = "Big Lab in Big Uni")) mdata(qmd) show(qmd) print(qmd)QcMetadata(metadata = list(name = "John Doe", lab = "Big Lab in Big Uni")) ## less typing qmd <- QcMetadata(list(name = "John Doe", lab = "Big Lab in Big Uni")) mdata(qmd) show(qmd) print(qmd)
"QcMetric" class for QC itemsData structure for individual QC metrics items.
Objects can be created using the constructor QcMetric(...), where
slots are assigned individually. See example below.
name:Object of class "character" of length 1
naming the object.
description:Object of class "character" of
arbitrary length describing the qc metric in more details.
qcdata:Object of class "environment" that
stores the actual data.
plot:Object of class "function" to graphically
represent the data and infer quality status.
show:Object of class "function" to print a
short textual representation of the object. A reasonable
default value is provided.
status:Object of class "logical" that
indicates weather the data passes (TRUE) or fails
(FALSE) the metric or has not yet been evaluated.
signature(object = "QcMetric"): retrieves the
name of the object.
signature(object = "QcMetric", value =
"character"): set the name of the object.
signature(object = "QcMetric"): retrieves the
description of the object.
signature(object = "QcMetric", value =
"character"): set the description of the object.
signature(object = "QcMetric"): retrieves the
status of the object.
signature(object = "QcMetric", value =
"logical"): sets the status of the objects.
signature(object = "QcMetric", x = "missing"):
lists all the data objects that are associated with the
objects.
signature(object = "QcMetric", x =
"character"): retrieves the variable x for the
object.
signature(object = "QcMetric", var): creates
or overwrites (with a message) the data variable var by
assigning the RHS value. If var is missing and the RHS
expression is an environment, then qcdata is reset with all
the variables in value.
signature(object = "QcMetric"): return the
environment that stores the QC data.
signature(object = "QcMetric"):
Set all variable in the RHS environment as qcdata
variables. Equivalent to qcdata(object) <- x where x
is an environment.
signature(object = "QcMetric"): shows a textual
summary of object. The default show implementation
is available as the qcshow{object, qcdata} function. The
second argument is a logical (default is TRUE) that
specifies whether qcdata(object) should be displayed.
signature(object = "QcMetric", value =
"function"): sets a custom show method for
object.
signature(x = "QcMetric", y = "missing"): plots
the object using the provide show method.
signature(object = "QcMetric", value =
"function"): sets a custom plot method for
object.
signature(x = "QcMetric", ...): to generate
quality reports. See qcReport for details.
Laurent Gatto
The QcMetrics class to bundle a set of
QcMetric instances.
(qc <- QcMetric()) qcdata(qc) try(qcdata(qc, "x")) x <- rnorm(10) qcdata(qc, "qc1") <- x qcdata(qc, "qc2") <- 1:10 qcdata(qc) all.equal(qcdata(qc, "qc1"), x) all.equal(qcdata(qc, "qc2"), 1:10) name(qc) <- "My test QcMetric" description(qc) <- "This qc metric describes bla bla bla, indicating possible issues in the third step of protocol bla bla bla." status(qc) <- FALSE qc ## or e <- new.env() e$qc1 <- rnorm(100) e$qc2 <- 1:100 qcenv(qc) <- e length(qcdata(qc, "qc1")) head(qcdata(qc, "qc2")) show(qc) show(qc) <- function(object) cat("Updated show method\n") show(qc) show(qc) <- qcshow qc plot(qc) plot(qc) <- function(object, ...) plot(qcdata(object, "qc2"), qcdata(object, "qc1"), xlab = "qc1", ylab = "qc2", ...) plot(qc) plot(qc, col = "red", pch = 19)(qc <- QcMetric()) qcdata(qc) try(qcdata(qc, "x")) x <- rnorm(10) qcdata(qc, "qc1") <- x qcdata(qc, "qc2") <- 1:10 qcdata(qc) all.equal(qcdata(qc, "qc1"), x) all.equal(qcdata(qc, "qc2"), 1:10) name(qc) <- "My test QcMetric" description(qc) <- "This qc metric describes bla bla bla, indicating possible issues in the third step of protocol bla bla bla." status(qc) <- FALSE qc ## or e <- new.env() e$qc1 <- rnorm(100) e$qc2 <- 1:100 qcenv(qc) <- e length(qcdata(qc, "qc1")) head(qcdata(qc, "qc2")) show(qc) show(qc) <- function(object) cat("Updated show method\n") show(qc) show(qc) <- qcshow qc plot(qc) plot(qc) <- function(object, ...) plot(qcdata(object, "qc2"), qcdata(object, "qc1"), xlab = "qc1", ylab = "qc2", ...) plot(qc) plot(qc, col = "red", pch = 19)
"QcMetrics" class for collections of QC itemsData structure for storing lists of QcMetric items.
Objects can be created using the constructor QcMetrics(...), where
slots are assigned individually. See example below.
In a standardised quality control pipeline, the QcMetrics and
QcMetric object are not generated manually. Their creation is
delegated to a wrapper function that reads a specific type of files,
parses the data, produces the individual QcMetric instances
and, eventually, the QcMetric object. See the package vignette
for details and examples.
metadata:Object of class
QcMetadata storing the
metadata of the object. This list would typically contain
the input file the data was read from, the date the object was
generated, ... or fully fledged minimum information
descriptions (see MIAxE), when available.
qcdata:Object of class "list" storing all the
individual QcMetric instances.
signature(x = "QcMetrics"): subsets x as a
new QcMetrics instance.
signature(x = "QcMetrics"): extracts a single
QcMetric instance.
signature(x = "QcMetrics"): returns the number
of QcMetric instances populate x.
signature(x = "QcMetrics"): return the
object's metadata list. Also available as mdata.
signature(x = "QcMetrics", value =
"list"): sets the objects metadata. Also available as
mdata.
signature(x = "QcMetric", value =
"QcMetadata"): sets the objects metadata. Also available as
mdata.
signature(object = "QcMetrics"): returns a
character vector of length length(object) with the names
of the QcMetric instances.
signature(object = "QcMetrics", x = "missing"):
returns a list of all QcMetric instances.
signature(object = "QcMetrics", value = "list"):
sets the qcdata of object.
signature(object = "QcMetrics"): prints a short
textual description of object.
signature(object = "QcMetrics"): returns a
vector of quality statuses (logicals).
signature(object = "QcMetrics", value =
"logical"): sets the quality statuses. Length of value
and object must be identical.
signature(object = "QcMetrics", "data.frame"):
coerces object as a length(object) by 2 data frame
with the respective QcMetric instances names and statuses.
signature(object = "QcMetrics"): ...
Laurent Gatto
The QcMetric class for individual QC items.
example(QcMetric) show(qc) qc2 <- QcMetric(name = "My other metric", status = TRUE) qcdata(qc2, "x") <- rnorm(100) qcdata(qc2, "k") <- rep(LETTERS[1:2], 50) plot(qc2) <- function(object, ...) { require("lattice") d <- data.frame(x = qcdata(object, "x"), k = qcdata(object, "k")) bwplot(x ~ k, data = d) } qcm <- QcMetrics(qcdata = list(qc, qc2)) qcm qcm[1] ## a QcMetrics instance qcm[[1]] ## a single QcMetric metadata(qcm) metadata(qcm) <- QcMetadata(list(name = "Prof. Who", lab = "Cabin University")) ## or, shorter but equivalent metadata(qcm) <- list(name = "Prof. Who", lab = "Cabin University") metadata(qcm) ## or mdata(qcm) ## update metadata metadata(qcm) <- list(lab = "Big lab", ## updated uni = "Cabin University") ## added mdata(qcm)example(QcMetric) show(qc) qc2 <- QcMetric(name = "My other metric", status = TRUE) qcdata(qc2, "x") <- rnorm(100) qcdata(qc2, "k") <- rep(LETTERS[1:2], 50) plot(qc2) <- function(object, ...) { require("lattice") d <- data.frame(x = qcdata(object, "x"), k = qcdata(object, "k")) bwplot(x ~ k, data = d) } qcm <- QcMetrics(qcdata = list(qc, qc2)) qcm qcm[1] ## a QcMetrics instance qcm[[1]] ## a single QcMetric metadata(qcm) metadata(qcm) <- QcMetadata(list(name = "Prof. Who", lab = "Cabin University")) ## or, shorter but equivalent metadata(qcm) <- list(name = "Prof. Who", lab = "Cabin University") metadata(qcm) ## or mdata(qcm) ## update metadata metadata(qcm) <- list(lab = "Big lab", ## updated uni = "Cabin University") ## added mdata(qcm)
The qcReport method generates report in various formats taking
a QcMetrics instance as input. Each individual
quality control item produces a section with description of the item
and a assessment figure.
The reporting functions take a QcMetrics instance as input,
generate the source of the report and compile it into the final format
that are currently available are reporting_pdf,
reporting_tex, reporting_rmd and reporting_html.
See qcto for details about the sectioning functions,
that convert individual QcMetric objects into adequate report
sections.
The package vignette documents the report generation in more details and describes possibilities for customisation.
signature(
object = "QcMetrics",
reportname = "character",
type = "character",
author = "character",
title = "character",
metadata = "logical",
toc = "logical",
summary = "logical",
sessioninfo = "logical",
clean = "logical",
quiet = "logical",
reporter,
qcto,
...)generates a report for the QcMetrics
object. The report will be named according the
reportname (default is qcreprt)and type, the
latter defining the output format and the extension. Possible
types are pdf (default), "tex", "Rmd", "html" (all
generated using the package knitr). A custom title
can be provided; default is "Quality control report generated with
qcmetrics". If no author is provided, the default value
(Sys.getenv("USER")) is used. The addition of a table of
contents (default is FALSE), a metadata section, a summary
section and the session information can be controlled with the
toc, metadata, summary and
sessioninformation arguments. The metadata section is
added to the report when present and the other have TRUE as
default.
Intermediate files are deleted, unless clean is set to
FALSE and verbose output can be turned on by setting
quiet to FALSE.
The reporter and qcto arguments are used to convert
QcMetric and QcMetrics objects into report
source. See Details and the package vignette for details.
Addition parameters can be passed to inner functions. For the
pdf report, passed to texi2pdf; for html,
passed to markdown::markdownToHTML.
The method invisibly returns the name of the report that was generated.
example(QcMetrics) show(qcm) destdir <- tempdir() (report <- file.path(destdir, "testQCReport")) ## Not run: ## pdf report qcReport(qcm, reportname = report) ## use pdflatex to generate the pdf file qcReport(qcm, reportname = report, texi2dvi = "pdflatex") ## End(Not run) ## default html report html <- qcReport(qcm, reportname = report, type = "html") html if (interactive()) browseURL(html)example(QcMetrics) show(qcm) destdir <- tempdir() (report <- file.path(destdir, "testQCReport")) ## Not run: ## pdf report qcReport(qcm, reportname = report) ## use pdflatex to generate the pdf file qcReport(qcm, reportname = report, texi2dvi = "pdflatex") ## End(Not run) ## default html report html <- qcReport(qcm, reportname = report, type = "html") html if (interactive()) browseURL(html)