library_similarity: Matching query spectrum to existing library

View source: R/library_similarity.R

library_similarityR Documentation

Matching query spectrum to existing library

Description

The function searches unknown MS/MS spectra in a spectral library

Usage

library_similarity(library, query_spectrum = NULL,
  method = c("Fragment", "Simple", "All", "Cosine"), prec_mz = 0,
  use.prec = FALSE, ppm_search = 20, relative = 1, mirror.plot = T,
  png.out = F)

Arguments

library

A list generated by the function library_generator() or the name of mgf spectral library file

query_spectrum

Two-column data matrix. Two columns represent m/z and intensity of query tandem spectrum

method

Character. Method to compare the similarity between query spectrum and library spectra.

  • Fragment: Counting only number of fragment matches

  • Simple: Conting number of fragment and neutral loss matches

  • All: Conting number of fragment, neutral loss and mass differences matches.

  • Cosine: cosine similarity score from OrgMassSpecR package.

prec_mz

Numeric. Precursor mass of query spectrum (if known). Default value is 0. Must NOT be 0 if method = "All" or use.prec = TRUE (see below)

use.prec

Boolean. If set to TRUE, precursor mass is used to "pre-query" the library

ppm_search

Numeric. Mass tolerance in ppm for precursor/fragment search.

relative

Numeric between 0 and 100. The relative intensity threshold of the highest peak in each spectrum). Peaks in query spectrum below relative thresholds are not taken into account.

mirror.plot

Boolean. True if the query-library comparison is visualized as mirror plot

png.out

Boolean. True if plotted mirror spectra are exported as png images!

Value

  • <plot>: Comparing query spectrum to ordered "hits" in the spectrum library

  • SELECTED: Library object that contain found scans.

  • ID_SELECTED: IDs of found compounds.

  • SCORES: Similarity scores between query spectrum and each

Author(s)

Youzhong Liu, Youzhong.Liu@uantwerpen.be

Examples


data(DRUG_THERMO_LIBRARY)
dat = cbind(c(136.073,149.071,151.0991,180.047),c(1,1,20,3))
query = library_similarity(library2, dat, method = "Cosine", prec_mz = 0, use.prec =FALSE, ppm_search = 20, relative = 1, mirror.plot = F)

# Query-library comparison via mirror plot:
library_visualizer_similarity(query$SELECTED, id= query$ID_SELECTED[1], query_spectrum = dat)


daniellyz/MergeION documentation built on Oct. 19, 2022, 1:56 p.m.