Skip to contents

Search for compounds in specified databases using mass-to-charge ratio, ion type, and mass tolerance.

Usage

search_by_mass(
  client,
  db,
  mz,
  ion_type,
  tolerance,
  format = "application/json"
)

Arguments

client

An mw_rest_client object

db

Character. Database to search ("MB", "LIPIDS", or "REFMET")

mz

Numeric. Mass-to-charge ratio

ion_type

Character. Ion type (e.g., "M+H", "M-H", "M+Na")

tolerance

Numeric. Mass tolerance in Daltons

format

Character. Output format ("json" or "txt")

Value

Tibble containing matching compounds(JSON) or character string(txt)

Examples

if (FALSE) { # \dontrun{
client <- mw_rest_client()

# Search for compounds with specific m/z
matches <- search_by_mass(client,
    db = "REFMET",
    mz = 180.063,
    ion_type = "M+H",
    tolerance = 0.01
)

# Search in lipids database
lipid_matches <- search_by_mass(client,
    db = "LIPIDS",
    mz = 760.585,
    ion_type = "M+H",
    tolerance = 0.05
)
} # }