setMtdContact() sets or updates contact-related metadata fields within
an MTD (metadata) section. When contact metadata already exists, the
function can either replace it entirely or append new values to the existing
ones.
getMtdContact() returns the contact 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.- name
charactercontact’s name.- affiliation
charactercontact’s affiliation.charactercontact’s e-mail address.- orcid
charactercontact’s ORCID identifier.- replace
logicalflag controlling how pre-existing contact 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
setMtdContact(): the input objectxupdated to include the new or merged contact metadata fields. Ifxis empty, the emptyx.For
getMtdContact(): a namedcharacterwith the contact information, names being the field names.
Examples
x <- mtdSkeleton("001", software = "[MS, MS:1001582, xmcs, 4.0.0]")
## Add contact metadata to an existing mzTab object
mtd <- setMtdContact(x, name = "Name Surname",
affiliation = "PSI-MS",
email = "name.surname@mail.com", orcid = "0000-0002-1825-0097")
## Replace all existing contact metadata
mtd <- setMtdContact(mtd, name = "Name Surname",
affiliation = "PSI-MS",
email = "name.surname@mail.com",
orcid = "0000-0002-1825-0097",
replace = TRUE)
getMtdContact(mtd)
#> contact[1]-name contact[1]-affiliation contact[1]-email
#> "Name Surname" "PSI-MS" "name.surname@mail.com"
#> contact[1]-orcid
#> "0000-0002-1825-0097"
