cossim: Calculate cosine similarity between two spectra

Description Usage Arguments Value Methods (by class) Examples

View source: R/classes_methods.R

Description

cossim() calculates the cosine of the spectral constrast angle as a measure for the similarity of two spectra.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cossim(x, y, type = c("spectrum", "neutral_losses"),
    mzTolerance = 1e-05)

## S4 method for signature 'MS2spectrum,MS2spectrum'
cossim(x, y, type = c("spectrum",
    "neutral_losses"), mzTolerance = 1e-05)

## S4 method for signature 'pseudospectrum,pseudospectrum'
cossim(x, y,
    type = c("spectrum", "neutral_losses"), mzTolerance = 1e-05)

Arguments

x, y

MS2 spectra, either as matrix, MS2spectrum or pseudospectrum objects. x and y must have the same class.

type

Whether similarity between spectra ("spectrum", default) or neutral loss patterns ("neutral_losses") is to be compared

mzTolerance

The m/z tolerance used for merging. If two fragment peaks are within tolerance, they are regarded as the same. Defaults to 1e-5, i.e. 10ppm.

Value

The cosine similarity of x and y

Methods (by class)

Examples

1
2
3
4
5
load(file = system.file("extdata",
    "annotatedSpeclist.RData",
    package = "CluMSIDdata"))

cossim(annotatedSpeclist[[1]], annotatedSpeclist[[2]])

CluMSID documentation built on Nov. 8, 2020, 7:46 p.m.