Skip to contents

Helper function for AnnotateSM() and FishersPathwayAnalysis().

Usage

annotateTable(
  mz_df,
  db = NULL,
  ppm_error = NULL,
  adducts = NULL,
  polarity = NULL,
  tof_resolution = 30000,
  verbose = TRUE,
  index = NULL,
  rules = NULL,
  ms1_spectrum = NULL,
  use_mass_defect = TRUE,
  check_isotopes = TRUE,
  check_adduct_network = TRUE,
  min_score = 0,
  maldi_matrix = NULL,
  database_version = "latest",
  database_source = c("auto", "bundled", "local"),
  database_local_dir = NULL,
  infer_structure = c("auto", "never", "always"),
  structure_backend = c("auto", "native"),
  structure_workers = getOption("SpaMTP.smiles_workers", 1L),
  min_structure_score = 0.05
)

Arguments

mz_df

dataframe containing m/z values for annotation.

db

Reference metabolite dataset in the form of a data.frame. May be NULL when index is supplied.

ppm_error

Mass tolerance in ppm. If NULL, a strict 5 ppm maximum is used (or a smaller value inferred from tof_resolution). Set to zero for exact numerical matches.

adducts

Optional adduct names/notations; see AdductRules(). If NULL, use the complete rule space selected from maldi_matrix, or all validated general rules for the selected polarity when no matrix is given.

polarity

Character string defining the ion mode. When NULL, infer it from a supplied index or MALDI matrix profile, otherwise use positive.

tof_resolution

Instrument resolving power retained for compatibility; it can only tighten, not widen, the default 5 ppm mass-accuracy threshold.

verbose

Boolean indicating whether to show the message. If TRUE the message will be show, else the message will be suppressed (default = TRUE).

index

Optional reusable index created by BuildMZAnnotationIndex().

rules

Optional custom adduct rule table; see AdductRules().

ms1_spectrum

Optional contextual MS1 spectrum with mz and intensity columns for isotope and adduct-family scoring.

use_mass_defect

Apply the CHO negative mass-defect penalty.

check_isotopes

Score carbon-13 and halogen isotope evidence when a contextual spectrum is supplied.

check_adduct_network

Downweight complex ions whose base monomer family is absent from the contextual spectrum.

min_score

Minimum final annotation score to retain.

maldi_matrix

Optional MALDI matrix/reagent profile used for automatic rule selection. adducts = NULL keeps the complete selected rule space.

database_version

Database snapshot version used when db = NULL.

database_source

Database source used when db = NULL; see LoadSpaMTPDatabase().

database_local_dir

Optional local RDS resource directory.

infer_structure

"auto" joins bundled precomputed structure features when possible, "never" disables inference, and "always" parses missing structures at runtime.

structure_backend

SMILES parser passed to DeconvolveSMILES().

structure_workers

Number of workers used for runtime SMILES parsing.

min_structure_score

Minimum rule-specific structural prior retained during candidate-index construction.

Value

Generates an intermediate annotated m/z dataframe

Examples


### HelperFunction