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