MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / findHighestInWindow

Method findHighestInWindow

src/openms/source/KERNEL/MSSpectrum.cpp:319–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317 }
318
319 Int MSSpectrum::findHighestInWindow(MSSpectrum::CoordinateType mz, MSSpectrum::CoordinateType tolerance_left,
320 MSSpectrum::CoordinateType tolerance_right) const
321 {
322 if (ContainerType::empty())
323 {
324 return -1;
325 }
326 // get left/right iterator
327 auto left = this->MZBegin(mz - tolerance_left);
328 auto right = this->MZEnd(mz + tolerance_right);
329
330 // no MS1 precursor peak in +- tolerance window found
331 if (left == right)
332 {
333 return -1;
334 }
335
336 auto max_intensity_it = std::max_element(left, right, Peak1D::IntensityLess());
337
338 // find peak (index) with highest intensity to expected position
339 return (max_intensity_it - this->begin());
340 }
341
342
343 void MSSpectrum::sortByPositionPresorted(const std::vector<Chunk>& chunks)

Callers

nothing calls this directly

Calls 5

MZBeginMethod · 0.95
MZEndMethod · 0.95
emptyFunction · 0.50
IntensityLessClass · 0.50
beginMethod · 0.45

Tested by

no test coverage detected