R/9_construct_database.R
construct_massbank_database.Rd
This function constructs a spectral database from MassBank data, specifically formatted as a `databaseClass` object. The database contains metabolite information and MS2 spectral data for both positive and negative ionization modes.
construct_massbank_database(
file,
only.remain.ms2 = TRUE,
path = ".",
version = "0.0.1",
source = "MassBank",
link = "https://massbank.eu/MassBank/",
creater = "Xiaotao Shen",
email = "xiaotao.shen@outlook.com",
rt = FALSE,
threads = 5
)
A character string specifying the path to the MassBank 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 `"MassBank"`.
A character string specifying the URL of the source database. Defaults to `"https://massbank.eu/MassBank/"`.
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 MassBank database, with metabolite information and MS2 spectral data.
The function reads MassBank 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 MassBank 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 MassBank file
massbank_db <- construct_massbank_database(file = "MassBank.msp", only.remain.ms2 = TRUE)
} # }