Spectral similarity

dotProd(ms2A, ms2B, mzTol=0.02)

Calculate the MS2 spectral similarity by dot product.

Parameters:
  • ms2A – a ms2Spectrum object. The first MS2.

  • ms2B – a ms2Spectrum object. The second MS2.

  • mzTol – float. Tolerance of the m/z difference in Da. Default is 0.02.

Returns:

float. The dot product similarity score between the two MS2 spectra. Returns 2.0 if either MS2 does not exist.

To use this function:

dp = dotProd(ms2A, ms2B)
print(dp)