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
)

Arguments

file

A character string specifying the path to the MoNA 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 `"MoNA"`.

A character string specifying the URL of the source database. Defaults to `"https://mona.fiehnlab.ucdavis.edu/"`.

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 MoNA database, with metabolite information and MS2 spectral data.

Details

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.

Examples

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