Reads MGF files and extracts the relevant MS2 spectra information. This function is tailored for database-oriented analyses.




A character vector specifying the path(s) to the MGF file(s).


A list containing processed MS2 spectra information for each provided MGF file. Each element of the list contains two components:

  • info: A data frame with columns for the name (composed of m/z and retention time), m/z, retention time, and file name.

  • spec: A data frame where each row represents a fragment ion peak, with columns for m/z and intensity values.

Empty spectra are removed from the output.


# Assuming 'sample.mgf' is the path to your MGF file.
# mgf_data <- read_mgf4database('sample.mgf')