Description Usage Arguments Details Value Author(s) Examples
Writes all spectra in the OrgMassSpecR data frame format to a single text file in NIST MSP format. The MSP files can be imported into the NIST MS Search program to make a custom seachable library.
1 | WriteMspFile(spectra, metadata, filename = "library.msp", comment = "")
|
spectra |
data frame containing the mass spectra. |
metadata |
data frame containing the metadata. |
filename |
character string. Name (including path if needed) of the MSP text file. |
comment |
charater string applied to the COMMENT field of the MSP file. The comment is applied to all spectra. |
The spectra and metadata data frame format is
specified in the help files for the LibraryReport
functions
in the spectral library packages, for example see
SpecLibExample::LibraryReport
. The spectra data frame must
contain at least columns: filename
, mz
, and
intensity
. The metadata data frame must contain at least columns: filename
and compound
.
The NAME field for each spectrum in the MSP file is assigned
based on compound
in the metadata data frame.
Newlines are CR+LF since the NIST MS Search program is Windows based.
An MSP file is written using a file
connection.
Nathan G. Dodder
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Simple example to illustrate the input data formats.
spectra <- data.frame(filename = c(rep("Spectrum A", 2), rep("Spectrum B", 2)),
mz = c(50, 51, 100, 101),
intensity = c(70, 71, 90, 91))
metadata <- data.frame(filename = c("Spectrum A", "Spectrum B"),
compound = c("Compound A", "Compound B"))
## Not run:
WriteMspFile(spectra = spectra,
metadata = metadata,
filename = "Test.txt",
comment = "Test Comment")
## End(Not run)
## Example using SpecLibExample package located at http://OrgMassSpec.github.io/libraries.html.
## Not run:
library(SpecLibExample)
WriteMspFile(spectra = spec,
metadata = meta,
comment = "example output")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.