libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
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>
32
#include "
pappsomspp/export-import-config.h
"
33
34
35
namespace
pappso
36
{
37
38
/** @brief remove datapoints higher or equal to a given Y value (intensity)
39
*/
40
class
PMSPP_LIB_DECL
FilterLowPass
:
public
FilterInterface
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 or equal to the given Y value (intensity)
56
*/
57
class
PMSPP_LIB_DECL
FilterHighPass
:
public
FilterInterface
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
*/
75
class
PMSPP_LIB_DECL
FilterHighPassPercentage
:
public
FilterInterface
76
{
77
78
public
:
79
FilterHighPassPercentage
(
double
y_ratio);
80
FilterHighPassPercentage
(
const
FilterHighPassPercentage
&other);
81
virtual
~FilterHighPassPercentage
(){};
82
83
FilterHighPassPercentage
&operator=(
const
FilterHighPassPercentage
&other);
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
*/
95
class
PMSPP_LIB_DECL
FilterGreatestY
:
public
FilterInterface
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
*/
121
class
PMSPP_LIB_DECL
FilterGreatestYperWindow
:
public
FilterInterface
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);
131
FilterGreatestYperWindow
(
const
FilterGreatestYperWindow
&other);
132
virtual
~FilterGreatestYperWindow
(){};
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
145
class
PMSPP_LIB_DECL
MassSpectrumFilterGreatestItensities
:
public
MassSpectrumFilterInterface
146
{
147
private
:
148
FilterGreatestY
m_filterGreatestY
;
149
150
public
:
151
MassSpectrumFilterGreatestItensities
(std::size_t number_of_points = 0);
152
MassSpectrumFilterGreatestItensities
(
const
MassSpectrumFilterGreatestItensities
&other);
153
virtual
~MassSpectrumFilterGreatestItensities
(){};
154
155
MassSpectrumFilterGreatestItensities
&
156
operator=(
const
MassSpectrumFilterGreatestItensities
&other);
157
MassSpectrum
&
filter
(
MassSpectrum
&spectrum)
const override
;
158
};
159
160
/** @brief apply std::floor (round to lowest integer) to all Y values
161
*/
162
class
PMSPP_LIB_DECL
FilterFloorY
:
public
FilterInterface
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
*/
177
class
PMSPP_LIB_DECL
FilterRoundY
:
public
FilterInterface
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
*/
192
class
PMSPP_LIB_DECL
FilterRescaleY
:
public
FilterInterface
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
*/
211
class
PMSPP_LIB_DECL
FilterScaleFactorY
:
public
FilterInterface
212
{
213
private
:
214
double
m_factor
= 0;
215
216
public
:
217
FilterScaleFactorY
(
double
m_factor
);
218
FilterScaleFactorY
(
const
FilterScaleFactorY
&other);
219
virtual
~FilterScaleFactorY
(){};
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
*/
231
class
PMSPP_LIB_DECL
FilterRemoveY
:
public
FilterNameInterface
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
*/
262
class
PMSPP_LIB_DECL
FilterQuantileBasedRemoveY
:
public
FilterNameInterface
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
273
FilterQuantileBasedRemoveY
(
const
FilterQuantileBasedRemoveY
&other);
274
virtual
~FilterQuantileBasedRemoveY
(){};
275
276
FilterQuantileBasedRemoveY
&operator=(
const
FilterQuantileBasedRemoveY
&other);
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
pappso::FilterFloorY
apply std::floor (round to lowest integer) to all Y values
Definition
filterpass.h:163
pappso::FilterFloorY::~FilterFloorY
virtual ~FilterFloorY()
Definition
filterpass.h:168
pappso::FilterFloorY::FilterFloorY
FilterFloorY()
Definition
filterpass.cpp:304
pappso::FilterGreatestY
keep N datapoints form the greatest intensities to the lowest
Definition
filterpass.h:96
pappso::FilterGreatestY::FilterGreatestY
FilterGreatestY(std::size_t number_of_points=0)
constructor with the number of datapoints to keep
Definition
filterpass.cpp:142
pappso::FilterGreatestY::m_numberOfPoints
std::size_t m_numberOfPoints
Definition
filterpass.h:114
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::m_numberOfPoints
std::size_t m_numberOfPoints
Definition
filterpass.h:142
pappso::FilterGreatestYperWindow::~FilterGreatestYperWindow
virtual ~FilterGreatestYperWindow()
Definition
filterpass.h:132
pappso::FilterGreatestYperWindow::FilterGreatestYperWindow
FilterGreatestYperWindow(double window_range, std::size_t number_of_points_per_window)
constructor with the number of datapoints to keep
Definition
filterpass.cpp:194
pappso::FilterGreatestYperWindow::m_xWindowRange
double m_xWindowRange
Definition
filterpass.h:141
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::FilterHighPassPercentage::FilterHighPassPercentage
FilterHighPassPercentage(double y_ratio)
Definition
filterpass.cpp:104
pappso::FilterHighPassPercentage::m_ratioPassY
double m_ratioPassY
Definition
filterpass.h:89
pappso::FilterHighPass
remove datapoints below or equal to the given Y value (intensity)
Definition
filterpass.h:58
pappso::FilterHighPass::m_passY
double m_passY
Definition
filterpass.h:60
pappso::FilterHighPass::FilterHighPass
FilterHighPass(double pass_y)
Definition
filterpass.cpp:72
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 or equal to a given Y value (intensity)
Definition
filterpass.h:41
pappso::FilterLowPass::FilterLowPass
FilterLowPass(double pass_y)
Definition
filterpass.cpp:41
pappso::FilterLowPass::~FilterLowPass
virtual ~FilterLowPass()
Definition
filterpass.h:48
pappso::FilterLowPass::m_passY
double m_passY
Definition
filterpass.h:43
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:263
pappso::FilterQuantileBasedRemoveY::~FilterQuantileBasedRemoveY
virtual ~FilterQuantileBasedRemoveY()
Definition
filterpass.h:274
pappso::FilterQuantileBasedRemoveY::FilterQuantileBasedRemoveY
FilterQuantileBasedRemoveY(double quantile_threshold)
Definition
filterpass.cpp:526
pappso::FilterQuantileBasedRemoveY::m_quantile
double m_quantile
Definition
filterpass.h:289
pappso::FilterRemoveY
removes a value to all Y values
Definition
filterpass.h:232
pappso::FilterRemoveY::~FilterRemoveY
virtual ~FilterRemoveY()
Definition
filterpass.h:237
pappso::FilterRemoveY::FilterRemoveY
FilterRemoveY(const QString &strBuildParams)
Definition
filterpass.cpp:454
pappso::FilterRemoveY::m_valueToRemove
double m_valueToRemove
Definition
filterpass.h:253
pappso::FilterRescaleY
rescales Y values into a dynamic range if the dynamic range is set to 0, this filter is ignored
Definition
filterpass.h:193
pappso::FilterRescaleY::~FilterRescaleY
virtual ~FilterRescaleY()
Definition
filterpass.h:200
pappso::FilterRescaleY::FilterRescaleY
FilterRescaleY(double dynamic)
Definition
filterpass.cpp:353
pappso::FilterRescaleY::m_dynamic
double m_dynamic
Definition
filterpass.h:195
pappso::FilterRoundY
apply std::round (round to nearest integer) to all Y values
Definition
filterpass.h:178
pappso::FilterRoundY::~FilterRoundY
virtual ~FilterRoundY()
Definition
filterpass.h:183
pappso::FilterRoundY::FilterRoundY
FilterRoundY()
Definition
filterpass.cpp:329
pappso::FilterScaleFactorY
rescales Y values given a tranformation factor
Definition
filterpass.h:212
pappso::FilterScaleFactorY::~FilterScaleFactorY
virtual ~FilterScaleFactorY()
Definition
filterpass.h:219
pappso::FilterScaleFactorY::FilterScaleFactorY
FilterScaleFactorY(double m_factor)
Definition
filterpass.cpp:420
pappso::FilterScaleFactorY::m_factor
double m_factor
Definition
filterpass.h:214
pappso::MassSpectrumFilterGreatestItensities
Definition
filterpass.h:146
pappso::MassSpectrumFilterGreatestItensities::~MassSpectrumFilterGreatestItensities
virtual ~MassSpectrumFilterGreatestItensities()
Definition
filterpass.h:153
pappso::MassSpectrumFilterGreatestItensities::MassSpectrumFilterGreatestItensities
MassSpectrumFilterGreatestItensities(std::size_t number_of_points=0)
Definition
filterpass.cpp:391
pappso::MassSpectrumFilterGreatestItensities::m_filterGreatestY
FilterGreatestY m_filterGreatestY
Definition
filterpass.h:148
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:70
pappso::Trace
A simple container of DataPoint instances.
Definition
trace.h:152
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition
export-import-config.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
pappso::ProjectParamCategory::filter
@ filter
concerning filters (psm, peptide, protein validation)
Definition
projectparameters.h:48
pappsomspp
core
processing
filters
filterpass.h
Generated on
for libpappsomspp by
1.17.0