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
)

Arguments

file

A character string specifying the path to the MassBank data file (MSP format).

only.remain.ms2

A logical value indicating whether to retain only the metabolites with MS2 spectra. Defaults to `TRUE`.

path

A character string specifying the path where the database will be saved. Defaults to the current working directory (`"."`).

version

A character string specifying the version of the database. Defaults to `"0.0.1"`.

source

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/"`.

creater

A character string specifying the creator of the database. Defaults to `"Xiaotao Shen"`.

email

A character string specifying the email of the creator. Defaults to `"xiaotao.shen@outlook.com"`.

rt

A logical value indicating whether retention time (RT) information is available. Defaults to `FALSE`.

threads

An integer specifying the number of threads to use for parallel processing. Defaults to `5`.

Value

A `databaseClass` object containing the MassBank database, with metabolite information and MS2 spectral data.

Details

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.

Examples

if (FALSE) { # \dontrun{
# Construct a database from a MassBank file
massbank_db <- construct_massbank_database(file = "MassBank.msp", only.remain.ms2 = TRUE)
} # }