Data Science & Machine Learning

Battle of the Baseline Algorithms

Surbhi Poddar
January 25, 2019

The basic definition of a baseline defines it as a broad trend that causes the true signal to “drift” along the y-axis. For example, a continuous extra energy reading caused by heat developed in sensor plate over time. This component has very low frequency, and should not change much in a 5 THz range.But you already knew that right? You came here to find out which baseline algorithm is the best.

The Combatants

In this article we compare 3 known algorithms for baseline correction in mass spec, namely:

  • Thresholding Algorithm
  • TopHat Algorithm
  • Asymmetric Least Square Smoothing Algorithm (AsLSS)

At the end of the article, we compare the three head to head on 2 major accuracy parameters involving 4 real world scenarios, but first let us define these algorithms in brief.

Thresholding Algorithm

This algorithm was used by us on our tool – El-MAVEN, to define the threshold baseline i.e. to filter the noise. It was a part of the original Maven project written by Eugene Melamud and is defined using two parameters:

  1. Drop the top x% intensities from the chromatogram: The percentage intensity defined here is removed before calculating the baseline. This value has to be set higher in case of higher noise in the data
  2. Baseline smoothing: This defines the number of scans used for fitting in the smoothing algorithm

However, there were some challenges that we faced with this baseline, which led us to the discovery of other options mentioned below. These drawbacks were:

  1. The baseline calculated was often inaccurate i.e. baseline was affected by the adjacent peak intensity
  2. A global fit of the baseline was observed i.e. the baseline was defined for the entire EIC and hence had to be changed for particular peak groups or metabolites

TopHat Algorithm

This is a very different approach of baseline correction compared to AsLSS, where an ideal model for baseline behaviour is obeyed and reflected in the algorithm. The TopHat filter is a well known operation used in morphological image analysis but can be applied to any kind of uniformly-distributed signal to obtain its baseline reduced “true” form. It features:

  • Only 1 parameter (s i.e. the structuring element of the morphological filter)
  • In terms of computational performance it performs better than both AsLSS and Threshold algorithms
  • It offers more aggressive calculation but the output is not as ideal as AsLSS

Asymmetric Least Square Smoothing Algorithm

The Asymmetric Least Square Smoothing Algorithm (AsLSS), uses smoothing (determined by λ) to give a slowly varying trend of the signal. AsLS has an “asymmetry” (denoted by p) parameter that can be used to favour only one type of peak – either positive or negative.PS: This is the Elucidata choice.For our purpose, the algorithm uses a variant of the “Whittaker” smoother where positive deviations with respect to baseline are weighted much less as compared to negative ones. This algorithm has several advantages such as:

  • It can be tuned using only two parameters (λ for smoothness and p for asymmetry)
  • It does not suffer from the global fitting issue as the thresholding algorithm does
  • It does a more accurate calculation of baseline as compared to thresholding and TopHat algorithms

The Showdown

Here is the part you’ve been waiting for. The accuracy comparison of the Thresholding Algorithm, AsLSS Algorithm and TopHat has been shared below.

The Process

True Baseline was determined by manually curating EICs with the correct baseline and different peak patterns as mentioned in the cases below. The true baselines were recorded and drift was then added to each of these EICs.

MEAN OF R SQUARED VALUE CALCULATION

  • The baseline was calculated with the added drifts for 4420 runs using thresholding, AsLSS, and TopHat algorithms. The R Squared value was calculated for each run in comparison to the true baseline. Finally, the mean of these R Squared Values was recorded.
  • This value ranges between [0,1]. Closer the value to 1, better is the fit.

MEAN RELATIVE AREA DIFFERENCE CALCULATION

  • The area was calculated with the true baseline and corrected baselines for 1000 runs in each category (multiple peaks in EIC, two close peaks, two close peaks with significant intensity difference, noisy data).
  • The relative difference in area is calculated using the formula for each run
  • The mean of the relative area difference is calculated for 1000 runs within each category.
  • We would want this mean relative area difference to be as low as possible to ensure the area of the peak obtained with the corrected baseline is close to the area of the peak obtained with the true baseline.

The Results

FeaturesThreshold AlgorithmAsLSS AlgorithmTopHatMean of R Squared Value0.74220.96580.9528Mean relative area difference when there are two or more peaks19.148.0619.22Mean relative area difference when two peaks are close to each other18.8012.1121.67Mean relative area difference when two close peaks have a significant difference in intensity29.5621.8327.89Mean relative area difference when there is a noisy EIC with distinct peaks35.154.2113.32

Significance of Results

  • The R Squared Value observed for AsLSS Algorithm was the best. Hence we can say, the goodness of the fit was the better as compared to TopHat and Thresholding Algorithm.
  • In the case of two or more peaks, the mean relative area difference observed was lowest for AsLSS Algorithm. The mean relative area difference observed for Thresholding Algorithm was the second lowest while TopHat showed the highest deviation.
  • In the case of two close peaks, the mean relative area difference observed was lowest for AsLSS Algorithm. The mean relative area difference observed for Thresholding Algorithm was the second lowest while TopHat showed the highest deviation.
  • In the case of two close peaks with significant intensity difference, the mean relative area difference observed was lowest for AsLSS Algorithm. The mean relative area difference observed for TopHat was the second lowest while Thresholding Algorithm showed the highest deviation.
  • In the case of noisy EIC, the mean relative area difference observed was lowest for AsLSS Algorithm. The mean relative area difference observed for TopHat was the second lowest while Thresholding Algorithm showed the highest deviation.

Conclusion

The verdict is out and we have a clear winner – AsLSSIt performed better baseline estimation as compared to both Thresholding algorithm and TopHat algorithm in terms of Goodness-of-Fit and calculation of Area Under Peak with respect to the true baseline of an EIC.Now that you’ve read it, test out this algorithm in action, download El-Maven and see the difference yourself.Please note that all these algorithms and comparisons pertain to mass spec analyses only.

Blog Categories

Blog Categories

Request Demo