Skip to content
Joshua Charkow edited this page Oct 9, 2024 · 14 revisions

Scoring

Introduction

1. Chromatographic Scoring

Chromatographic scores are calculated the driver function calculateChromatographicScores() which calls functions in the MRMScoring module.

Shape and Coelution Scores

  • Shape scores are based on the cross correlation (sliding dot product) of the intensity arrays of transitions in a peak group.
  • The OpenMS implementation of cross correlation is performed by calculateCrossCorrelation() and can be summarized by the equation below.

$$ Z[d]=\sum_{i=0}^{i=N-1}x_i y_i $$

  • Z is the correlation array, where the index of Z represents the delay
  • x and y are intensity vectors
  • d is the delay, this can be any value from (-len(X), len(X))
  • N is the length of x and y
  • If yi is out of the range of the array, then yi=0

To compute the Cross Correlation Matrix (initializeXCorrMatrix())

  1. For each transtion, normalize the intensity chromatogram (standardize_data()).
    • To normalize, for each value, subtract the mean and divide by the standard deviation
  2. For each pair of transition level features, compute the cross correlation (normalizedCorssCorrelationPost() which calls calculateCrossCorrelation()).
    • Record the maximum cross correlation and the delay which resulted in the maximum cross correlation

Shape Scores (-use_shape_score):

  1. VAR_XCORR_SHAPE = Mean of all entries in the cross correlation matrix (calcXcorrShapeScore()).
  2. VAR_XCORR_SHAPE_WEIGHTED = Weighted mean (by library intensity) of all entries in the cross correlation matrix (calcXcorrShapeWeightedScore()).

$$ \sum_{i=0}^{i=N}\sum_{j=0}^{j=M}X_{i,j} L_i L_j $$

  • X is an N x M matrix of cross correlations for all transitions
  • L is the array of library intensities

Coelution Scores (-use_coelution_score)

  1. VAR_XCORR_COELUTION = Mean of all delays in cross correlation matrix + standard deviation of all delays (calcXcorrCoelutionScore).
  2. VAR_XCORR_COELUTION_WEIGHTED = Weighted mean by intensity (calcXcorrCoelutionWeightedScore()).
    • similar to VAR_XCORR_SHAPE_WEIGHTED but instead of correlation values use the lag values.

MS1 level Shape and Coelution Scores (-use_ms1_correlation)

These scores are present in the FEATURE_MS1 table. There are 3 different types of scores.

1. Precursor - Between MS1 Isotopes

The cross correlation matrix is computed between all MS1 isotopes (initializeXCorrPrecursorMatrix()).

Scores include:

  1. VAR_XCORR_SHAPE = Mean of all entries in cross correlation matrix (calcXcorrPrecursorShapeScore()).
  2. VAR_XCORR_COELUTION = Mean of all delays + standard deviation of all delays (calcXcorrPrecursorCoelutionScore()).

2. Contrast - MS1 Isotopes Against Transitions

Here, the cross correlation contrast matrix is computed such that each row represents an MS1 isotope and each column representing a transition (initializeXCorrPrecursorContrastMatrix()).

Scores include:

  1. VAR_XCORR_SHAPE_CONTRAST = Mean of all entries in cross correlation matrix (calcXcorrPrecursorContrastShapeScore()).
  2. VAR_XCORR_COELUTION_CONTRAST = Mean of all delays + standard deviation of all delays (calcXcorrPrecursorContrastCoelutionScore).

3. Combined - All vs All

In this matrix, MS1 isotopes and transitions make up both rows and columns (initializeXCorrPrecursorCombinedMatrix()).

Scores include:

  1. VAR_XCORR_SHAPE_COMBINED = Mean of all entries in cross correlation matrix (calcXcorrPrecursorCombinedShapeScore()).
  2. VAR_XCORR_COELUTION_COMBINED = Mean of all delays + standard deviation all delays (calcXcorrPrecursorCombinedCoelutionScore()).

Number of Peaks Score (-use_nr_peaks_score)

NR_PEAKS = Number of transition level features in the peak group

Signal-To-Noise Score (-use_sn_score)

VAR_LOG_SN_SCORE = log(S/N Score)

  • SN score is the mean of all transition level signal-to-noise estimators across retention time (calcSNScore()).

MS2 Mutual Information (MI) Scores (-use_mi_score)

These scores are based on taking the mutual information score between pairs of transition's chromatograms. To compute the mutual information between a pair of 1D arrays

  1. For each array compute the rank array (this value of each element is the ordering of the array from least to greatest)
    1. E.g. the rank array [10, 30, 20, 20] would be [0,3,1,1]
  2. Count the number of each rank in the array
    1. E.g. continuing example above {O:1, 1:2, 2:0, 3:1}, each of these entries is a "state"
  3. Take the mean of equation below for all states

$$ log(\frac{numJointStates}{numFirstStates*numSecondStates}) $$

  1. Add log(length_array) and divide by log(2)

Similar to shape scores first we compute a matrix with all pairs of transitions and then derrive the scores from that matrix.

To compute the MI Matrix (InitializeMIMatrix()):

  1. For each transition compute the rank vector (a vector with length of the number of transitions saving the position with the maximum intensity) (computeRankVector()).
  2. For each pair of transitions compute the MI score (see description above) (rankedMutualInformation()]).

Scores computed from the matrix include:

  1. VAR_MI_SCORE= Mean of all entries in MI matrix (calcMIScore()).
  2. VAR_MI_WEIGHTED_SCORE = Weighted (based on library intensity) mean of all scores in MI matrix (calcMIWeightedScore()).
  3. TOTAL_MI
  4. VAR_MI_RATIO_SCORE = VAR_MI_SCORE / TOTAL_MI
    • Note: this score is computed in the scorePeakgroups() function.
    • Only enabled if -use_total_mi_score is set.

MS1 Mutual Information Scores (use_ms1_mi)

Similar to coelution and shape scores there are 3 different types of MI MS1 scores. These scores are present in the MS1 FEATURE table.

1. Precursor - Between MS1 Isotopes

Matrix is computed between all pairs of MS1 isotopes (initializeMIPrecursorMatrix()).

2. Contrast - MS1 Isotopes Against Transitions

Matrix is computed such that each row representing an MS1 isotope and each column representing a transition (initializeMIPrecursorContrastMatrix()).

3. Combined - All vs All

Matrix contains scores from all possible pairs of transitions and MS1 isotopes. Transitions and MS1 isotopes make up both rows and columns (initializeMIPrecursorCombinedMatrix()).

2. Library Scores

Library scores are calculated by the driver function calculateLibraryScores(). These scores compare values between the library and the found feature.

Intensity Based Library Scores (-use_library_score)

These scores compare the intensity of the library transitions with the experimental intensity of the transitions. These scores are calculated by the driver function calcLibraryScore(). These scoring functions are found in the OpenSwathAlgorithm Scoring and StatsHelpers modules.

1. VAR_LIBRARY_MANHATTAN

manhattanScoring() takes the manhattan distance between the library transition vector and the experimental transition vector. Both vectors are square-rooted and normalized before the distance is taken. This score can be described as the following equation:

$$ \sum_{i=0}^{i=N}\left|\frac{\sqrt{b_i}}{\sum_{j=0}^{j=N}\sqrt{b_j}} - \frac{\sqrt{x_i}}{\sum_{k=0}^{k=N}\sqrt{x_k}}\right| $$

2. VAR_LIBRARY_DOTPROD

dotprodScoring() takes the dot product between the library transition vector and the experimental transition vector. Both vectors are square-rooted and eucledian normalized before dotproduct is taken. This score can be described as the following equation:

$$ \frac{\sqrt{B}}{\sqrt{\prod_{i=0}^{i=N}\sqrt{b_i}}} \cdot \frac{\sqrt X} {\sqrt{\prod_{j=0}^{j=N}\sqrt{X_j}}} $$

3. VAR_LIBRARY_SANGLE

SpectralAngle() takes the Acosine of the normalized dot product between the library and experimental intensity vectors. This score can be described as:

$$ \frac{\sum_{i=0}^{i=N}b_i x_i}{\sqrt{\sum_{j=0}^{j=N}(b_i b_i)\sum_{k=0}^{k=N}(x_i x_i)}} $$

4. VAR_LIBRARY_RMSD

NormalizedManhattanDist() takes the normalized manhattan distance between the library and experimental intensity vectors. This score can be described by the following equation:

$$ \sqrt{\frac{1}{N}\sum_{i=0}^{i=N}\left|\frac{x_i}{\mu_x} - \frac{b_i}{\mu_l}\right|} $$

5. VAR_LIBRARY_ROOTMEANSQUARE

RootMeanSquareDeviation() This score take the RMSD between the library and experimental intensity vectors. Can be described as:

$$ \sqrt{\frac{\sum_{i=0}^{i=N}(x_i b_i)^2}{N}} $$

6. VAR_LIBRARY_CORR

cor_pearson() takes the pearson correlation between the library and experimental intensity vectors. Can be described as:

$$ \frac{\sum_{i=0}^{i=N}(x_i - \mu_X)(b_i - \mu_B)}{\sqrt{\sum_{i=0}^{i=N}(x_i - \mu_X)^2 \sum_{k=0}^{k=N}(b_i - \mu_B)^2}} $$

For the equations above:

  • B is an array of transition library intensities, an element of this array is bi
  • X is an array of experimental transition intensities, an element of this array is xi
  • N is the length of L and E
  • μ is the mean of the array

Retention Time Based Scores (-use_rt_score)

  • RT_SCORE= This score computes the absolute difference between the normalized experimental retention time and the library retention time (calcRTScore()).
  • VAR_NORM_RT_SCORE = This score divides the RT_SCORE by the rt_normalization_factor (by default -rt_normalization_factor is 100)

3. Single Spectrum Scores

These scores use information in the spectrum at the peak apex of the chromatographic elution peak. These scores are computed with the driver function calculateDIAScores() which calls functions in the DIAScoring and DIAPreScoring modules.

Isotope Based Scores (-use_ms2_isotope_scores)

Theoretical Spectrum Distance Scores

These scores compare each transition level feature with its theoretical isotope distribution. These scores are computed by the score_with_isotopes() function which calls the DIA prescoring score() function.

The score() function:

  1. Create a theoretical "spectrum" with the isotope pattern based on the experimental m/z and intensity (addSinglePeakIsotopes2Spec()) for all transitions
  2. Duplicate the created spectrum, one will be used for each score.
  3. Add preisotope intensities from each transition to each each of the theoretical spectra ((addPreisotopeWeights()))
    1. For theoretical spectrum #1 add zero weighted preisotope intensities (for Manhattan)
    2. For theoretical spectrum #2 add negatvely weighted preisotope intensities (for dot product)
  4. For each theoretical m/z (each transition, each isotope), compute the summed intensity and the intensity weighted m/z value. This will return an array of intensities one for each theoretical m/z value (Using integrateWindows() which calls integrateWindow())
  5. Normalize the theoretical and experimental intensity arrays
    • Experimental: Sqaure root and divide by the sum of experimental intensities across transitions
    • Theoretical: Divide by sum of theoretical intensities across transitions

VAR_MANHATTAN_SCORE = Manhattan distance between experimental and theoretical (zero weighted preisotope intensities) normalized intensity arrays. Normalization occurs by dividing by the sum of intensities across transitions. For the experimental spectrum normalization is proceeded by taking the square root of all intensities.

VAR_DOTPROD_SCORE = Dot product between the experimental and theoretical (negatively weighted preisotope intensities) normalized intensity arrays. Experimental and theoretical use eucledian normalization. Rescale by the maximum positive and negative value (Don't really know exactly what is happenning).

Isotope Scores

Both of these scores use the intensity of each transition as recorded by the feature (getFirstIsotopeRelativeIntesities).

  1. VAR_ISOTOPE_CORRELATION_SCORE = Pearson correlation of each transition level feature with its theoretical isotope distribution.

    1. For each transition, for each isotope determine its intensity (integrateWindow. Each transition will have its own intensity array with each value representing an isotope.
    2. For each transition use compare (pearson correlation) the theoretical (from CoarseIsotopePatternGenerator) and experimental (from previous step) intensities (scoreIsotopePattern_() and scoreIsotopePattern_())
    3. Multiply the correlation by the transition intensity and sum all the scores
  2. VAR_ISOTOPE_OVERLAP_SCORE

    1. Check to see if there is an isotopic signal to the left of the experimental monoisotopic peak with a greater intensity than the experimental peak (this would suggest that the experimental monoisotopic m/z is actually the 2nd isotopic peak) --> If true increase nr_occurences by 1. (see largePeaksBeforeFirstIsotope_())
      • Number of moves to the left is determined by -dia_nr_charges?
    2. Multiply the nr_occurences by the transition intensity and sum all the scores

Mass Difference Score

These score are computed by the (dia_massdiff_score()) driver function.

  1. VAR_MASSDEV_SCORE = This score computes the difference in ppm of the experimental signal to the expected signal.

Ion Scores

These scores are computed by the dia_by_ion_score driver function.

  1. VAR_BSERIES_SCORE = This score is the total number of $b$ ions found in the experimental spectrum for the peptide in question. An ion is classified as found if a signal intensity (computed by integrateWindow) is greater than a threshold (DIAScoring::dia_byseries_intensity_min, default=300) is determined to be present and the ppm difference of the intensity weighted signal and the theoretical ion m/z is less than (DIAScoring::dia_byseries_ppm_diff, default=10).
  2. VAR_YSERIES_SCORE = Same as above, for $y$ ions.

Precursor DIA Scores

These scores are computed by the calculatePrecursorDIAScores() driver function. These scores are stored in the FEATURE_MS1 table.

Mass Difference Score

VAR_MASSDEV_SCORE = Mass difference (in ppm) between the library and experimental m/z. Experimental m/z is computed as the intensity weighted average m/z (dia_ms1_massdiff_score()).

Isotope Scores

These scores are computed by dia_ms1_isotope_scores() if a peptide sequence is present and dia_ms1_isotope_scores_averagine() if no sequence is present.

  1. If sequence is present (dia_ms1_isotope_scores())

    1. Fetch the intesity of each precursor isotopes getIsotopeIntysFromExpSpec_(). Number of isotopes specified by -DIAScoring::dia_nr_isotopes
      1. VAR_ISOTOPE_CORRELATION_SCORE = For each isotope compare the theoretical and experimental intensities ((scoreIsotopePattern_() and scoreIsotopePattern_())
      2. VAR_ISOTOPE_OVERLAP_SCORE = Ratio between the intensity of a isotopic signal to the left of the experimental monoisotopic peak and the experimental intensity. (largePeaksBeforeFirstIsotope_()).
      • This score tests -dia_nr_charges isotopes to the left and keeps the largest ratio (ratio with left isotope of the largest intensity)
  2. If a sequence is not present use dia_ms1_isotope_scores_averagine(), which has a similar workflow to above but uses the CoarseIsotopePatternGenerator) to generate the theoretical isotopic distribution.

Ion Mobility Scores (use_im_scores)

These scores are computed by the driftScoring() driver function.

Ion Mobility Delta Scores

VAR_IM_DELTA_SCORE = Difference between the experimental and library ion mobility values. To compute this score:

  1. For each transition
    1. compute the intensity weighted drift time integrateDriftSpectrum()
    2. Compute the delta IM abs(library_drift - experimental drift)
  2. Take the mean delta im across all transitions

EXP_IM = Mean Intensity weighted drift time (see above) across all transitions EXP_IM_WEIGHTED = Weighted (transition intensity) mean drift time across all transitions

Ion Mobilogram Correlation and Shape Scores

These scores are based on the cross correlation of the ion mobilograms for the different transtions. It is computed in a similar manner to the retention time shape and coelution scores.

First we have to fetch the IM intensity array.

  1. For each transtion, fetch the intensity weighted mobilogram (integrateDriftSpectrum()). This is an array of intensity across IM for each transition.
  2. Compute the grid on which IM values lie (computeGrid()) and align ion mobilogram to the computed grid (AlignToGrid())
    • This step ensures that if one of the ion mobility scans is "blank" a zero value is added. Thus, after alignment all transitions intensity arrays are the same size.
    • E.g. (IM, Intensity array): [(0.6, 1), (0.61,5), (0.63, 1)] --> [(0.6,1), (0.61,5), (0.62,0), (0.63,1)]
  3. Compute the cross correlation matrix between all transitions (initializeXCorrMatrix()
    • Note: This is a different function signature from retention time cross correlation matrix however still computes the cross correlation in similar manner

VAR_IM_XCORR_SHAPE = Mean of all entries in cross correlation matrix calcXcorrShapeScore()
VAR_IM_XCORR_COELUTION = Mean of all delays in cross correlation matrix + standard deviation of all delays calcXcorrCoelutionScore()

MS1 Ion Mobility Scores (-use_im_scores)

These scores use information on the precursor mobilogram. They are found in the FEATURE_MS1 table.

VAR_IM_MS1_DELTA_SCORE = Difference between the library and the experimental (from integrateDriftSpectrum() ion mobility. (driftScoringMS1

The following two scores contrast the precursor mobilogram with the transition mobilograms. (See ion mobilogram correlation and shape scores for descripiton on how mobilogram is fetched). Coelution and shape scores are computed for MS1 precursor against transitions (I don't think isotopes are included yet). (initializeXCorrPrecursorContrastMatrix())

  1. VAR_IM_XCORR_SHAPE_CONTRAST = Mean of all entries in cross correlation matrix (calcXcorrPrecursorContrastShapeScore()).
  2. VAR_IM_XCORR_COELUTION = Mean of all delays in cross correlation matrix + standard deviation of all delays (calcXcorrPrecursorContrastCoelutionScore)

4. Sonar Scores (-use_sonar_scores)

These scores are specific for sliding swath and are computed using the computeSonarScores() driver function.

5. Unique Ion Signature Scores (-use_uis_scores)

  • These scores are primarily used for identifying post translational modifications?
  • They are computed by the driver function scoreIdentification.

Chromatographic Scores

These scores are computed using the driver function calculateChromatographicIdScores().

Shape and Correlation Scores

These scores contrast the "identifying" vs "detecting" transitions. The cross correlation matrix is initialized using initializeXCorrContrastMatrix().

VAR_UIS_XCORR_SHAPE?? = Mean of all entries in cross correlation matrix calcSeparateXcorrContrastShapeScore() (--use_shape_score)

VAR_UIS_XCORR_CORRELATION?? = Mean(all delays in cross correlation matrix) + stddev(all delays in cross correlation matrix) calcSeparateXcorrContrastCoelutionScore() (-use_coelution_score)

Signal-To-Noise Score (-use_sn_score)

VAR_UIS_SN = calcSeparateSNScore()

MI Score (-use_mi_score)

The MI matrix is initialized with score is initialized with initializeMIContrastMatrix()

VAR_UIS_MI = calcSeparateMIContrastScore()

Single Spectrum Scores (use_dia_scores)

These scores are computed with the driver function calculateDIAIdScores() only on the identification transitions. Scores computed are similar to in the main single spectrum scores section.

6. Intensity Score (use_intensity_score)

This score is computed in place in the scorePeakgroups() method. Currently a comment, not sure if really want these intensity scores. VAR_INTENSITY_SCORE = Peak Group Intensity (as computed by feature finder) / Total XIC

7. Elution Model Score (-use_elution_model_score)

Computed using calcElutionFitScore(). Not currently working with mrmfeature

VAR_ELUTION_MODE_SCORE

Clone this wiki locally