get_ms2_spectrum: Retrieve MS2 Spectrum from a Database

View source: R/8_databaseClass-methods.R

get_ms2_spectrumR Documentation

Retrieve MS2 Spectrum from a Database

Description

This function extracts the MS2 spectrum data for a specific metabolite from a 'databaseClass' object based on the provided Lab ID, polarity, and collision energy (CE).

Usage

get_ms2_spectrum(
  lab.id,
  database,
  polarity = c("positive", "negative"),
  ce = "30"
)

Arguments

lab.id

A character string representing the Lab ID of the metabolite whose MS2 spectrum is to be retrieved.

database

A 'databaseClass' object that contains the MS2 spectra data.

polarity

A character string specifying the polarity mode for the spectrum. It can be either '"positive"' or '"negative"'. Defaults to '"positive"'.

ce

A character string specifying the collision energy (CE) to retrieve. Defaults to '"30"'.

Details

The function retrieves the MS2 spectrum for a given Lab ID from the provided 'databaseClass' object. The user can specify the polarity mode (positive or negative) and the collision energy (CE) value to retrieve the correct spectrum. If the 'database' is not a valid 'databaseClass' object, the function stops with an error.

Value

A list containing the MS2 spectrum for the specified metabolite, polarity, and collision energy.

See Also

The example and demo data of this function can be found https://tidymass.github.io/metid/articles/metid.html

Examples

## Not run: 
# Assuming `db_instance` is an instance of `databaseClass`
spectrum <- get_ms2_spectrum(lab.id = "M123",
database = db_instance, polarity = "positive", ce = "30")

## End(Not run)


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