getSimilarities: Match one spectrum against a set of spectra

View source: R/accessory_functions.R

getSimilaritiesR Documentation

Match one spectrum against a set of spectra

Description

getSimilarities calculates the similarities of one spectrum or neutral loss pattern to a set of other spectra or neutral loss patterns.

Usage

getSimilarities(spec, speclist, type = c("spectrum", "neutral_losses"),
    hits_only = FALSE)

Arguments

spec

The spectrum to be compared to other spectra. Can be either an object of class MS2spectrum or a two-column numerical matrix that contains fragment mass-to-charge ratios in the first and intensities in the second column.

speclist

The set of spectra to which spec is to be compared. Must be a list where every entry is an object of class MS2spectrum. Can be generated from an mzXML file with extractMS2spectra and mergeMS2spectra or constructed using new("MS2spectrum", ...) for every list entry (see vignette for details).

type

Specifies whether MS2 spectra or neutral loss patterns are to be compared. Must be either 'spectrum' (default) or 'neutral_losses'.

hits_only

Logical that indicates whether the result should contain only similarities greater than zero.

Value

A named vector with similarities of spec to all spectra or neutral loss patterns in speclist.

Examples

load(file = system.file("extdata",
    "annotatedSpeclist.RData",
    package = "CluMSIDdata"))
getSimilarities(annotatedSpeclist[[137]],
                annotatedSpeclist, hits_only = TRUE)


tdepke/CluMSID documentation built on April 10, 2022, noon