Loading...
Searching...
No Matches
filterremovec13.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/processing/filters/filterremovec13.h
* \date 19/08/2020
* \author Olivier Langella
* \brief sum peaks under a triangle base
*/
/*******************************************************************************
* Copyright (c) 2020 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include "filterremovec13.h"
using namespace pappso;
FilterRemoveC13::FilterRemoveC13(PrecisionPtr precision_ptr)
: m_precisionPtr(precision_ptr)
{
m_diffC12C13_z1 = DIFFC12C13;
m_diffC12C13_z2 = DIFFC12C13 / 2;
}
FilterRemoveC13::FilterRemoveC13(const FilterRemoveC13 &other)
: m_precisionPtr(other.m_precisionPtr)
{
m_diffC12C13_z1 = DIFFC12C13;
m_diffC12C13_z2 = DIFFC12C13 / 2;
}
FilterRemoveC13::~FilterRemoveC13()
{
}
Trace &
FilterRemoveC13::filter(Trace &data_points) const
{
std::vector<std::pair<double, double>> exclusionMassMap;
// qDebug() << data_points.size();
std::sort(data_points.begin(),
data_points.end(),
[](const DataPoint &a, const DataPoint &b) { return (a.y > b.y); });
Trace new_trace;
for(auto &data_point : data_points)
{
if(notExcluded(exclusionMassMap, data_point.x))
{
new_trace.push_back(data_point);
}
addExclusionMap(exclusionMassMap, data_point.x);
}
new_trace.sortX();
// qDebug() << new_trace.size();
data_points = std::move(new_trace);
// qDebug() << data_points.size();
return data_points;
}
bool
pappso::FilterRemoveC13::notExcluded(
std::vector<std::pair<double, double>> &exclusionMassMap, double mass) const
{
for(auto &mass_range : exclusionMassMap)
{
if((mass_range.first <= mass) && (mass_range.second >= mass))
{
return false;
}
}
return true;
}
void
pappso::FilterRemoveC13::addExclusionMap(
std::vector<std::pair<double, double>> &exclusionMassMap, double mass) const
{
MzRange range1(mass + m_diffC12C13_z1, m_precisionPtr);
exclusionMassMap.push_back(
std::pair<double, double>(range1.lower(), range1.upper()));
MzRange range2(mass + m_diffC12C13_z2, m_precisionPtr);
exclusionMassMap.push_back(
std::pair<double, double>(range2.lower(), range2.upper()));
}
pappso::FilterRemoveC13
Definition filterremovec13.h:45
pappso::FilterRemoveC13::notExcluded
bool notExcluded(std::vector< std::pair< double, double > > &exclusionMassMap, double mass) const
Definition filterremovec13.cpp:78
pappso::FilterRemoveC13::addExclusionMap
void addExclusionMap(std::vector< std::pair< double, double > > &exclusionMassMap, double mass) const
Definition filterremovec13.cpp:92
pappso::FilterRemoveC13::m_diffC12C13_z2
double m_diffC12C13_z2
Definition filterremovec13.h:75
pappso::FilterRemoveC13::m_diffC12C13_z1
double m_diffC12C13_z1
Definition filterremovec13.h:74
pappso::FilterRemoveC13::filter
Trace & filter(Trace &data_points) const override
Definition filterremovec13.cpp:51
pappso::FilterRemoveC13::~FilterRemoveC13
virtual ~FilterRemoveC13()
Definition filterremovec13.cpp:46
pappso::FilterRemoveC13::FilterRemoveC13
FilterRemoveC13(PrecisionPtr precision_ptr)
Definition filterremovec13.cpp:32
pappso::MzRange
Definition mzrange.h:46
pappso::MzRange::lower
pappso_double lower() const
Definition mzrange.h:71
pappso::MzRange::upper
pappso_double upper() const
Definition mzrange.h:77
pappso::PrecisionBase
Definition precision.h:44
pappso::Trace
A simple container of DataPoint instances.
Definition trace.h:148
pappso::Trace::sortX
void sortX(SortOrder sort_order=SortOrder::ascending)
Definition trace.cpp:1086
filterremovec13.h
sum peaks under a triangle base
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::PeptideIonNter::a
@ a
pappso::PeptideIonNter::b
@ b
pappso::DIFFC12C13
const pappso_double DIFFC12C13(1.0033548378)
pappso::DataPoint
Definition datapoint.h:22