Prepare libraries of spectra

Description

Prepares spectral libraries for matching by importing, harmonizing, and splitting spectra by polarity. Exports results as Spectra RDS files (pos/neg) and a structure-organism pair (SOP) table.

Usage

prepare_libraries_spectra(
  input = get_params(step = "prepare_libraries_spectra")\$files\$libraries\$spectral\$raw,
  nam_lib = get_params(step = "prepare_libraries_spectra")\$names\$libraries,
  col_ad = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$adduct,
  col_ce = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$collision_energy,
  col_ci = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$compound_id,
  col_em = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$exact_mass,
  col_in = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$inchi,
  col_io = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$inchi_no_stereo,
  col_ik = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$inchikey,
  col_il = get_params(step =
    "prepare_libraries_spectra")\$names\$mgf\$inchikey_connectivity_layer,
  col_mf = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$molecular_formula,
  col_na = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$name,
  col_po = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$polarity,
  col_sm = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$smiles,
  col_sn = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$smiles_no_stereo,
  col_si = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$spectrum_id,
  col_sp = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$splash,
  col_sy = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$synonyms,
  col_xl = get_params(step = "prepare_libraries_spectra")\$names\$mgf\$xlogp
)

Arguments

input character Character vector of file paths containing spectral data.
nam_lib character Character library name for metadata.
col_ad character Name of the adduct column in MGF.
col_ce character Name of the collision energy column in MGF.
col_ci character Name of the compound ID column in MGF.
col_em character Name of the exact mass column in MGF.
col_in character Name of the InChI column in MGF.
col_io character Name of the InChI without stereo column in MGF.
col_ik character Name of the InChIKey column in MGF.
col_il character Name of the InChIKey connectivity layer column in MGF.
col_mf character Name of the molecular formula column in MGF.
col_na character Name of the name column in MGF.
col_po character Name of the polarity column in MGF.
col_sm character Name of the SMILES column in MGF.
col_sn character Name of the SMILES without stereo column in MGF.
col_si character Name of the spectrum ID column in MGF.
col_sp character Name of the SPLASH column in MGF.
col_sy character Name of the synonyms column in MGF.
col_xl character Name of the xlogp column in MGF.

Details

This function:

  • Checks if output files already exist (idempotent).

  • Imports spectral data from input files.

  • Extracts and harmonizes spectra for positive and negative modes.

  • Fixes precursor m/z and InChIKey connectivity layer issues.

  • Exports polarity-specific Spectra objects and SOP table.

  • Returns empty templates if input files are missing.

Value

Character vector with paths to prepared library files (invisible).

See Also

Other preparation: prepare_annotations_gnps(), prepare_annotations_mzmine(), prepare_annotations_sirius(), prepare_annotations_spectra(), prepare_features_components(), prepare_features_edges(), prepare_features_tables(), prepare_libraries_rt(), prepare_libraries_sop_bigg(), prepare_libraries_sop_closed(), prepare_libraries_sop_ecmdb(), prepare_libraries_sop_hmdb(), prepare_libraries_sop_lotus(), prepare_libraries_sop_merged(), prepare_params(), prepare_taxa()

Examples

library("tima")

copy_backbone()
go_to_cache()
prepare_libraries_spectra()
unlink("data", recursive = TRUE)