libpappsomspp
Library for mass spectrometry
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 <QStringList>
33 #include <QDebug>
34 #include "../../exception/exceptionnotrecognized.h"
35 namespace pappso
36 {
37 FilterSuiteString::FilterSuiteString(const QString &strBuildParams)
38 {
39  buildFilterFromString(strBuildParams);
40 }
41 
43 {
44 }
45 
46 
49 {
50 
51  qDebug();
52  for(auto &&filter : m_filterVector)
53  {
54 
55  qDebug() << filter.get();
56  qDebug() << filter->toString();
57  filter->filter(data_points);
58  }
59 
60  qDebug();
61  return data_points;
62 }
63 QString
65 {
66  QStringList filter_str_list;
67  for(auto &&filter : m_filterVector)
68  {
69  filter_str_list << filter->toString();
70  }
71 
72  return filter_str_list.join(" ");
73 }
74 
75 void
76 FilterSuiteString::buildFilterFromString(const QString &strBuildParams)
77 {
78  qDebug() << strBuildParams;
79  QStringList filters = strBuildParams.split(" ", QString::SkipEmptyParts);
80  for(QString filter_str : filters)
81  {
82  qDebug() << filter_str;
83  if(filter_str.startsWith("complementIonEnhancer|"))
84  {
85  m_filterVector.push_back(
86  std::make_shared<FilterComplementIonEnhancer>(filter_str));
87  }
88  else
89  {
90  if(filter_str.startsWith("chargeDeconvolution|"))
91  {
92  m_filterVector.push_back(
93  std::make_shared<FilterChargeDeconvolution>(filter_str));
94  }
95  else
96  {
98  QString("building Filter from string %1 is "
99  "not possible")
100  .arg(filter_str));
101  }
102  }
103  }
104 }
105 
106 } // namespace pappso
pappso::FilterSuiteString::FilterSuiteString
FilterSuiteString(const QString &strBuildParams)
Definition: filtersuitestring.cpp:37
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
pappso::Trace::toString
QString toString() const
Definition: trace.cpp:820
pappso::Trace::filter
virtual Trace & filter(const FilterInterface &filter) final
apply a filter on this trace
Definition: trace.cpp:837
pappso::FilterSuiteString::buildFilterFromString
void buildFilterFromString(const QString &strBuildParams) override
build this filer using a string
Definition: filtersuitestring.cpp:76
pappso::FilterSuiteString::filter
pappso::Trace & filter(pappso::Trace &data_points) const override
Definition: filtersuitestring.cpp:48
pappso::Trace
A simple container of DataPoint instances.
Definition: trace.h:132
pappso::ExceptionNotRecognized
excetion to use when an item type is not recognized
Definition: exceptionnotrecognized.h:42
pappso::FilterSuiteString::toString
QString toString() const override
Definition: filtersuitestring.cpp:64
filtercomplementionenhancer.h
enhance ion intensity of ion fragment complement
pappso::FilterSuiteString::~FilterSuiteString
~FilterSuiteString()
Definition: filtersuitestring.cpp:42
filterchargedeconvolution.h
Sum peaks and transform mz to fit charge = 1.
pappso::FilterSuiteString::m_filterVector
std::vector< FilterNameInterfaceCstSPtr > m_filterVector
Definition: filtersuitestring.h:62
filtersuitestring.h