
Add, update or get instrument metadata of an mzTab-M MTD section
Source:R/MTD.R
setMtdInstrument.RdsetMtdInstrument() sets or updates instrument-related metadata fields
within an MTD (metadata) section. When instrument metadata already exists,
the function can either replace it entirely or append new values to the
existing ones.
getMtdInstrument() returns the instrument 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 the name of the instrument used in the experiment. (e.g.,"[MS, MS:1000449, LTQ Orbitrap,]").- source
characterwith the instrument’s source used in the experiment. (e.g.,"[MS, MS:1000073, ESI,]").- analyzer
characterwith the instrument’s analyzer type(s) used in the experiment. Must be provided in the formc("analyzer[1]" = "[MS, MS:1000291, linear ion trap,]")for a single analyzer, orc("analyzer[1]" = "<analyzer 1>", "analyzer[2] = ...")for multiple analyzers.- detector
characterwith the instrument’s detector type used in the experiment. (e.g.,"[MS, MS:1000253, electron multiplier,]").- replace
logicalflag controlling how pre-existing instrument 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
setMtdInstrument(): the input objectxupdated to include the new or merged instrument metadata fields. Ifxis empty, the emptyx.For
getMtdInstrument(): a namedcharacterwith the instrument information, names being the field names.
Examples
x <- mtdSkeleton("001", software = "[MS, MS:1001582, xmcs, 4.0.0]")
## Add instrument metadata to an existing mzTab object
mtd <- setMtdInstrument(x, name = "[MS, MS:1000449, LTQ Orbitrap,]",
source = "[MS, MS:1000073, ESI,]",
analyzer = c(`analyzer[1]` = "[MS, MS:1000291, linear ion trap,]"),
detector = "[MS, MS:1000253, electron multiplier,]")
## Replace all existing instrument metadata
mtd <- setMtdInstrument(mtd, name = "[MS, MS:1000449, LTQ Orbitrap,]",
source = "[MS, MS:1000073, ESI,]",
analyzer = c(`analyzer[1]` = "[MS, MS:1000291, linear ion trap,]"),
detector = "[MS, MS:1000253, electron multiplier,]",
replace = TRUE)
x <- mtdSkeleton("001", software = "[MS, MS:1001582, xcms, 4.0.0]")
mtd <- setMtdInstrument(x, name = "[MS, MS:1000449, LTQ Orbitrap,]",
source = "[MS, MS:1000073, ESI,]",
analyzer = c(`analyzer[1]` = "[MS, MS:1000291, linear ion trap,]"),
detector = "[MS, MS:1000253, electron multiplier,]")
getMtdInstrument(mtd)
#> instrument[1]-name
#> "[MS, MS:1000449, LTQ Orbitrap,]"
#> instrument[1]-source
#> "[MS, MS:1000073, ESI,]"
#> instrument[1]-analyzer[1]
#> "[MS, MS:1000291, linear ion trap,]"
#> instrument[1]-detector
#> "[MS, MS:1000253, electron multiplier,]"