
Add or Update Controlled Vocabularies (CV) Metadata of an mzTab-M MTD section
Source:R/MTD.R
setMtdCv.RdsetMtdCv() sets or updates CV-related metadata fields within an MTD
(metadata) section. When CV metadata already exists, the function can either
replace it entirely or append new values to the existing ones.
getMtdCv() returns the CV information from an MTD section.
Arguments
- x
A MTD section that stores metadata fields. Can be a two-column
charactermatrix, a two-columndata.frameor aMzTabM()object. Defaults tomatrix(). If all values areNA, the function returnsxunchanged.- label
characterdescribing the labels of the controlled vocabularies/ontologies used in the mzTab-M file (e.g."MS"for PSI-MS).- full_name
characterdescribing the full names of the controlled vocabularies/ontologies used.- version
characterdescribing the version of the controlled vocabularies/ontologies used. (e.g."4.1.11")- uri
charactercontaining the URIs of the controlled vocabularies/ ontologies used in the mzTab file. Note: For OBO ontologies, always use an OBO PURL rather than raw repository links to ensure long-term stability (e.g."https://purl.obolibrary.org/obo/ms.obo"). For other ontology formats, please use the fully qualified PURL pointing to the ontology file.- replace
logicalflag controlling how pre-existing CV metadata is handled:FALSE(default): new values are appended to any existing values.TRUE: existing instrument metadata is discarded and replaced entirely by the supplied arguments.
Value
For
setMtdCv(): the input objectxupdated to include the new or merged CV metadata fields. Ifxis empty, the emptyx.For
getMtdCv(): a namedcharacterwith the CV information, names being the field names.
Examples
x <- mtdSkeleton("001", software = "[MS, MS:1001582, xmcs, 4.0.0]")
## Add CV metadata to an existing mzTab object
mtd <- setMtdCv(x, label = "MS",
full_name = "PSI-MS controlled vocabulary",
version = "4.1.11",
uri = "https://purl.obolibrary.org/obo/ms.obo")
## Replace all existing CV metadata
mtd <- setMtdCv(mtd, label = "MS",
full_name = "PSI-MS controlled vocabulary",
version = "4.1.11",
uri = "https://purl.obolibrary.org/obo/ms.obo",
replace = TRUE)
## Get CV infrmation
getMtdCv(mtd)
#> cv[1]-label
#> "MS"
#> cv[1]-full_name
#> "PSI-MS controlled vocabulary"
#> cv[1]-version
#> "4.1.11"
#> cv[1]-uri
#> "https://purl.obolibrary.org/obo/ms.obo"