Loading...
Searching...
No Matches
xiccoord.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/msrun/xiccoord/xiccoord.cpp
* \date 22/04/2021
* \author Olivier Langella
* \brief XIC coordinate in MSrun
*/
/*******************************************************************************
* Copyright (c) 2021 Olivier Langella
*<Olivier.Langella@universite-paris-saclay.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 "xiccoord.h"
#include <QVariant>
using namespace pappso;
pappso::XicCoord::XicCoord()
: mzRange(pappso_double(1), PrecisionFactory::getPpmInstance(10.0)),
rtTarget(0)
{
}
XicCoord::XicCoord(const XicCoord &other)
: mzRange(other.mzRange), rtTarget(other.rtTarget)
{
xicSptr = other.xicSptr;
}
XicCoord::~XicCoord()
{
}
pappso::XicCoordSPtr
pappso::XicCoord::initializeAndClone() const
{
XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
xic_coord_sp.get()->xicSptr = std::make_shared<Xic>();
return xic_coord_sp;
}
pappso::XicCoordSPtr
pappso::XicCoord::addition(XicCoordSPtr &to_add) const
{
XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
// xic_coord_sp.get()->xicSptr = nullptr;
xic_coord_sp.get()->rtTarget += to_add.get()->rtTarget;
xic_coord_sp.get()->mzRange += to_add.get()->mzRange;
return xic_coord_sp;
}
XicCoordSPtr
XicCoord::multiplyBy(double number) const
{
XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
// xic_coord_sp.get()->xicSptr = nullptr;
xic_coord_sp.get()->rtTarget *= number;
xic_coord_sp.get()->mzRange *= number;
return xic_coord_sp;
}
pappso::XicCoordSPtr
pappso::XicCoord::divideBy(double number) const
{
XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
// xic_coord_sp.get()->xicSptr = nullptr;
xic_coord_sp.get()->rtTarget /= number;
xic_coord_sp.get()->mzRange *= (double)((double)1 / number);
return xic_coord_sp;
}
void
pappso::XicCoord::reset()
{
xicSptr = nullptr;
rtTarget = 0;
mzRange = MzRange(0.0, 0.0);
}
QString
pappso::XicCoord::toString() const
{
return QString("mz=%1 rt=%2").arg(mzRange.toString()).arg(rtTarget);
}
const QVariant
pappso::XicCoord::getParam(XicCoordParam param [[maybe_unused]]) const
{
return QVariant();
}
pappso::MzRange
Definition mzrange.h:46
pappso::PrecisionFactory
Definition precision.h:127
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::XicCoordParam
XicCoordParam
Definition xiccoord.h:50
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:50
pappso::XicCoordSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:43
pappso::XicCoord
coordinates of the XIC to extract and the resulting XIC after extraction
Definition xiccoord.h:67
pappso::XicCoord::xicSptr
XicSPtr xicSptr
extracted xic
Definition xiccoord.h:130
pappso::XicCoord::initializeAndClone
virtual XicCoordSPtr initializeAndClone() const
intialize the XIC and make a deep copy of object
Definition xiccoord.cpp:54
pappso::XicCoord::multiplyBy
virtual XicCoordSPtr multiplyBy(double number) const
compute a new xic coord as a product by
Definition xiccoord.cpp:79
pappso::XicCoord::reset
virtual void reset()
reset to zero
Definition xiccoord.cpp:106
pappso::XicCoord::addition
virtual XicCoordSPtr addition(XicCoordSPtr &to_add) const
compute a new XIC coord as the sum of the given one
Definition xiccoord.cpp:65
pappso::XicCoord::~XicCoord
virtual ~XicCoord()
Definition xiccoord.cpp:49
pappso::XicCoord::divideBy
virtual XicCoordSPtr divideBy(double number) const
compute a new xic coord as a division by
Definition xiccoord.cpp:92
pappso::XicCoord::getParam
virtual const QVariant getParam(XicCoordParam param) const
get a specific XIC coordinate parameter
Definition xiccoord.cpp:123
pappso::XicCoord::XicCoord
XicCoord()
Definition xiccoord.cpp:36
pappso::XicCoord::toString
virtual QString toString() const
get a description of the XIC coordinate in a string
Definition xiccoord.cpp:116
xiccoord.h
XIC coordinate in MSrun.