extract_ms2_database: Extract MS2 Spectra from a Database

View source: R/6_zzz.R

extract_ms2_databaseR Documentation

Extract MS2 Spectra from a Database

Description

This function extracts MS2 spectra from a 'databaseClass' object based on the specified polarity and collision energy (CE) values. It supports both positive and negative ionization modes, and allows users to filter by specific CE values or use all available CE values in the database.

Usage

extract_ms2_database(
  database,
  polarity = c("positive", "negative"),
  ce = "all"
)

Arguments

database

A 'databaseClass' object containing MS2 spectra data.

polarity

Character. The ionization mode, either '"positive"' or '"negative"'. Default is '"positive"'.

ce

Character or vector. The collision energy (CE) values to extract MS2 spectra for. Set to '"all"' to use all CE values in the database. Default is '"all"'.

Details

The function checks the polarity and collision energy values against the available data in the provided 'databaseClass' object. It extracts MS2 spectra corresponding to the specified polarity and filters them based on the given CE values. If the 'ce' argument is set to '"all"', all CE values in the database are used. If none of the requested CE values are available, the function returns 'NULL'.

Value

A list containing the extracted MS2 spectra for the specified polarity and CE values. If no matching spectra are found, the function returns 'NULL'.

Examples

## Not run: 
# Load a database
my_database <- load_database("path/to/database")

# Extract all MS2 spectra in positive ion mode
ms2_spectra <- extract_ms2_database(database = my_database,
polarity = "positive", ce = "all")

# Extract MS2 spectra for specific CE values in negative ion mode
ms2_spectra <- extract_ms2_database(database = my_database,
polarity = "negative", ce = c("10", "20"))

## End(Not run)



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