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

`#include <filterexclusionmz.h>`

Inheritance diagram for pappso::FilterMzExclusion:

## Public Member Functions

| FilterMzExclusion (PrecisionPtr precision_ptr)
| FilterMzExclusion (const QString &strBuildParams)
| FilterMzExclusion (const FilterMzExclusion &other)
virtual | ~FilterMzExclusion ()
QString | name () const override
QString | toString () const override
Trace & | filter (Trace &data_points) const override
| get all the datapoints and remove different isotope and add their intensity and change to charge = 1 when the charge is known
Public Member Functions inherited from pappso::FilterNameInterface
virtual | ~FilterNameInterface ()
Public Member Functions inherited from pappso::FilterInterface
virtual | ~FilterInterface ()

## Private Member Functions

void | buildFilterFromString (const QString &strBuildParams) override
| build this filter using a string
Trace | removeTraceInExclusionMargin (Trace &points) const

## Private Attributes

PrecisionPtr | m_exclusionPrecision

## Additional Inherited Members

## Detailed Description

Definition at line 36 of file filterexclusionmz.h.

## Constructor & Destructor Documentation

## FilterMzExclusion() [1/3]

FilterMzExclusion::FilterMzExclusion | ( | pappso::PrecisionPtr | precision_ptr | ) |

Default constructor

Definition at line 39 of file filterexclusionmz.cpp.

: m_exclusionPrecision(precision_ptr)
{
}
pappso::FilterMzExclusion::m_exclusionPrecision
PrecisionPtr m_exclusionPrecision
Definition filterexclusionmz.h:79

## FilterMzExclusion() [2/3]

FilterMzExclusion::FilterMzExclusion | ( | const QString & | strBuildParams | ) |

Parameters

  strBuildParams | string to build the filter "mzExclusion|0.02dalton"

Definition at line 34 of file filterexclusionmz.cpp.

{
buildFilterFromString(strBuildParams);
}
pappso::FilterMzExclusion::buildFilterFromString
void buildFilterFromString(const QString &strBuildParams) override
build this filter using a string
Definition filterexclusionmz.cpp:54

References buildFilterFromString().

## FilterMzExclusion() [3/3]

FilterMzExclusion::FilterMzExclusion | ( | const FilterMzExclusion & | other | ) |

Copy constructor

Parameters

  other | TODO

Definition at line 44 of file filterexclusionmz.cpp.

: m_exclusionPrecision(other.m_exclusionPrecision)
{
}

## ~FilterMzExclusion()

FilterMzExclusion::~FilterMzExclusion | ( |  | ) |

virtual

Destructor

Definition at line 49 of file filterexclusionmz.cpp.

{
}

## Member Function Documentation

## buildFilterFromString()

void pappso::FilterMzExclusion::buildFilterFromString | ( | const QString & | strBuildParams | ) |

override private virtual

build this filter using a string

Parameters

  strBuildParams | a string coding the filter and its parameters "filterName|param1;param2;param3"

Implements pappso::FilterNameInterface.

Definition at line 54 of file filterexclusionmz.cpp.

{
qDebug();
if(strBuildParams.startsWith("mzExclusion|"))
{
QStringList params =
strBuildParams.split("|").back().split(";", Qt::SkipEmptyParts);
QString precision = params.at(0);
m_exclusionPrecision =
PrecisionFactory::fromString(precision.replace("dalton", " dalton")
.replace("ppm", " ppm")
.replace("res", " res"));
}
else
{
throw pappso::ExceptionNotRecognized(
QString("building mzExclusion from string %1 is not possible")
.arg(strBuildParams));
}
qDebug();
}
pappso::ExceptionNotRecognized
excetion to use when an item type is not recognized
Definition exceptionnotrecognized.h:42
pappso::PrecisionFactory::fromString
static PrecisionPtr fromString(const QString &str)
get a precision pointer from a string
Definition precision.cpp:72

References pappso::PrecisionFactory::fromString().

Referenced by FilterMzExclusion().

## filter()

pappso::Trace & pappso::FilterMzExclusion::filter | ( | pappso::Trace & | data_points | ) | const

override virtual

get all the datapoints and remove different isotope and add their intensity and change to charge = 1 when the charge is known

Returns
  a list of datapoint

Implements pappso::FilterInterface.

Definition at line 78 of file filterexclusionmz.cpp.

{
qDebug();
qDebug() << "before" << data_points.size();
data_points.sortY(SortOrder::descending);
Trace new_trace = removeTraceInExclusionMargin(data_points);
new_trace.sortX();
data_points = std::move(new_trace);
qDebug() << "after" << data_points.size();
qDebug();
return data_points;
}
pappso::FilterMzExclusion::removeTraceInExclusionMargin
Trace removeTraceInExclusionMargin(Trace &points) const
Definition filterexclusionmz.cpp:111
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::Trace::sortY
void sortY(SortOrder sort_order=SortOrder::ascending)
Definition trace.cpp:1100
pappso::SortOrder::descending
@ descending

References pappso::descending, pappso::Trace::sortX(), and pappso::Trace::sortY().

## name()

QString pappso::FilterMzExclusion::name | ( |  | ) | const

override virtual

Implements pappso::FilterNameInterface.

Definition at line 93 of file filterexclusionmz.cpp.

{
return "mzExclusion";
}

## removeTraceInExclusionMargin()

pappso::Trace pappso::FilterMzExclusion::removeTraceInExclusionMargin | ( | pappso::Trace & | points | ) | const

private

Definition at line 111 of file filterexclusionmz.cpp.

{
Trace new_trace;
std::vector<MzRange> excluded_ranges;
for(auto &data_point : points)
{
auto exclude_index = excluded_ranges.begin(), end = excluded_ranges.end();
exclude_index =
std::find_if(exclude_index, end, [&data_point](MzRange range) {
return (data_point.x >= range.lower() &&
data_point.x <= range.upper());
});
if(exclude_index == end)
{
new_trace.push_back(data_point);
MzRange new_range(data_point.x, m_exclusionPrecision);
excluded_ranges.push_back(new_range);
}
}
return new_trace;
}
pappso::MzRange
Definition mzrange.h:46
pappso::MzRange::lower
pappso_double lower() const
Definition mzrange.h:71
pappso::MzRange::upper
pappso_double upper() const
Definition mzrange.h:77

References pappso::MzRange::lower(), and pappso::MzRange::upper().

## toString()

QString pappso::FilterMzExclusion::toString | ( |  | ) | const

override virtual

Implements pappso::FilterNameInterface.

Definition at line 100 of file filterexclusionmz.cpp.

{
QString strCode =
QString("%1|%2").arg(name()).arg(m_exclusionPrecision->toString());
strCode.replace(" ", "");
return strCode;
}
pappso::FilterMzExclusion::name
QString name() const override
Definition filterexclusionmz.cpp:93
pappso::PrecisionBase::toString
virtual QString toString() const =0

## Member Data Documentation

## m_exclusionPrecision

PrecisionPtr pappso::FilterMzExclusion::m_exclusionPrecision

private

Definition at line 79 of file filterexclusionmz.h.

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

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