read_mgf_gnps: This function reads Mass Spectrometry (MS) data in MGF format...

View source: R/20_read_write_functions.R

read_mgf_gnpsR Documentation

This function reads Mass Spectrometry (MS) data in MGF format from GNPS, extracts the MS2 spectra, and returns it in a structured format.

Description

This function reads Mass Spectrometry (MS) data in MGF format from GNPS, extracts the MS2 spectra, and returns it in a structured format.

Usage

read_mgf_gnps(file, threads = 3)

Arguments

file

A character vector containing file paths to the MGF files from GNPS.

threads

Numeric, the number of threads to use for parallel processing. Defaults to '3'.

Details

The function parses MGF files from GNPS, a popular platform for metabolomics analysis. It extracts both the metadata and the MS2 spectra, and organizes the data into a structured format for further processing. Parallel processing is supported to speed up reading large files.

Value

A list where each element contains the MS2 spectra and related metadata for each entry in the MGF file. Each entry includes:

info

A data frame with metadata (such as m/z, retention time, etc.) for each spectrum.

spec

A data frame containing the 'mz' and 'intensity' values of the MS2 spectrum.

Author(s)

Xiaotao Shen xiaotao.shen@outlook.com

Examples

## Not run: 
# Read MGF data from GNPS
mgf_data <- read_mgf_gnps(file = c("path/to/mgf1.mgf", "path/to/mgf2.mgf"))

## End(Not run)


tidymass/metid documentation built on Oct. 8, 2024, 10:32 p.m.