libpappsomspp
Library for mass spectrometry
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"
32#include "filterpass.h"
33#include "filtermorpho.h"
34#include <QStringList>
35#include <QDebug>
37#include "filterexclusionmz.h"
38
39
40namespace pappso
41{
42FilterSuiteString::FilterSuiteString(const QString &strBuildParams)
43{
44 buildFilterFromString(strBuildParams);
45}
46
50
51
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
70QString
72{
73 // FIXME: check if this makes sense
74 return "Suite of filters";
75}
76
77
78QString
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
91void
92FilterSuiteString::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
141void
142FilterSuiteString::addFilterFromString(const QString &strBuildParams)
143{
144 buildFilterFromString(strBuildParams);
145}
146
147void
152
153FilterSuiteString::FilterNameType::const_iterator
155{
156 return m_filterVector.begin();
157};
158FilterSuiteString::FilterNameType::const_iterator
160{
161 return m_filterVector.end();
162};
163
164} // namespace pappso
excetion to use when an item type is not recognized
pappso::Trace & filter(pappso::Trace &data_points) const override
FilterNameType::const_iterator begin()
void buildFilterFromString(const QString &strBuildParams) override
build this filter using a string
std::vector< FilterNameInterfaceCstSPtr > m_filterVector
FilterNameType::const_iterator end()
FilterSuiteString(const QString &strBuildParams)
QString toString() const override
void addFilterFromString(const QString &strBuildParams)
takes a string that describes filters to add
virtual QString name() const override
void addFilter(const pappso::FilterNameInterfaceSPtr &filter)
add a filter to the suite
A simple container of DataPoint instances.
Definition trace.h:148
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< FilterNameInterface > FilterNameInterfaceSPtr