mzTab-M makes use of controlled vocabulary (CV) parameters. These parameters
are expected to be provided in the format
"[CV label, accession, name, value]". In addition, also user parameters
where only the name and value are provided are supported, but it is
recommendet to use full CV parameters where possible.
Note
While mzTab supports "," in the name and value field (in which case
the respective field must be placed between "), this is currently not
supported. Thus, CV label and term (accession) are expected to be correctly
extracted, the name and value field might not if "," are present in them.
Examples
## Extract CV term
x <- c("[MS, MS:1002962, mean, ]", "[MS, MS:1002883, median, ]")
parse_cv_parameter(x, 1)
#> [1] "MS" "MS"
parse_cv_parameter(x)
#> [1] "MS:1002962" "MS:1002883"
parse_cv_parameter(x, 3)
#> [1] "mean" "median"
parse_cv_parameter(x, 4)
#> [1] NA NA
## CV term missing
parse_cv_parameter("[, , user, value]")
#> [1] NA
parse_cv_parameter("[, , user, value]", 3)
#> [1] "user"
parse_cv_parameter("[, , user, value]", 4)
#> [1] "value"