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

`#include <filtertriangle.h>`

Inheritance diagram for pappso::FilterTriangle:

## Public Member Functions

| FilterTriangle ()
| FilterTriangle (const FilterTriangle &other)
| ~FilterTriangle ()
double | setTriangleSlope (double intensity, double mz)
Trace & | filter (Trace &data_points) const override
Public Member Functions inherited from pappso::FilterInterface
virtual | ~FilterInterface ()

## Private Member Functions

DataPoint | sumAndRemove (Trace &trace, const DataPoint &max_intensity) const

## Private Attributes

double | m_triangleSlope
double | m_maxMzRange = 0

## Detailed Description

Todo:
  sum peaks under a triangle base

Definition at line 39 of file filtertriangle.h.

## Constructor & Destructor Documentation

## FilterTriangle() [1/2]

FilterTriangle::FilterTriangle | ( |  | ) |

Default constructor

Definition at line 33 of file filtertriangle.cpp.

{
}

## FilterTriangle() [2/2]

FilterTriangle::FilterTriangle | ( | const FilterTriangle & | other | ) |

Copy constructor

Parameters

  other | TODO

Definition at line 37 of file filtertriangle.cpp.

{
m_triangleSlope = other.m_triangleSlope;
}
pappso::FilterTriangle::m_triangleSlope
double m_triangleSlope
Definition filtertriangle.h:67

References m_triangleSlope.

## ~FilterTriangle()

FilterTriangle::~FilterTriangle | ( |  | ) |

Destructor

Definition at line 42 of file filtertriangle.cpp.

{
}

## Member Function Documentation

## filter()

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

override virtual

Implements pappso::FilterInterface.

Definition at line 94 of file filtertriangle.cpp.

{
// qDebug() << data_points.size();
Trace new_trace;
std::vector<DataPoint>::iterator it_max =
maxYDataPoint(data_points.begin(), data_points.end());
// qDebug();
while((it_max != data_points.end()) && (it_max->y > 0))
{
// qDebug();
new_trace.push_back(sumAndRemove(data_points, *it_max));
// qDebug();
it_max = maxYDataPoint(data_points.begin(), data_points.end());
}
new_trace.sortX();
// qDebug() << new_trace.size();
data_points = std::move(new_trace);
// qDebug() << data_points.size();
return data_points;
}
pappso::FilterTriangle::sumAndRemove
DataPoint sumAndRemove(Trace &trace, const DataPoint &max_intensity) const
Definition filtertriangle.cpp:55
pappso::Trace
A simple container of DataPoint instances.
Definition trace.h:148
pappso::Trace::sortX
void sortX(SortOrder sort_order=SortOrder::ascending)
Definition trace.cpp:1086
pappso::maxYDataPoint
std::vector< DataPoint >::const_iterator maxYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
Definition trace.cpp:180

References pappso::maxYDataPoint(), pappso::Trace::sortX(), and sumAndRemove().

## setTriangleSlope()

double FilterTriangle::setTriangleSlope | ( | double | intensity,
|  | double | mz
| ) |  |

Definition at line 47 of file filtertriangle.cpp.

{
m_maxMzRange = mz;
m_triangleSlope = mz / intensity;
return m_triangleSlope;
}
pappso::FilterTriangle::m_maxMzRange
double m_maxMzRange
Definition filtertriangle.h:68
pappso::PrecisionUnit::mz
@ mz

References m_maxMzRange, m_triangleSlope, and pappso::mz.

## sumAndRemove()

DataPoint FilterTriangle::sumAndRemove | ( | Trace & | trace,
|  | const DataPoint & | max_intensity
| ) |  | const

private

Definition at line 55 of file filtertriangle.cpp.

{
// qDebug();
// double sum = max_intensity.y;
// double wmean = max_intensity.y * max_intensity.x;
double mz_range = max_intensity.y * m_triangleSlope;
if(mz_range > m_maxMzRange)
{
mz_range = m_maxMzRange;
}
double min_range = max_intensity.x - mz_range;
double max_range = max_intensity.x + mz_range;
DataPoint new_point;
new_point.y = 0;
new_point.x = 0;
// Trace new_trace;
for(DataPoint &old_point : trace)
{
if((old_point.x < min_range) || (old_point.x > max_range))
{
// new_trace.push_back(old_point);
}
else
{
new_point.y += old_point.y;
new_point.x += old_point.y * old_point.x;
old_point.y = 0;
}
}
// trace = std::move(new_trace);
new_point.x = new_point.x / new_point.y; // weighted mean on mz
return new_point;
}
pappso::DataPoint
Definition datapoint.h:22
pappso::DataPoint::x
pappso_double x
Definition datapoint.h:23
pappso::DataPoint::y
pappso_double y
Definition datapoint.h:24

References m_maxMzRange, m_triangleSlope, pappso::DataPoint::x, and pappso::DataPoint::y.

Referenced by filter().

## Member Data Documentation

## m_maxMzRange

double pappso::FilterTriangle::m_maxMzRange = 0

private

Definition at line 68 of file filtertriangle.h.

Referenced by setTriangleSlope(), and sumAndRemove().

## m_triangleSlope

double pappso::FilterTriangle::m_triangleSlope

private

Definition at line 67 of file filtertriangle.h.

Referenced by FilterTriangle(), setTriangleSlope(), and sumAndRemove().

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

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