This function calculates the dot product score between experimental and library MS2 spectra intensities. It weights the intensities and computes the similarity score using a modified dot product formula.

calculate_dotproduct(exp.int, lib.int)

Arguments

exp.int

A numeric vector of intensities from the experimental spectrum.

lib.int

A numeric vector of intensities from the library spectrum.

Value

A numeric value representing the dot product similarity score between the experimental and library spectra.

Details

The function applies a custom weighting scheme to the experimental and library intensities, where the weight for each intensity value is computed based on its proportion relative to the total sum of intensities in its respective spectrum. The weighted intensities are then used to calculate the dot product score, which is normalized to give a similarity score between the two spectra.

Author

Xiaotao Shen xiaotao.shen@outlook.com

Examples

calculate_dotproduct(exp.int = 1:10, lib.int = 1:10)
#> [1] 1