Learn R Programming

RMassBank (version 2.0.0)

toMassbank: Write MassBank record into character array

Description

Writes a MassBank record in list format to a text array.

Usage

toMassbank(mbdata)

Arguments

mbdata
A MassBank record in list format.

Value

The result is a text array, which is ready to be written to the disk as a file.

Details

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.

References

MassBank record format: http://www.massbank.jp/manuals/MassBankRecord_en.pdf

See Also

compileRecord, mbWorkflow

Examples

Run this code
## 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)

Run the code above in your browser using DataLab