Loading...
Searching...
No Matches
filterpass.h
Go to the documentation of this file.
/**
* \file pappsomspp/filers/filterpass.h
* \date 26/04/2019
* \author Olivier Langella
* \brief collection of filters concerned by Y selection
*/
/*******************************************************************************
* Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include "filternameinterface.h"
#include <cstddef>
#include "../../exportinmportconfig.h"
namespace pappso
{
/** @brief remove datapoints higher than a given Y value (intensity)
*/
class PMSPP_LIB_DECL FilterLowPass : public FilterInterface
{
private:
double m_passY = 0;
public:
FilterLowPass(double pass_y);
FilterLowPass(const FilterLowPass &other);
virtual ~FilterLowPass(){};
FilterLowPass &operator=(const FilterLowPass &other);
Trace &filter(Trace &data_points) const override;
};
/** @brief remove datapoints below a given Y value (intensity)
*/
class PMSPP_LIB_DECL FilterHighPass : public FilterInterface
{
private:
double m_passY = 0;
public:
FilterHighPass(double pass_y);
FilterHighPass(const FilterHighPass &other);
virtual ~FilterHighPass(){};
FilterHighPass &operator=(const FilterHighPass &other);
Trace &filter(Trace &data_points) const override;
};
/** @brief remove datapoints below a given intensity percentage (ratio) of the
* maximum intensity
*/
class PMSPP_LIB_DECL FilterHighPassPercentage : public FilterInterface
{
public:
FilterHighPassPercentage(double y_ratio);
FilterHighPassPercentage(const FilterHighPassPercentage &other);
virtual ~FilterHighPassPercentage(){};
FilterHighPassPercentage &operator=(const FilterHighPassPercentage &other);
Trace &filter(Trace &data_points) const override;
private:
double m_ratioPassY = 0;
};
/** @brief keep N datapoints form the greatest intensities to the lowest
*/
class PMSPP_LIB_DECL FilterGreatestY : public FilterInterface
{
public:
/** @brief constructor with the number of datapoints to keep
*
* @param number_of_points maximum number of points accepted in resulting
* spectrum
*/
FilterGreatestY(std::size_t number_of_points = 0);
FilterGreatestY(const FilterGreatestY &other);
virtual ~FilterGreatestY(){};
FilterGreatestY &operator=(const FilterGreatestY &other);
Trace &filter(Trace &data_points) const override;
std::size_t getNumberOfPoints() const;
private:
std::size_t m_numberOfPoints = 0;
};
/** @brief keep N datapoints form the greatest intensities to the lowest within
* a mass range in dalton
*/
class PMSPP_LIB_DECL FilterGreatestYperWindow : public FilterInterface
{
public:
/** @brief constructor with the number of datapoints to keep
*
* @param window_range mass range to consider (must be greater than 0.5)
* @param number_of_points_per_window maximum number of points accepted per
* mass window in resulting spectrum
*/
FilterGreatestYperWindow(double window_range,
std::size_t number_of_points_per_window);
FilterGreatestYperWindow(const FilterGreatestYperWindow &other);
virtual ~FilterGreatestYperWindow(){};
FilterGreatestYperWindow &operator=(const FilterGreatestYperWindow &other);
Trace &filter(Trace &data_points) const override;
std::size_t getNumberOfPoints() const;
private:
double m_xWindowRange = 1;
std::size_t m_numberOfPoints = 0;
};
class PMSPP_LIB_DECL MassSpectrumFilterGreatestItensities
: public MassSpectrumFilterInterface
{
private:
FilterGreatestY m_filterGreatestY;
public:
MassSpectrumFilterGreatestItensities(std::size_t number_of_points = 0);
MassSpectrumFilterGreatestItensities(
const MassSpectrumFilterGreatestItensities &other);
virtual ~MassSpectrumFilterGreatestItensities(){};
MassSpectrumFilterGreatestItensities &
operator=(const MassSpectrumFilterGreatestItensities &other);
MassSpectrum &filter(MassSpectrum &spectrum) const override;
};
/** @brief apply std::floor (round to lowest integer) to all Y values
*/
class PMSPP_LIB_DECL FilterFloorY : public FilterInterface
{
public:
FilterFloorY();
FilterFloorY(const FilterFloorY &other);
virtual ~FilterFloorY(){};
FilterFloorY &operator=(const FilterFloorY &other);
Trace &filter(Trace &data_points) const override;
};
/** @brief apply std::round (round to nearest integer) to all Y values
*/
class PMSPP_LIB_DECL FilterRoundY : public FilterInterface
{
public:
FilterRoundY();
FilterRoundY(const FilterRoundY &other);
virtual ~FilterRoundY(){};
FilterRoundY &operator=(const FilterRoundY &other);
Trace &filter(Trace &data_points) const override;
};
/** @brief rescales Y values into a dynamic range
* if the dynamic range is set to 0, this filter is ignored
*/
class PMSPP_LIB_DECL FilterRescaleY : public FilterInterface
{
private:
double m_dynamic = 0;
public:
FilterRescaleY(double dynamic);
FilterRescaleY(const FilterRescaleY &other);
virtual ~FilterRescaleY(){};
FilterRescaleY &operator=(const FilterRescaleY &other);
double getDynamicRange() const;
Trace &filter(Trace &data_points) const override;
};
/** @brief rescales Y values given a tranformation factor
*/
class PMSPP_LIB_DECL FilterScaleFactorY : public FilterInterface
{
private:
double m_factor = 0;
public:
FilterScaleFactorY(double m_factor);
FilterScaleFactorY(const FilterScaleFactorY &other);
virtual ~FilterScaleFactorY(){};
FilterScaleFactorY &operator=(const FilterScaleFactorY &other);
Trace &filter(Trace &data_points) const override;
double getScaleFactorY() const;
};
/** @brief removes a value to all Y values
*/
class PMSPP_LIB_DECL FilterRemoveY : public FilterInterface
{
private:
double m_valueToRemove = 0;
public:
FilterRemoveY(double valueToRemove);
FilterRemoveY(const FilterRemoveY &other);
virtual ~FilterRemoveY(){};
FilterRemoveY &operator=(const FilterRemoveY &other);
Trace &filter(Trace &data_points) const override;
double getValue() const;
};
/** @brief removes a value found by quantile to all Y values
*
* sort all values by Y intensity and take the iest value located at the defined
* quantile the use it to remove this value to all Y intensities
*/
class PMSPP_LIB_DECL FilterQuantileBasedRemoveY : public FilterNameInterface
{
public:
FilterQuantileBasedRemoveY(double quantile_threshold);
/**
* @param strBuildParams string to build the filter
* "passQuantileBasedRemoveY|0.6"
*/
FilterQuantileBasedRemoveY(const QString &strBuildParams);
FilterQuantileBasedRemoveY(const FilterQuantileBasedRemoveY &other);
virtual ~FilterQuantileBasedRemoveY(){};
FilterQuantileBasedRemoveY &
operator=(const FilterQuantileBasedRemoveY &other);
Trace &filter(Trace &data_points) const override;
double getQuantileThreshold() const;
virtual QString name() const override;
QString toString() const override;
protected:
void buildFilterFromString(const QString &strBuildParams) override;
private:
double m_quantile = 0;
};
} // namespace pappso
pappso::FilterFloorY
apply std::floor (round to lowest integer) to all Y values
Definition filterpass.h:166
pappso::FilterFloorY::~FilterFloorY
virtual ~FilterFloorY()
Definition filterpass.h:171
pappso::FilterGreatestY
keep N datapoints form the greatest intensities to the lowest
Definition filterpass.h:96
pappso::FilterGreatestY::~FilterGreatestY
virtual ~FilterGreatestY()
Definition filterpass.h:105
pappso::FilterGreatestYperWindow
keep N datapoints form the greatest intensities to the lowest within a mass range in dalton
Definition filterpass.h:122
pappso::FilterGreatestYperWindow::~FilterGreatestYperWindow
virtual ~FilterGreatestYperWindow()
Definition filterpass.h:133
pappso::FilterHighPassPercentage
remove datapoints below a given intensity percentage (ratio) of the maximum intensity
Definition filterpass.h:76
pappso::FilterHighPassPercentage::~FilterHighPassPercentage
virtual ~FilterHighPassPercentage()
Definition filterpass.h:81
pappso::FilterHighPass
remove datapoints below a given Y value (intensity)
Definition filterpass.h:58
pappso::FilterHighPass::~FilterHighPass
virtual ~FilterHighPass()
Definition filterpass.h:65
pappso::FilterInterface
generic interface to apply a filter on a trace
Definition filterinterface.h:40
pappso::FilterLowPass
remove datapoints higher than a given Y value (intensity)
Definition filterpass.h:41
pappso::FilterLowPass::~FilterLowPass
virtual ~FilterLowPass()
Definition filterpass.h:48
pappso::FilterNameInterface
Interface that allows to build filter objects from strings.
Definition filternameinterface.h:42
pappso::FilterQuantileBasedRemoveY
removes a value found by quantile to all Y values
Definition filterpass.h:258
pappso::FilterQuantileBasedRemoveY::~FilterQuantileBasedRemoveY
virtual ~FilterQuantileBasedRemoveY()
Definition filterpass.h:269
pappso::FilterRemoveY
removes a value to all Y values
Definition filterpass.h:235
pappso::FilterRemoveY::~FilterRemoveY
virtual ~FilterRemoveY()
Definition filterpass.h:242
pappso::FilterRescaleY
rescales Y values into a dynamic range if the dynamic range is set to 0, this filter is ignored
Definition filterpass.h:196
pappso::FilterRescaleY::~FilterRescaleY
virtual ~FilterRescaleY()
Definition filterpass.h:203
pappso::FilterRoundY
apply std::round (round to nearest integer) to all Y values
Definition filterpass.h:181
pappso::FilterRoundY::~FilterRoundY
virtual ~FilterRoundY()
Definition filterpass.h:186
pappso::FilterScaleFactorY
rescales Y values given a tranformation factor
Definition filterpass.h:215
pappso::FilterScaleFactorY::~FilterScaleFactorY
virtual ~FilterScaleFactorY()
Definition filterpass.h:222
pappso::MassSpectrumFilterGreatestItensities
Definition filterpass.h:148
pappso::MassSpectrumFilterGreatestItensities::~MassSpectrumFilterGreatestItensities
virtual ~MassSpectrumFilterGreatestItensities()
Definition filterpass.h:156
pappso::MassSpectrumFilterGreatestItensities::m_filterGreatestY
FilterGreatestY m_filterGreatestY
Definition filterpass.h:150
pappso::MassSpectrumFilterInterface
generic interface to apply a filter on a MassSpectrum This is the same as FilterInterface,...
Definition filterinterface.h:56
pappso::MassSpectrum
Class to represent a mass spectrum.
Definition massspectrum.h:73
pappso::Trace
A simple container of DataPoint instances.
Definition trace.h:148
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition exportinmportconfig.h:14
filternameinterface.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39