Skip to contents

Expected adduct m/z values are generated once, sorted, and queried by binary interval search. This is the one-dimensional equivalent of an interval tree and avoids scanning every database row for every observed peak.

Usage

BuildMZAnnotationIndex(
  db,
  polarity = NULL,
  adducts = NULL,
  rules = NULL,
  maldi_matrix = NULL,
  collapse_isomers = TRUE,
  infer_structure = c("auto", "never", "always"),
  structure_backend = c("auto", "native"),
  structure_workers = getOption("SpaMTP.smiles_workers", 1L),
  min_structure_score = 0.05
)

Arguments

db

Metabolite database. Both the legacy SpaMTP five-column/wide database and the RaMP chem_props schema are supported.

polarity

"positive", "negative", or "neutral". When NULL, use the matrix-profile default, or positive mode when no profile is given.

adducts

Optional character vector of adduct names or bracketed notations. When NULL, use the complete automatically selected rule space; this is a filter, not a compulsory input.

rules

Optional custom rule table. See AdductRules().

maldi_matrix

Optional MALDI matrix or derivatization reagent profile. When supplied and rules is NULL, MALDIMatrixRules() automatically selects standard and validated matrix-specific rules. adducts remains an optional filter on that selected rule space.

collapse_isomers

Collapse records sharing formula, exact mass, and proton bound before indexing.

infer_structure

"auto" joins bundled precomputed features or derives them for at most getOption("SpaMTP.max_runtime_smiles", 5000) unique SMILES, "never" disables inference, and "always" forces runtime parsing and replaces precomputed structural fields.

structure_backend

SMILES parser used by DeconvolveSMILES().

structure_workers

Number of workers used for runtime SMILES parsing.

min_structure_score

Minimum rule-specific structural prior retained before m/z indexing. Set to zero to rank without structure-based pruning.

Value

An object of class spamtp_mz_index.

Examples

utils::str(formals(BuildMZAnnotationIndex))
#> Dotted pair list of 10
#>  $ db                 : symbol 
#>  $ polarity           : NULL
#>  $ adducts            : NULL
#>  $ rules              : NULL
#>  $ maldi_matrix       : NULL
#>  $ collapse_isomers   : logi TRUE
#>  $ infer_structure    : language c("auto", "never", "always")
#>  $ structure_backend  : language c("auto", "native")
#>  $ structure_workers  : language getOption("SpaMTP.smiles_workers", 1L)
#>  $ min_structure_score: num 0.05