WriteMsp {mssearchr}R Documentation

Write mass spectra in an msp-file (NIST format)

Description

Write mass spectra in an msp-file (NIST format).

Usage

WriteMsp(msp_objs, output_file, fields = NULL)

Arguments

msp_objs

A list of nested lists. Each nested list is a mass spectrum. Each nested list must contain at least three elements: (1) name (a string) - compound name (or short description); (2) mz (a numeric/integer vector) - m/z values of mass spectral peaks; (3) intst (a numeric/integer vector) - intensities of mass spectral peaks.

output_file

A string. The name of a file.

fields

A character vector. Names of elements in an R list (not the original field names from an msp-file) to be exported. For example, if only CAS number is needed to be exported, the 'cas_no' (not 'cas#') should be passed. If NULL, all fields are exported. The output file always contains the 'Name' field, the 'Num Peaks' field, and the mass/intensity list.

Details

Names of all fields are exported in lower case. It does not cause any problem in the case of the MS Search (NIST) software (however correct operation with other software products has not been tested). Only in a few cases hash symbols and spaces are restored:

Value

NULL is returned.

Examples



# Exporting mass spectra
# Only 'Name', 'SMILES', 'Formula', and 'Num Peaks' fields are exported.
WriteMsp(massbank_alkanes[1:3], "test.msp", fields = c("smiles", "formula"))



[Package mssearchr version 0.1.1 Index]