spectral_matching {msPurity}R Documentation

Spectral matching

Description

Perform spectral matching to spectral libraries using dot product cosine on a LC-MS/MS dataset and link to XCMS features.

Usage

spectral_matching(target_db_pth, ra_thres_l = 0, ra_thres_t = 2,
  cores = 1, pol = "positive", ppm_tol_prod = 10, ppm_tol_prec = 5,
  score_thres = 0.6, topn = NA, db_name = NA, library_db_pth = NA,
  instrument_types = NA, library_sources = "massbank", scan_ids = NA,
  pa = NA, xset = NA, grp_peaklist = NA, out_dir = ".")

Arguments

target_db_pth

character; Path of the database of targets that will be searched against the library spectra. Generated either from frag4feature or from create_database functions.

ra_thres_l

numeric; Relative abundance threshold for library spectra

ra_thres_t

numeric; Relative abundance threshold for target spectra (Peaks below this RA threshold will be excluded)

cores

numeric; Number of cores to use

pol

character; Polarity ['positive' or 'negative']

ppm_tol_prod

numeric; PPM tolerance to match to product

ppm_tol_prec

numeric; PPM tolerance to match to precursor

score_thres

numeric; Dot product cosine score threshold

topn

numeric [optional]; Only use top n matches

db_name

character [optional]; Name of the result database (e.g. can use CAMERA peaklist)

library_db_pth

character [optional]; path to library spectral SQLite database. Defaults to msPurityData package data.

instrument_types

vector [optional]; Vector of instrument types, defaults to all

library_sources

vector [optional]; Vector of library sources. Default option is for massbank only but the 'lipidblast' library is also available

scan_ids

vector [optional]; Vector of unique scan ids calculated from msPurity "pid". These scans will on used for the spectral matching. All scans will be used if set to NA

pa

purityA object [deprecated]; If target_db_pth set to NA, a new database can be created using pa, xset and grp_peaklist

xset

xcms object [deprecated]; If target_db_pth set to NA, a new database can be created using pa, xset and grp_peaklist

grp_peaklist

dataframe [deprecated]; If target_db_pth set to NA, a new database can be created using pa, xset and grp_peaklist

out_dir

character [deprecated]; If target_db_pth set to NA, Out directory for the SQLite result database

Value

list of database details and dataframe summarising the results for the xcms features

Examples

msmsPths <- list.files(system.file("extdata", "lcms", "mzML", package="msPurityData"), full.names = TRUE, pattern = "MSMS")
xset <- xcms::xcmsSet(msmsPths, nSlaves = 1)
xset <- xcms::group(xset)
xset <- xcms::retcor(xset)
xset <- xcms::group(xset)

pa  <- purityA(msmsPths)
pa <- frag4feature(pa, xset, create_db=TRUE)
#NOTE that scan_ids here are refer the unique scan id calculated by purityA (pids).
#Only required if you want to limit the spectral matching to certain scans
result <- spectral_matching(pa@db_path, scan_ids = c(1120,  366, 1190, 601,  404,1281, 1323, 1289))

[Package msPurity version 1.8.1 Index]