View source: R/8_databaseClass-methods.R
get_ms2_spectrum | R Documentation |
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).
get_ms2_spectrum(
lab.id,
database,
polarity = c("positive", "negative"),
ce = "30"
)
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"'. |
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.
A list containing the MS2 spectrum for the specified metabolite, polarity, and collision energy.
The example and demo data of this function can be found https://tidymass.github.io/metid/articles/metid.html
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.