This function reads Mass Spectrometry (MS) data in MSP format, processes the data, and extracts MS2 spectra along with metadata (such as m/z and retention time) from the file. It supports handling MSP data from different sources and formats.
read_msp(file, threads = 3)
A list where each element contains:
A list with metadata for each spectrum, typically containing `mz` (mass-to-charge ratio) and `rt` (retention time).
A data frame with the `mz` and `intensity` values of the MS2 spectrum.
The function parses MSP files to extract both metadata and the MS2 spectra, organizing the data into a structured format for further analysis. It handles both regular MSP formats and those generated by the MetAnalyzer software, which require some additional processing.
if (FALSE) { # \dontrun{
# Read MSP data
msp_data <- read_msp(file = "path/to/data.msp")
} # }