R/9_construct_database.R
construct_mona_database.Rd
This function constructs a spectral database from MoNA (MassBank of North America) data, specifically formatted as a `databaseClass` object. The database contains metabolite information and MS2 spectral data for both positive and negative ionization modes.
construct_mona_database(
file,
only.remain.ms2 = TRUE,
path = ".",
version = "0.0.1",
source = "MoNA",
link = "https://mona.fiehnlab.ucdavis.edu/",
creater = "Xiaotao Shen",
email = "xiaotao.shen@outlook.com",
rt = FALSE,
threads = 5
)
A character string specifying the path to the MoNA data file (MSP format).
A logical value indicating whether to retain only the metabolites with MS2 spectra. Defaults to `TRUE`.
A character string specifying the path where the database will be saved. Defaults to the current working directory (`"."`).
A character string specifying the version of the database. Defaults to `"0.0.1"`.
A character string specifying the source of the database. Defaults to `"MoNA"`.
A character string specifying the URL of the source database. Defaults to `"https://mona.fiehnlab.ucdavis.edu/"`.
A character string specifying the creator of the database. Defaults to `"Xiaotao Shen"`.
A character string specifying the email of the creator. Defaults to `"xiaotao.shen@outlook.com"`.
A logical value indicating whether retention time (RT) information is available. Defaults to `FALSE`.
An integer specifying the number of threads to use for parallel processing. Defaults to `5`.
A `databaseClass` object containing the MoNA database, with metabolite information and MS2 spectral data.
The function reads MoNA data in MSP format and constructs a `databaseClass` object. It processes both positive and negative ionization modes and optionally filters out metabolites that do not have MS2 spectra if `only.remain.ms2` is set to `TRUE`.
The MoNA data is organized into metabolite information and corresponding MS2 spectra. The spectra are stored in the `Spectra.positive` and `Spectra.negative` slots based on their ionization modes.
if (FALSE) { # \dontrun{
# Construct a database from a MoNA file
mona_db <- construct_mona_database(file = "MoNA.msp", only.remain.ms2 = TRUE)
} # }