This function writes positive and negative mode MS2 spectra from a given `databaseClass` object to MGF format files. The spectra are written separately for positive and negative ionization modes.

write_mgf_massbank(database, path = ".")

Arguments

database

An object of class `databaseClass` containing spectral data and metadata.

path

A character string specifying the directory where the MGF files will be written. Defaults to the current directory (`"."`).

Value

This function does not return any value. It writes MGF files for positive and negative mode spectra in the specified directory.

Details

This function extracts the spectra from a `databaseClass` object and writes them into MGF files. The positive mode spectra are written to `spectra_pos.mgf` and the negative mode spectra are written to `spectra_neg.mgf`. Each entry in the MGF file includes information such as the compound name, precursor type, ion mode, collision energy, and the corresponding MS2 spectrum.

Author

Xiaotao Shen xiaotao.shen@outlook.com

Examples

if (FALSE) { # \dontrun{
# Write MGF data from a databaseClass object
write_mgf_massbank(database = my_database, path = "output_directory")
} # }