Skip to content

[FIX] PeakIntegrator: Positions at peak's height percentages - #3251

Merged
hroest merged 13 commits into
OpenMS:developfrom
biosustain:fix/pos_at_peaks_heights_percent
Feb 16, 2018
Merged

hroest merged 13 commits into
OpenMS:developfrom
biosustain:fix/pos_at_peaks_heights_percent

Conversation

@pcolaianni

Copy link
Copy Markdown
Contributor

Where
PeakIntegrator::calculatePeakShapeMetrics()

Why
Shamelessly copying @dmccloskey description 😄 :
The current algorithm to calculate the peak shape metrics assumes an ideal peak whereby 5%, 10%, and 50% of the peak height actually exist on both sides of the peak. If the 5%, 10%, and 50% of the peak height cannot be found on either side, erroneous values are calculated.

How
I implemented a protected function template:

template <typename PeakContainerConstIteratorT>
double findPosAtPeakHeightPercent_(
  PeakContainerConstIteratorT it_begin,
  PeakContainerConstIteratorT it_end,
  const double peak_height,
  const double percent,
  const bool is_left_half
) const;

Documentation is also provided.

Notes
The proposed solution assumes a convex peak.

TEST_REAL_SIMILAR(psm.end_position_at_5, 2.74394857992666)
TEST_REAL_SIMILAR(psm.end_position_at_10, 2.76698789247996)
TEST_REAL_SIMILAR(psm.end_position_at_50, 2.71349672522338)
TEST_REAL_SIMILAR(psm.width_at_5, 0.15955)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are the values now so different? is this expected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because we are now taking the point's position before the percentage's goal. Not the one closest.
The one to the left in case of the left half, and the one to the right in case of the right half.

@hroest
hroest merged commit 38c8be5 into OpenMS:develop Feb 16, 2018
@pcolaianni
pcolaianni deleted the fix/pos_at_peaks_heights_percent branch February 16, 2018 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants