R/mzQC.R
isValidMzQC.Rd
Note: Returns TRUE for empty lists!
isValidMzQC(x, ...)
An mzQC refclass (or list of them), each will be subjected to isValidMzQC()
Ellipsis, for recursive argument splitting
You can pass multiple arguments, which are all checked individually. All of them need to be valid, for TRUE to be returned. The reason for combining both list support for arguments and ellipsis (...) into this function is that JSON arrays are represented as lists and you can simply pass them as a single argument (without the need for do.call()) and get the indices of invalid objects (if any). The ellipsis is useful to avoid clutter, i.e. if (!isValidMzQC(a) || !isValidMzQC(b)) doStuff() is harder to read than if (!isValidMzQC(a,b)) doStuff()
isValidMzQC(MzQCcvParameter$new("MS:4000059")) # FALSE
#> Warning: Variable 'name' is NA/NULL!
#> Warning: A field in object of type MzQCcvParameter is invalid.
#> [1] FALSE
isValidMzQC(MzQCcvParameter$new("MS:4000059", "Number of MS1 spectra")) # TRUE
#> [1] TRUE
isValidMzQC(list(MzQCcvParameter$new("MS:4000059"))) # FALSE
#> Warning: Variable 'name' is NA/NULL!
#> Warning: A field in object of type MzQCcvParameter is invalid.
#> Warning: In list of 'MzQCcvParameter', the element(s) #[1] is/are invalid.
#> [1] FALSE
isValidMzQC(list(MzQCcvParameter$new("MS:4000059", "Number of MS1 spectra"))) # TRUE
#> [1] TRUE
isValidMzQC(list(MzQCcvParameter$new("MS:4000059", "Number of MS1 spectra")),
MzQCcvParameter$new()) # FALSE
#> Warning: Variable 'accession' is NA/NULL!
#> Warning: Variable 'name' is NA/NULL!
#> Warning: A field in object of type MzQCcvParameter is invalid.
#> [1] FALSE