OpenMS
Loading...
Searching...
No Matches
OpenSwath::Scoring Namespace Reference

Scoring functions used by MRMScoring. More...

Classes

struct  pair_hash
 Simple hash function for Scoring::pos2D. More...
 
struct  XCorrArrayType
 

Typedefs

Type defs and helper structures
typedef std::pair< unsigned int, unsigned int > pos2D
 
typedef std::pair< int, double > XCorrEntry
 Cross Correlation array contains (lag,correlation) pairs.
 

Functions

Helper functions
OPENSWATHALGO_DLLAPI double NormalizedManhattanDist (double x[], double y[], int n)
 Calculate the normalized Manhattan distance between two arrays.
 
OPENSWATHALGO_DLLAPI double NormalizedManhattanDist (std::vector< double > &x, std::vector< double > &y)
 Calculate the normalized Manhattan distance between two vectors.
 
OPENSWATHALGO_DLLAPI double RootMeanSquareDeviation (double x[], double y[], int n)
 Calculate the RMSD (root means square deviation)
 
OPENSWATHALGO_DLLAPI double RootMeanSquareDeviation (const std::vector< double > &x, const std::vector< double > &y)
 Calculate the RMSD between two vectors.
 
OPENSWATHALGO_DLLAPI double SpectralAngle (double x[], double y[], int n)
 Calculate the Spectral angle (acosine of the normalized dotproduct)
 
OPENSWATHALGO_DLLAPI double SpectralAngle (const std::vector< double > &x, const std::vector< double > &y)
 Calculate the Spectral angle between two vectors.
 
OPENSWATHALGO_DLLAPI XCorrArrayType calcxcorr_legacy_mquest_ (std::vector< double > &data1, std::vector< double > &data2, bool normalize)
 
OPENSWATHALGO_DLLAPI XCorrArrayType normalizedCrossCorrelation (std::vector< double > &data1, std::vector< double > &data2, const int maxdelay, const int lag)
 
OPENSWATHALGO_DLLAPI XCorrArrayType normalizedCrossCorrelationPost (std::vector< double > &normalized_data1, std::vector< double > &normalized_data2, const int maxdelay, const int lag)
 Calculate crosscorrelation on std::vector data that is already normalized.
 
OPENSWATHALGO_DLLAPI XCorrArrayType calculateCrossCorrelation (const std::vector< double > &data1, const std::vector< double > &data2, const int maxdelay, const int lag)
 Calculate crosscorrelation on std::vector data without normalization.
 
OPENSWATHALGO_DLLAPI XCorrArrayType::const_iterator xcorrArrayGetMaxPeak (const XCorrArrayType &array)
 Find best peak in an cross-correlation (highest apex)
 
OPENSWATHALGO_DLLAPI void standardize_data (std::vector< double > &data)
 Standardize a vector (subtract mean, divide by standard deviation)
 
OPENSWATHALGO_DLLAPI void normalize_sum (double x[], unsigned int n)
 Divide each element of x by the sum of the vector.
 
OPENSWATHALGO_DLLAPI void normalize_sum (std::vector< double > &x)
 Divide each element of x by the sum of the vector.
 
OPENSWATHALGO_DLLAPI unsigned int computeAndAppendRank (const std::vector< double > &v, std::vector< unsigned int > &ranks)
 
OPENSWATHALGO_DLLAPI std::vector< unsigned int > computeRankVector (const std::vector< std::vector< double > > &intensity, std::vector< std::vector< unsigned int > > &ranks)
 
OPENSWATHALGO_DLLAPI double rankedMutualInformation (std::vector< unsigned int > &ranked_data1, std::vector< unsigned int > &ranked_data2, const unsigned int max_rank1, const unsigned int max_rank2)
 

Detailed Description

Scoring functions used by MRMScoring.

Many helper functions to calculate cross-correlations between data

Typedef Documentation

◆ pos2D

typedef std::pair<unsigned int, unsigned int> pos2D

◆ XCorrEntry

typedef std::pair<int, double> XCorrEntry

Cross Correlation array contains (lag,correlation) pairs.

Function Documentation

◆ calculateCrossCorrelation()

OPENSWATHALGO_DLLAPI XCorrArrayType calculateCrossCorrelation ( const std::vector< double > &  data1,
const std::vector< double > &  data2,
const int  maxdelay,
const int  lag 
)

Calculate crosscorrelation on std::vector data without normalization.

◆ calcxcorr_legacy_mquest_()

OPENSWATHALGO_DLLAPI XCorrArrayType calcxcorr_legacy_mquest_ ( std::vector< double > &  data1,
std::vector< double > &  data2,
bool  normalize 
)

Calculate crosscorrelation on std::vector data - Deprecated! Legacy code, this is a 1:1 port of the function from mQuest

◆ computeAndAppendRank()

OPENSWATHALGO_DLLAPI unsigned int computeAndAppendRank ( const std::vector< double > &  v,
std::vector< unsigned int > &  ranks 
)

◆ computeRankVector()

OPENSWATHALGO_DLLAPI std::vector< unsigned int > computeRankVector ( const std::vector< std::vector< double > > &  intensity,
std::vector< std::vector< unsigned int > > &  ranks 
)

◆ normalize_sum() [1/2]

OPENSWATHALGO_DLLAPI void normalize_sum ( double  x[],
unsigned int  n 
)

Divide each element of x by the sum of the vector.

◆ normalize_sum() [2/2]

OPENSWATHALGO_DLLAPI void normalize_sum ( std::vector< double > &  x)

Divide each element of x by the sum of the vector.

Parameters
[in,out]xVector to normalize in-place; unchanged if sum is zero

◆ normalizedCrossCorrelation()

OPENSWATHALGO_DLLAPI XCorrArrayType normalizedCrossCorrelation ( std::vector< double > &  data1,
std::vector< double > &  data2,
const int  maxdelay,
const int  lag 
)

Calculate crosscorrelation on std::vector data (which is first normalized) NOTE: this replaces calcxcorr

Referenced by MRMTransitionGroupPicker::computeQuality_().

◆ normalizedCrossCorrelationPost()

OPENSWATHALGO_DLLAPI XCorrArrayType normalizedCrossCorrelationPost ( std::vector< double > &  normalized_data1,
std::vector< double > &  normalized_data2,
const int  maxdelay,
const int  lag 
)

Calculate crosscorrelation on std::vector data that is already normalized.

◆ NormalizedManhattanDist() [1/2]

OPENSWATHALGO_DLLAPI double NormalizedManhattanDist ( double  x[],
double  y[],
int  n 
)

Calculate the normalized Manhattan distance between two arrays.

Equivalent to the function "delta_ratio_sum" from mQuest to calculate similarity between library intensity and experimental ones.

The delta_ratio_sum is calculated as follows:

\[ d = \sqrt{\frac{1}{N} \sum_{i=0}^N |\frac{x_i}{\mu_x} - \frac{y_i}{\mu_y}|) } \]

◆ NormalizedManhattanDist() [2/2]

OPENSWATHALGO_DLLAPI double NormalizedManhattanDist ( std::vector< double > &  x,
std::vector< double > &  y 
)

Calculate the normalized Manhattan distance between two vectors.

Parameters
[in,out]xFirst intensity vector; normalized in-place via normalize_sum
[in,out]ySecond intensity vector; normalized in-place via normalize_sum

◆ rankedMutualInformation()

OPENSWATHALGO_DLLAPI double rankedMutualInformation ( std::vector< unsigned int > &  ranked_data1,
std::vector< unsigned int > &  ranked_data2,
const unsigned int  max_rank1,
const unsigned int  max_rank2 
)

◆ RootMeanSquareDeviation() [1/2]

OPENSWATHALGO_DLLAPI double RootMeanSquareDeviation ( const std::vector< double > &  x,
const std::vector< double > &  y 
)

Calculate the RMSD between two vectors.

Parameters
[in]xFirst data vector
[in]ySecond data vector (must have same size as x)

◆ RootMeanSquareDeviation() [2/2]

OPENSWATHALGO_DLLAPI double RootMeanSquareDeviation ( double  x[],
double  y[],
int  n 
)

Calculate the RMSD (root means square deviation)

The RMSD is calculated as follows:

\[ RMSD = \sqrt{\frac{1}{N} \sum_{i=0}^N (x_i - y_i)^2 } \]

◆ SpectralAngle() [1/2]

OPENSWATHALGO_DLLAPI double SpectralAngle ( const std::vector< double > &  x,
const std::vector< double > &  y 
)

Calculate the Spectral angle between two vectors.

Parameters
[in]xFirst intensity vector
[in]ySecond intensity vector (must have same size as x)

◆ SpectralAngle() [2/2]

OPENSWATHALGO_DLLAPI double SpectralAngle ( double  x[],
double  y[],
int  n 
)

Calculate the Spectral angle (acosine of the normalized dotproduct)

The spectral angle is calculated as follows:

\[ \theta = acos \left( \frac{\sum_{i=0}^N (x_i * y_i))}{\sqrt{\sum_{i=0}^N (x_i * x_i) \sum_{i=0}^N (y_i * y_i)} } \right) \]

◆ standardize_data()

OPENSWATHALGO_DLLAPI void standardize_data ( std::vector< double > &  data)

Standardize a vector (subtract mean, divide by standard deviation)

◆ xcorrArrayGetMaxPeak()

OPENSWATHALGO_DLLAPI XCorrArrayType::const_iterator xcorrArrayGetMaxPeak ( const XCorrArrayType array)

Find best peak in an cross-correlation (highest apex)

Referenced by MRMTransitionGroupPicker::computeQuality_().