Skip to contents

Repository to translate spectra to queries.

Requirements

Here is what you minimally need:

  • A file containing MS/MS spectra with associated skeleton information (or any other relevant chemical classification) provided as metadata. This structure information, stored in the metadata field “skeleton”, allows the generation of queries specific to a given skeleton by extracting repetitive skeleton-specific fragmentation patterns. The MIADB file is provided as an example.

Installation

As the package is not (yet) available on CRAN, you will need to install with:

install.packages(
  "SpectraToQueries",
  repos = c(
    "https://spectra-to-knowledge.r-universe.dev",
    "https://bioc.r-universe.dev",
    "https://cloud.r-project.org"
  )
)

Use

To reproduce the example that uses the Monoterpene Indole Alkaloids Database (.mgf) file by default, which includes the annotation of spectral skeletons:

SpectraToQueries::spectra_to_queries()

To reproduce the “grouped” example that uses the MIADB file, which includes an expert-based annotation of spectral “super skeletons” (combination of skeletons exhibiting a high structural similarity):

SpectraToQueries::spectra_to_queries(
  spectra = system.file(
    "extdata",
    "spectra_grouped.rds",
    package = "SpectraToQueries"
  ),
  export = "data/interim/queries-grouped.tsv"
)

To generate diagnostic ions queries from your spectra:

SpectraToQueries::spectra_to_queries(
  spectra = "yourAwesomeSpectra.mgf",
  export = "path/yourEvenBetterResults.tsv"
)

Showing all parameters:

SpectraToQueries::spectra_to_queries(
  spectra = NULL,
  export = "data/interim/queries.tsv",
  beta_1 = 1.0,
  beta_2 = 0.5,
  dalton = 0.01,
  decimals = 4L,
  intensity_min = 0.0,
  ions_max = 10L,
  n_skel_min = 5L,
  n_spec_min = 3L,
  ppm = 30.0,
  fscore_min = 0.0,
  precision_min = 0.0,
  recall_min = 0.0,
  zero_val = 0.0
)

Main Citations

Translating community-wide spectral library into actionable chemical knowledge: a proof of concept with monoterpene indole alkaloids: https://doi.org/10.1186/s13321-025-01009-0

Others