libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
filterpass.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/filers/filterpass.h
3 * \date 26/04/2019
4 * \author Olivier Langella
5 * \brief collection of filters concerned by Y selection
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
10 *
11 * This file is part of the PAPPSOms++ library.
12 *
13 * PAPPSOms++ is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PAPPSOms++ is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25 *
26 ******************************************************************************/
27
28#pragma once
29
30#include "filternameinterface.h"
31#include <cstddef>
33
34
35namespace pappso
36{
37
38/** @brief remove datapoints higher than a given Y value (intensity)
39 */
41{
42 private:
43 double m_passY = 0;
44
45 public:
46 FilterLowPass(double pass_y);
47 FilterLowPass(const FilterLowPass &other);
48 virtual ~FilterLowPass(){};
49
50 FilterLowPass &operator=(const FilterLowPass &other);
51
52 Trace &filter(Trace &data_points) const override;
53};
54
55/** @brief remove datapoints below a given Y value (intensity)
56 */
58{
59 private:
60 double m_passY = 0;
61
62 public:
63 FilterHighPass(double pass_y);
64 FilterHighPass(const FilterHighPass &other);
65 virtual ~FilterHighPass(){};
66
67 FilterHighPass &operator=(const FilterHighPass &other);
68
69 Trace &filter(Trace &data_points) const override;
70};
71
72/** @brief remove datapoints below a given intensity percentage (ratio) of the
73 * maximum intensity
74 */
76{
77
78 public:
79 FilterHighPassPercentage(double y_ratio);
82
84
85 Trace &filter(Trace &data_points) const override;
86
87
88 private:
89 double m_ratioPassY = 0;
90};
91
92
93/** @brief keep N datapoints form the greatest intensities to the lowest
94 */
96{
97 public:
98 /** @brief constructor with the number of datapoints to keep
99 *
100 * @param number_of_points maximum number of points accepted in resulting
101 * spectrum
102 */
103 FilterGreatestY(std::size_t number_of_points = 0);
104 FilterGreatestY(const FilterGreatestY &other);
105 virtual ~FilterGreatestY(){};
106
107 FilterGreatestY &operator=(const FilterGreatestY &other);
108 Trace &filter(Trace &data_points) const override;
109
110 std::size_t getNumberOfPoints() const;
111
112
113 private:
114 std::size_t m_numberOfPoints = 0;
115};
116
117
118/** @brief keep N datapoints form the greatest intensities to the lowest within
119 * a mass range in dalton
120 */
122{
123 public:
124 /** @brief constructor with the number of datapoints to keep
125 *
126 * @param window_range mass range to consider (must be greater than 0.5)
127 * @param number_of_points_per_window maximum number of points accepted per
128 * mass window in resulting spectrum
129 */
130 FilterGreatestYperWindow(double window_range, std::size_t number_of_points_per_window);
133
134 FilterGreatestYperWindow &operator=(const FilterGreatestYperWindow &other);
135 Trace &filter(Trace &data_points) const override;
136
137 std::size_t getNumberOfPoints() const;
138
139
140 private:
141 double m_xWindowRange = 1;
142 std::size_t m_numberOfPoints = 0;
143};
144
159
160/** @brief apply std::floor (round to lowest integer) to all Y values
161 */
163{
164
165 public:
166 FilterFloorY();
167 FilterFloorY(const FilterFloorY &other);
168 virtual ~FilterFloorY(){};
169
170 FilterFloorY &operator=(const FilterFloorY &other);
171 Trace &filter(Trace &data_points) const override;
172};
173
174
175/** @brief apply std::round (round to nearest integer) to all Y values
176 */
178{
179
180 public:
181 FilterRoundY();
182 FilterRoundY(const FilterRoundY &other);
183 virtual ~FilterRoundY(){};
184
185 FilterRoundY &operator=(const FilterRoundY &other);
186 Trace &filter(Trace &data_points) const override;
187};
188
189/** @brief rescales Y values into a dynamic range
190 * if the dynamic range is set to 0, this filter is ignored
191 */
193{
194 private:
195 double m_dynamic = 0;
196
197 public:
198 FilterRescaleY(double dynamic);
199 FilterRescaleY(const FilterRescaleY &other);
200 virtual ~FilterRescaleY(){};
201
202 FilterRescaleY &operator=(const FilterRescaleY &other);
203 double getDynamicRange() const;
204
205 Trace &filter(Trace &data_points) const override;
206};
207
208
209/** @brief rescales Y values given a tranformation factor
210 */
212{
213 private:
214 double m_factor = 0;
215
216 public:
220
221 FilterScaleFactorY &operator=(const FilterScaleFactorY &other);
222
223 Trace &filter(Trace &data_points) const override;
224
225 double getScaleFactorY() const;
226};
227
228
229/** @brief removes a value to all Y values
230 */
232{
233 public:
234 FilterRemoveY(const QString &strBuildParams);
235 FilterRemoveY(double valueToRemove);
236 FilterRemoveY(const FilterRemoveY &other);
237 virtual ~FilterRemoveY(){};
238
239 FilterRemoveY &operator=(const FilterRemoveY &other);
240
241 Trace &filter(Trace &data_points) const override;
242
243 double getValue() const;
244
245
246 void buildFilterFromString(const QString &strBuildParams) override;
247
248 QString toString() const override;
249
250 QString name() const override;
251
252 private:
253 double m_valueToRemove = 0;
254};
255
256
257/** @brief removes a value found by quantile to all Y values
258 *
259 * sort all values by Y intensity and take the iest value located at the defined
260 * quantile the use it to remove this value to all Y intensities
261 */
263{
264 public:
265 FilterQuantileBasedRemoveY(double quantile_threshold);
266
267 /**
268 * @param strBuildParams string to build the filter
269 * "passQuantileBasedRemoveY|0.6"
270 */
271 FilterQuantileBasedRemoveY(const QString &strBuildParams);
272
275
277
278 Trace &filter(Trace &data_points) const override;
279
280 double getQuantileThreshold() const;
281
282 virtual QString name() const override;
283 QString toString() const override;
284
285 protected:
286 void buildFilterFromString(const QString &strBuildParams) override;
287
288 private:
289 double m_quantile = 0;
290};
291
292} // namespace pappso
apply std::floor (round to lowest integer) to all Y values
Definition filterpass.h:163
virtual ~FilterFloorY()
Definition filterpass.h:168
keep N datapoints form the greatest intensities to the lowest
Definition filterpass.h:96
FilterGreatestY(std::size_t number_of_points=0)
constructor with the number of datapoints to keep
std::size_t m_numberOfPoints
Definition filterpass.h:114
keep N datapoints form the greatest intensities to the lowest within a mass range in dalton
Definition filterpass.h:122
FilterGreatestYperWindow(double window_range, std::size_t number_of_points_per_window)
constructor with the number of datapoints to keep
remove datapoints below a given intensity percentage (ratio) of the maximum intensity
Definition filterpass.h:76
FilterHighPassPercentage(double y_ratio)
remove datapoints below a given Y value (intensity)
Definition filterpass.h:58
FilterHighPass(double pass_y)
virtual ~FilterHighPass()
Definition filterpass.h:65
generic interface to apply a filter on a trace
remove datapoints higher than a given Y value (intensity)
Definition filterpass.h:41
FilterLowPass(double pass_y)
virtual ~FilterLowPass()
Definition filterpass.h:48
Interface that allows to build filter objects from strings.
removes a value found by quantile to all Y values
Definition filterpass.h:263
FilterQuantileBasedRemoveY(double quantile_threshold)
removes a value to all Y values
Definition filterpass.h:232
FilterRemoveY(const QString &strBuildParams)
rescales Y values into a dynamic range if the dynamic range is set to 0, this filter is ignored
Definition filterpass.h:193
FilterRescaleY(double dynamic)
apply std::round (round to nearest integer) to all Y values
Definition filterpass.h:178
virtual ~FilterRoundY()
Definition filterpass.h:183
rescales Y values given a tranformation factor
Definition filterpass.h:212
FilterScaleFactorY(double m_factor)
MassSpectrumFilterGreatestItensities(std::size_t number_of_points=0)
generic interface to apply a filter on a MassSpectrum This is the same as FilterInterface,...
Class to represent a mass spectrum.
A simple container of DataPoint instances.
Definition trace.h:148
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
@ filter
concerning filters (psm, peptide, protein validation)