View source: R/19_output_for_other_database.R
write_mgf_gnps | R Documentation |
This function writes MS2 spectra from a given 'databaseClass' object to MGF format files for both positive and negative ion modes. The spectra are written separately for each ion mode, following the format required for GNPS (Global Natural Products Social Molecular Networking).
write_mgf_gnps(database, path = ".")
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 ('"."'). |
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, retention time, and the corresponding MS2 spectrum in the required GNPS format.
This function does not return any value. It writes MGF files for positive and negative mode spectra in the specified directory.
Xiaotao Shen xiaotao.shen@outlook.com
## Not run:
# Write MGF data from a databaseClass object
write_mgf_gnps(database = my_database, path = "output_directory")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.