QcMetric-class: The '"QcMetric"' class for QC items

Description Objects from the Class Slots Methods Author(s) See Also Examples

Description

Data structure for individual QC metrics items.

Objects from the Class

Objects can be created using the constructor QcMetric(...), where slots are assigned individually. See example below.

Slots

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.

Methods

name

signature(object = "QcMetric"): retrieves the name of the object.

name<-

signature(object = "QcMetric", value = "character"): set the name of the object.

description

signature(object = "QcMetric"): retrieves the description of the object.

description<-

signature(object = "QcMetric", value = "character"): set the description of the object.

status

signature(object = "QcMetric"): retrieves the status of the object.

status<-

signature(object = "QcMetric", value = "logical"): sets the status of the objects.

qcdata

signature(object = "QcMetric", x = "missing"): lists all the data objects that are associated with the objects.

qcdata

signature(object = "QcMetric", x = "character"): retrieves the variable x for the object.

qcdata<-

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.

qcenv

signature(object = "QcMetric"): return the environment that stores the QC data.

qcenv<-

signature(object = "QcMetric"): Set all variable in the RHS environment as qcdata variables. Equivalent to qcdata(object) <- x where x is an environment.

show

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.

show<-

signature(object = "QcMetric", value = "function"): sets a custom show method for object.

plot

signature(x = "QcMetric", y = "missing"): plots the object using the provide show method.

plot<-

signature(object = "QcMetric", value = "function"): sets a custom plot method for object.

qcReport

signature(x = "QcMetric", ...): to generate quality reports. See qcReport for details.

Author(s)

Laurent Gatto <lg390@cam.ac.uk>

See Also

The QcMetrics class to bundle a set of QcMetric instances.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(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
qcdata(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)

## Not run: 
    ## generate a report 
    qcReport(qcm)

## End(Not run)

qcmetrics documentation built on Nov. 8, 2020, 7:45 p.m.