Metabolomics Society Forum

Software => R => RMassBank => Topic started by: Jan Stanstrup on October 28, 2016, 01:48:05 AM

Title: parser for massbank record --> R (list)
Post by: Jan Stanstrup on October 28, 2016, 01:48:05 AM
RMassBank first creates a list structure for the info that goes in the RMassBank record, but is there a way to go the other way?
--> A parser to read the RMassBank txt files into an R friendly structure.
Title: Re: parser for massbank record --> R (list)
Post by: meow on November 21, 2016, 04:04:41 AM
The newest, cutting edge RMassBank version does this.

install_github("MassBank/RMassBank@s4power")
RMassBank:::parseMbRecord(filename)
parses a massbank record to  a RmbSpectrum2 object
RMassBank:::parseMbRecords(filenames)
parses multiple files into a list of RmbSpectraSet objects (i.e. it groups the spectra by compound)

(yes it's not even exported yet - I just wrote it a week ago. Also, in the older RMassBank versions, there is parseMassBank which also parses MassBank records, but not into the "native" RMassBank/MSnbase format. parseMassBank will be replaced by parseMbRecord(s) soon, i.e. parseMbRecord(s) will be renamed to parseMassBank and will be an S4 method.)