setMtdProtocol() sets or updates protocol-related metadata fields within
an MTD (metadata) section. When protocol metadata already exists, the
function can either replace it entirely or append new values to the existing
ones. Each protocol is referenced from an assay section (see mtdAssay()).
getMtdProtocol() returns the protocol 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
characterwith protocol name describing one or more steps of an experimental procedure, such as sample preparation, data acquisition or data processing.- type
characterwith the protocol type, as defined by the parameter. Can be of length 1 or equal tolength(name).- description
optional
characterwith the description of the protocol. Can be of length 1 or equal tolength(name).- parameters
optional
characterwith additional parameters of the protocol- 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
setMtdProtocol(): the input objectxupdated to include the new or merged protocol metadata fields. Ifxis empty, the emptyx.For
getMtdProtocol(): a namedcharacterwith the protocol information, names being the field names.
Examples
x <- mtdSkeleton("001", software = "[MS, MS:1001582, xmcs, 4.0.0]")
## Minimal example with protocol.
mtd <- setMtdProtocol(x, name = c("Mass Spectrometry"),
type = c("[CHMO, CHMO:0000470, mass spectrometry, ]"),
description = c("Eluting compounds were detected ..."),
parameters = paste0("[MS, MS:1000008, ionization type, ",
"[MS,MS:1000073, electrospray ionization, ]]"))
## Example with all the fields and replace the previous
mtd <- setMtdProtocol(mtd, name = c("Mass Spectrometry", "extraction"),
type = c("[CHMO, CHMO:0000470, mass spectrometry, ]",
"[MSIO, MSIO:0000141, metabolite extraction,]"),
description = c("Eluting compounds were detected ...",
"Extraction using 80% methanol"),
parameters = list(c(paste0("[MS, MS:1000008, ionization type, ",
"[MS,MS:1000073, electrospray ionization, ]]"),
"param1.2"),
paste0("[MSIO, MSIO:0000107, quenching, ",
"[MSIO, MSIO:0000109, liquid nitrogen,]]")),
replace = TRUE)
getMtdProtocol(mtd)
#> protocol[1]-name
#> "Mass Spectrometry"
#> protocol[1]-type
#> "[CHMO, CHMO:0000470, mass spectrometry, ]"
#> protocol[1]-description
#> "Eluting compounds were detected ..."
#> protocol[1]-parameter[1]
#> "[MS, MS:1000008, ionization type, [MS,MS:1000073, electrospray ionization, ]]"
#> protocol[1]-parameter[2]
#> "param1.2"
#> protocol[2]-name
#> "extraction"
#> protocol[2]-type
#> "[MSIO, MSIO:0000141, metabolite extraction,]"
#> protocol[2]-description
#> "Extraction using 80% methanol"
#> protocol[2]-parameter[1]
#> "[MSIO, MSIO:0000107, quenching, [MSIO, MSIO:0000109, liquid nitrogen,]]"
