write_msp_gnps: Write GNPS Spectra to MSP Format

View source: R/19_output_for_other_database.R

write_msp_gnpsR Documentation

Write GNPS Spectra to MSP Format

Description

This function writes MS2 spectra from a given 'databaseClass' object to MSP 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).

Usage

write_msp_gnps(database, path = ".")

Arguments

database

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

path

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

Details

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

Value

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

Author(s)

Xiaotao Shen xiaotao.shen@outlook.com

Examples

## Not run: 
# Write MSP data from a databaseClass object
write_msp_gnps(database = my_database, path = "output_directory")

## End(Not run)


tidymass/metid documentation built on Sept. 14, 2024, 4:43 p.m.