normalizeddotproduct: Calculate the normalized dot product

Description Usage Arguments Details Value Author(s) Examples

View source: R/similarity.R

Description

Calculate the normalized dot product (NDP)

Usage

1
normalizeddotproduct(x, y, m = 0.5, n = 2, ...)

Arguments

x

'Spectrum2' object from 'MSnbase' containing intensity and m/z values, first MS/MS spectrum

y

'Spectrum2' object from 'MSnbase' containing intensity and m/z values, second MS/MS spectrum

m

'numeric', exponent to calculate peak intensity-based weights

n

'numeric', exponent to calculate m/z-based weights

...

further arguments passed to MSnbase:::bin_Spectra

Details

The normalized dot product is calculated according to the following formula:

∑(W_{S1, i} \cdot W_{S2, i}) ^ 2 ∑(W_{S1, i} ^ 2) * ∑(W_{S2, i} ^ 2)

, with W = [peak intensity]^{m} \cdot [m/z]^n. For further information see Li et al. (2015): Navigating natural variation in herbivory-induced secondary metabolism in coyote tobacco populations using MS/MS structural analysis. PNAS, E4147–E4155. 'normalizeddotproduct' returns a numeric value ranging between 0 and 1, where 0 indicates no similarity between the two MS/MS features, while 1 indicates that the MS/MS features are identical. Arguments can be passed to the function 'MSnbase:::bin_Spectra', e.g. to set the width of bins (binSize). Prior to calculating

W_{S1}

or

W_{S2}

, all intensity values are divided by the maximum intensity value.

Value

'normalizeddotproduct' returns a numeric similarity coefficient between 0 and 1

Author(s)

Thomas Naake, thomasnaake@googlemail.com

Examples

1
2
3
4
data("spectra", package = "MetCirc")
x <- spectra_tissue[[1]]
y <- spectra_tissue[[2]]
normalizeddotproduct(x, y, m = 0.5, n = 2, binSize = 0.01)

MetCirc documentation built on Nov. 8, 2020, 8:26 p.m.