Create an 'MzQCqualityMetric' object from two inputs
toQCMetric(id, value, on_violation = c("error", "warn"))
The CV accession
The data, as computed by some QC software in the required format.
What to do when 'value' is not of the correct type (according to the given 'id')? Default: "error"; or "warn"
An MzQCanalysisSoftware object
The inputs are:
an ID of a QC metric, e.g. "MS:4000059" (number of MS1 spectra)
a value
The value must be in the correct format depending on the metric. The value type (see below) is checked (a warning/error is given if mismatching): The following requirements for values apply:
single value: R single value; the unit is obtained from the CVs 'has_units'
n-tuple: an R vector, e.g. using c(1,2,3), i.e. all values have the same type; the unit is obtained from the CVs 'has_units'
table: an R data.frame(); all columns defined using CVs 'has_column' must be present (a warning/error is given otherwise)
matrix: an R matrix, i.e. all values have the same type; the unit is obtained from the CVs 'has_units'
Upon violation, an error (default) or a warning is emitted:
toQCMetric(id = "MS:4000059", value = data.frame(n = 1)) # errors: wrong value format
toQCMetric(id = "MS:4000059", value = 13405) # number of MS1 spectra
#> Reference class object of class "MzQCqualityMetric"
#> Field "accession":
#> [1] "MS:4000059"
#> Field "name":
#> [1] "number of MS1 spectra"
#> Field "description":
#> [1] "\"The number of MS1 events in the run.\" [PSI:MS]"
#> Field "value":
#> [1] 13405
#> Field "unit":
#> list()