Loading...
Searching...
No Matches
pappso::FilterGreatestY Class Reference

keep N datapoints form the greatest intensities to the lowest More...

`#include <filterpass.h>`

Inheritance diagram for pappso::FilterGreatestY:

## Public Member Functions

| FilterGreatestY (std::size_t number_of_points=0)
| constructor with the number of datapoints to keep
| FilterGreatestY (const FilterGreatestY &other)
virtual | ~FilterGreatestY ()
FilterGreatestY & | operator= (const FilterGreatestY &other)
Trace & | filter (Trace &data_points) const override
std::size_t | getNumberOfPoints () const
Public Member Functions inherited from pappso::FilterInterface
virtual | ~FilterInterface ()

## Private Attributes

std::size_t | m_numberOfPoints = 0

## Detailed Description

keep N datapoints form the greatest intensities to the lowest

Definition at line 95 of file filterpass.h.

## Constructor & Destructor Documentation

## FilterGreatestY() [1/2]

FilterGreatestY::FilterGreatestY | ( | std::size_t | number_of_points = `0` | ) |

constructor with the number of datapoints to keep

Parameters

  number_of_points | maximum number of points accepted in resulting spectrum

Definition at line 146 of file filterpass.cpp.

: m_numberOfPoints(number_of_points)
{
}
pappso::FilterGreatestY::m_numberOfPoints
std::size_t m_numberOfPoints
Definition filterpass.h:114

## FilterGreatestY() [2/2]

FilterGreatestY::FilterGreatestY | ( | const FilterGreatestY & | other | ) |

Definition at line 152 of file filterpass.cpp.

: m_numberOfPoints(other.m_numberOfPoints)
{
}

## ~FilterGreatestY()

virtual pappso::FilterGreatestY::~FilterGreatestY | ( |  | ) |

inline virtual

Definition at line 105 of file filterpass.h.

{};

## Member Function Documentation

## filter()

Trace & FilterGreatestY::filter | ( | Trace & | data_points | ) | const

override virtual

Implements pappso::FilterInterface.

Definition at line 168 of file filterpass.cpp.

{
// Reverse-sort the data points (in y decreasing order) so that we get the
// greatest to the front of the vector and we'll then copy the first n data
// points to the returned vector. See that return (b < a) ?
if(m_numberOfPoints >= data_points.size())
return data_points;
std::sort(data_points.begin(),
data_points.end(),
[](const DataPoint &a, const DataPoint &b) { return (b.y < a.y); });
data_points.erase(data_points.begin() + m_numberOfPoints, data_points.end());
// And now sort the Trace conventionally, that is in x increasing order.
std::sort(data_points.begin(),
data_points.end(),
[](const DataPoint &a, const DataPoint &b) { return (a.x < b.x); });
return data_points;
}
pappso::PeptideIonNter::a
@ a
pappso::PeptideIonNter::b
@ b
pappso::DataPoint
Definition datapoint.h:22

References pappso::a, pappso::b, and m_numberOfPoints.

Referenced by pappso::MassSpectrumFilterGreatestItensities::filter(), and pappso::XtandemSpectrumProcess::process().

## getNumberOfPoints()

std::size_t FilterGreatestY::getNumberOfPoints | ( |  | ) | const

Definition at line 193 of file filterpass.cpp.

{
return m_numberOfPoints;
}

References m_numberOfPoints.

Referenced by pappso::XtandemSpectrumProcess::getNmostIntense().

## operator=()

FilterGreatestY & FilterGreatestY::operator= | ( | const FilterGreatestY & | other | ) |

Definition at line 159 of file filterpass.cpp.

{
m_numberOfPoints = other.m_numberOfPoints;
return *this;
}

References m_numberOfPoints.

## Member Data Documentation

## m_numberOfPoints

std::size_t pappso::FilterGreatestY::m_numberOfPoints = 0

private

Definition at line 114 of file filterpass.h.

Referenced by filter(), getNumberOfPoints(), and operator=().

The documentation for this class was generated from the following files:

- pappsomspp/processing/filters/filterpass.h
- pappsomspp/processing/filters/filterpass.cpp