libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
filtersuitestring.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/processing/filers/filtersuitestring.cpp
3
* \date 17/11/2020
4
* \author Olivier Langella
5
* \brief build a filter suite from a string
6
*/
7
8
/*******************************************************************************
9
* Copyright (c) 2020 Olivier Langella
10
*<olivier.langella@universite-paris-saclay.fr>
11
*
12
* This file is part of the PAPPSOms++ library.
13
*
14
* PAPPSOms++ is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License as published by
16
* the Free Software Foundation, either version 3 of the License, or
17
* (at your option) any later version.
18
*
19
* PAPPSOms++ is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
26
*
27
******************************************************************************/
28
29
#include "
filtersuitestring.h
"
30
#include "
filterchargedeconvolution.h
"
31
#include "
filtercomplementionenhancer.h
"
32
#include "
filterpass.h
"
33
#include "
filtermorpho.h
"
34
#include <QStringList>
35
#include <QDebug>
36
#include "
pappsomspp/core/exception/exceptionnotrecognized.h
"
37
#include "
filterexclusionmz.h
"
38
39
40
namespace
pappso
41
{
42
FilterSuiteString::FilterSuiteString
(
const
QString &strBuildParams)
43
{
44
buildFilterFromString
(strBuildParams);
45
}
46
47
FilterSuiteString::~FilterSuiteString
()
48
{
49
}
50
51
52
pappso::Trace
&
53
FilterSuiteString::filter
(
pappso::Trace
&data_points)
const
54
{
55
56
qDebug();
57
for
(
auto
&&
filter
:
m_filterVector
)
58
{
59
60
qDebug() <<
filter
.get();
61
qDebug() <<
filter
->toString();
62
filter
->filter(data_points);
63
}
64
65
qDebug();
66
return
data_points;
67
}
68
69
70
QString
71
pappso::FilterSuiteString::name
()
const
72
{
73
// FIXME: check if this makes sense
74
return
"Suite of filters"
;
75
}
76
77
78
QString
79
FilterSuiteString::toString
()
const
80
{
81
QStringList filter_str_list;
82
for
(
auto
&&
filter
:
m_filterVector
)
83
{
84
filter_str_list <<
filter
->toString();
85
}
86
87
return
filter_str_list.join(
" "
);
88
}
89
90
91
void
92
FilterSuiteString::buildFilterFromString
(
const
QString &strBuildParams)
93
{
94
// qInfo() << strBuildParams;
95
QStringList filters = strBuildParams.split(
" "
, Qt::SkipEmptyParts);
96
for
(QString filter_str : filters)
97
{
98
if
(filter_str.startsWith(
"complementIonEnhancer|"
))
99
{
100
m_filterVector
.push_back(std::make_shared<FilterComplementIonEnhancer>(filter_str));
101
}
102
else
if
(filter_str.startsWith(
"chargeDeconvolution|"
))
103
{
104
m_filterVector
.push_back(std::make_shared<FilterChargeDeconvolution>(filter_str));
105
}
106
else
if
(filter_str.startsWith(
"mzExclusion|"
))
107
{
108
m_filterVector
.push_back(std::make_shared<FilterMzExclusion>(filter_str));
109
}
110
else
if
(filter_str.startsWith(
"passQuantileBasedRemoveY|"
))
111
{
112
m_filterVector
.push_back(std::make_shared<FilterQuantileBasedRemoveY>(filter_str));
113
}
114
115
else
if
(filter_str.startsWith(
"antiSpike|"
))
116
{
117
m_filterVector
.push_back(std::make_shared<FilterMorphoAntiSpike>(filter_str));
118
}
119
else
if
(filter_str.startsWith(
"morphoBackground|"
))
120
{
121
m_filterVector
.push_back(std::make_shared<FilterMorphoBackground>(filter_str));
122
}
123
else
if
(filter_str.startsWith(
"removeY|"
))
124
{
125
m_filterVector
.push_back(std::make_shared<FilterRemoveY>(filter_str));
126
}
127
128
else
if
(filter_str.startsWith(
"morphoMean|"
))
129
{
130
m_filterVector
.push_back(std::make_shared<FilterMorphoMean>(filter_str));
131
}
132
else
133
{
134
throw
pappso::ExceptionNotRecognized
(QString(
"building Filter from string %1 is "
135
"not possible"
)
136
.arg(filter_str));
137
}
138
}
139
}
140
141
void
142
FilterSuiteString::addFilterFromString
(
const
QString &strBuildParams)
143
{
144
buildFilterFromString
(strBuildParams);
145
}
146
147
void
148
pappso::FilterSuiteString::addFilter
(
const
pappso::FilterNameInterfaceSPtr
&
filter
)
149
{
150
m_filterVector
.push_back(
filter
);
151
}
152
153
FilterSuiteString::FilterNameType::const_iterator
154
FilterSuiteString::begin
()
155
{
156
return
m_filterVector
.begin();
157
};
158
FilterSuiteString::FilterNameType::const_iterator
159
FilterSuiteString::end
()
160
{
161
return
m_filterVector
.end();
162
};
163
164
}
// namespace pappso
pappso::ExceptionNotRecognized
excetion to use when an item type is not recognized
Definition
exceptionnotrecognized.h:42
pappso::FilterSuiteString::filter
pappso::Trace & filter(pappso::Trace &data_points) const override
Definition
filtersuitestring.cpp:53
pappso::FilterSuiteString::begin
FilterNameType::const_iterator begin()
Definition
filtersuitestring.cpp:154
pappso::FilterSuiteString::buildFilterFromString
void buildFilterFromString(const QString &strBuildParams) override
build this filter using a string
Definition
filtersuitestring.cpp:92
pappso::FilterSuiteString::m_filterVector
std::vector< FilterNameInterfaceCstSPtr > m_filterVector
Definition
filtersuitestring.h:80
pappso::FilterSuiteString::end
FilterNameType::const_iterator end()
Definition
filtersuitestring.cpp:159
pappso::FilterSuiteString::FilterSuiteString
FilterSuiteString(const QString &strBuildParams)
Definition
filtersuitestring.cpp:42
pappso::FilterSuiteString::toString
QString toString() const override
Definition
filtersuitestring.cpp:79
pappso::FilterSuiteString::addFilterFromString
void addFilterFromString(const QString &strBuildParams)
takes a string that describes filters to add
Definition
filtersuitestring.cpp:142
pappso::FilterSuiteString::~FilterSuiteString
virtual ~FilterSuiteString()
Definition
filtersuitestring.cpp:47
pappso::FilterSuiteString::name
virtual QString name() const override
Definition
filtersuitestring.cpp:71
pappso::FilterSuiteString::addFilter
void addFilter(const pappso::FilterNameInterfaceSPtr &filter)
add a filter to the suite
Definition
filtersuitestring.cpp:148
pappso::Trace
A simple container of DataPoint instances.
Definition
trace.h:152
exceptionnotrecognized.h
filterchargedeconvolution.h
filtercomplementionenhancer.h
filterexclusionmz.h
filtermorpho.h
filterpass.h
filtersuitestring.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::FilterNameInterfaceSPtr
std::shared_ptr< FilterNameInterface > FilterNameInterfaceSPtr
Definition
filternameinterface.h:59
pappsomspp
core
processing
filters
filtersuitestring.cpp
Generated on
for libpappsomspp by
1.17.0