SpectrumSimilarity {OrgMassSpecR}R Documentation

Similarity Between Two Mass Spectra

Description

Generate a head-to-tail plot of the two mass spectra and calculate a similarity score.

Usage

SpectrumSimilarity(spec.top, spec.bottom, t = 0.25, b = 10, 
                   top.label = NULL, bottom.label = NULL, 
                   xlim = c(50, 1200))

Arguments

spec.top data frame containing the experimental MS/MS peak list with the m/z values in the first column and corresponding intensities in the second
spec.bottom data frame containing the experimental MS/MS peak list with the m/z values in the first column and corresponding intensities in the second
t numeric value specifying the tolerance used to align the m/z values of the two spectra.
b numeric value specifying the baseline threshold for peak identification. Expressed as a percent of the maximum intensity.
top.label character string to label the top spectrum.
bottom.label character string to label the bottom spectrum.
xlim numeric vector of length 2, defining the beginning and ending values of the x-axis.

Details

The mass spectral similarity score is calculated as (where %*% is the dot product)

cos \theta = (u %*% v) / (sqrt(sum(u^2)) * sqrt(sum(v^2)))

where u and v are the aligned intensity vectors of the two spectra. The t argument is used to align the intensities. The bottom spectum is used as the reference spectrum, and the m/z values of peaks in the top spectrum that are within t of a reference m/z value are paired with that reference peak. Ideally, a single peak from the top spectrum should be paired with a single peak from the reference spectrum. Peaks without a match are paired with an intensity of zero. A data frame showing the aligned m/z values, peak intensities from the top spectrum, and peak intensities from the bottom spectrum, is printed in order to check the results. The unaligned spectra are shown in the plot.

Note that, although both are based on the cosine of the two intensity vectors, the spectral similarity score given by SpectrumSimilarity is not the same as that given by the NIST MS Search program, described in the reference below.

Value

A vector containing the similarity score. The data frame showing the peak alignment is printed.

Author(s)

Nathan G. Dodder

References

"Optimization and Testing of Mass Spectral Library Search Algorithms for Compound Identification," Stein SE, Scott DR, Journal of the American Society for Mass Spectrometry, 1994, 5, 859-866.

See Also

PeptideSpectrum

Examples

SpectrumSimilarity(alanineUnknownSpectrum, alanineAuthenticSpectrum,
                   top.label = "unknown, electron impact", 
                   bottom.label = "derivatized alanine, electron impact",
                   xlim = c(25, 350))
## label peaks
plot.window(xlim = c(25,350), ylim = c(-125, 125))
text(c(73, 147, 158, 232, 260), c(100, 23, 44, 22, 15) + 10,
     c(73, 147, 158, 232, 260), cex = 0.75)
text(c(73, 147, 158, 232, 260), -c(100, 47, 74, 33, 20) - 10, 
     c(73, 147, 158, 232, 260), cex = 0.75)
mtext("Spectrum similarity", line = 1)

[Package OrgMassSpecR version 0.1-9 Index]