xic.cpp
Go to the documentation of this file.
/*
* *******************************************************************************
* * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
* *
* * This file is part of MassChroqPRM.
* *
* * MassChroqPRM 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.
* *
* * MassChroqPRM 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 MassChroqPRM. If not, see <http://www.gnu.org/licenses/>.
* *
* * Contributors:
* * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
* implementation
* ******************************************************************************/
#include <QDebug>
#include "xic.h"
#include <algorithm>
#include <cmath>
#include "../exception/exceptionoutofrange.h"
namespace pappso
{
Xic::Xic()
{
qDebug() << "Xic::Xic begin";
qDebug() << "Xic::Xic end";
}
Xic::~Xic()
{
}
XicCstSPtr
Xic::makeXicCstSPtr() const
{
return std::make_shared<const Xic>(*this);
}
XicSPtr
Xic::makeXicSPtr() const
{
return std::make_shared<Xic>(*this);
}
void
Xic::debugPrintValues() const
{
for(auto &&peak : *this)
{
qDebug() << "rt = " << peak.x << ", int = " << peak.y;
}
}
const DataPoint &
Xic::atRetentionTime(pappso_double rt) const
{
for(auto &&peak : *this)
{
if(peak.y == rt)
return peak;
}
throw ExceptionOutOfRange(
QObject::tr("no intensity for this retention time"));
}
unsigned int
Xic::getMsPointDistance(pappso_double rt_first, pappso_double rt_second) const
{
if(rt_first > rt_second)
{
std::swap(rt_first, rt_second);
}
unsigned int distance = 0;
auto it = this->begin();
auto itend = this->end();
while((it->x < rt_first) && (it != itend))
{
it++;
}
while((rt_second > it->x) && (it != itend))
{
qDebug() << "Xic::getMsPointDistance " << rt_first << " it->rt " << it->x
<< " rt_second " << rt_second << distance;
distance++;
it++;
}
return distance;
}
void
Xic::sortByRetentionTime()
{
sortX();
}
} // namespace pappso
pappso::ExceptionOutOfRange
Definition: exceptionoutofrange.h:32
pappso::Trace::sortX
void sortX()
Definition: trace.cpp:905
pappso::Xic::atRetentionTime
const DataPoint & atRetentionTime(pappso_double rt) const
get the DataPoint at the given retention time
Definition: xic.cpp:68
pappso::Xic::sortByRetentionTime
void sortByRetentionTime()
sort peaks by retention time
Definition: xic.cpp:107
pappso::Xic::makeXicCstSPtr
XicCstSPtr makeXicCstSPtr() const
Definition: xic.cpp:47
pappso::Xic::debugPrintValues
void debugPrintValues() const
Definition: xic.cpp:59
pappso::Xic::getMsPointDistance
unsigned int getMsPointDistance(pappso_double rt, pappso_double rt_other) const
get the number of MS measurement between 2 retention times on this xic
Definition: xic.cpp:80
pappso::Xic::Xic
Xic()
Definition: xic.cpp:35
pappso::Xic::makeXicSPtr
XicSPtr makeXicSPtr() const
Definition: xic.cpp:53
pappso::Xic::~Xic
virtual ~Xic()
Definition: xic.cpp:41
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
pappso::XicCstSPtr
std::shared_ptr< const Xic > XicCstSPtr
Definition: xic.h:37
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition: types.h:48
pappso::XicSPtr
std::shared_ptr< Xic > XicSPtr
Definition: xic.h:39
pappso::DataKind::rt
@ rt
Retention time.
pappso::DataPoint
Definition: datapoint.h:21
xic.h