Description Usage Arguments Details Value Note Author(s) References See Also Examples
Writes a MassBank record in list format to a text array.
1 | toMassbank(mbdata)
|
mbdata |
A MassBank record in list format. |
The function is a general conversion tool for the MassBank format; i.e. the
field names are not fixed. mbdata
must be a named list, and the
entries can be as follows:
A single text line:
'CH\$EXACT_MASS' = '329.1023'
is written as
CH\$EXACT_MASS: 329.1023
A character array:
'CH\$NAME' = c('2-Aminobenzimidazole', '1H-Benzimidazol-2-amine')
is written as
CH\$NAME: 2-Aminobenzimidazole
CH\$NAME: 1H-Benzimidazol-2-amine
A named list of strings:
'CH\$LINK' = list('CHEBI' = "27822", "KEGG" = "C10901")
is written as
CH\$LINK: CHEBI 27822
CH\$LINK: KEGG C10901
A data frame (e.g. the peak table) is written as specified in the MassBank record format (Section 2.6.3): the column names are used as headers for the first line, all data rows are printed space-separated.
The result is a text array, which is ready to be written to the disk as a file.
The function iterates over the list item names. This means that
duplicate entries in mbdata
are (partially) discarded! The correct
way to add them is by making a character array (as specified above): Instead
of 'CH\$NAME' = 'bla', 'CH\$NAME' = 'blub'
specify 'CH\$NAME' =
c('bla','blub')
.
Michael Stravs
MassBank record format: http://www.massbank.jp/manuals/MassBankRecord_en.pdf
1 2 3 4 5 6 7 8 9 | ## Not run:
# Read just the compound info skeleton from the Internet for some compound ID
id <- 35
mbdata <- gatherData(id)
#' # Export the mbdata blocks to line arrays
# (there is no spectrum information, just the compound info...)
mbtext <- toMassbank(mbdata)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.